FLEXSIM-12843-FLEXSIM-11184-A home travel infinite loop on OnResourceAvailable* - #22
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses an A* + “Travel to Home Location” infinite loop by adding a targeted workaround in Traveler::onArrival() to detect the home picklist pattern and, when A* reports “arrived” but the picklist still considers the operator too far, force a short final approach leg before completing the travel task.
Changes:
- Detect the “travel home” picklist pattern (
TASKTYPE_TRAVELfollowed byTASKTYPE_DELAY(0)). - If still outside the picklist threshold on arrival, create and navigate a short “final leg” path to
destLocto break the re-dispatch loop.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| && nextTask->var1 == 0.0; | ||
| if (isTravelHome) { | ||
| Vec3 teLoc = te->getLocation(0.5, 0.5, 0).project(te->holder->up, model()); | ||
| double threshold = objectexists(gettenetnode(te->holder)) |
There was a problem hiding this comment.
If picklist tolerance changes in FlexSim content files, A* corrective behavior can drift unless manually updated.
Please centralize threshold computation in one shared function used by both picklist generation/runtime and A* corrective logic.
There was a problem hiding this comment.
Also agreed the formula is duplicated from the picklist. Full centralization would need a shared FlexScript/C++ API and picklist changes, which is more than this bugfix should carry. Happy to open a follow-up for a shared threshold helper if you think that should be prioritized.
Issue: With A* enabled, OnResourceAvailable → Travel to Home Location sends the operator toward Source but stops after a few steps. The event list loops on A* ArrivalEvents and Delay task completions. Without A*, travel completes normally.
Root cause: A* treats arrival as “within grid-cell threshold,” while the home picklist still sees distancetotravel > threshold and re-dispatches travel causing an infinite loop.
Fix: In Traveler::onArrival, detect the home picklist pattern (TASKTYPE_TRAVEL followed by TASKTYPE_DELAY(0)). If distancetotravel still exceeds the picklist threshold and the operator is not yet at destLoc, walk a short final leg before completing the travel task.
Fix applies to the standard “Travel to a Home Location” picklist (TRAVEL + DELAY(0)). Custom home-travel task sequences may still need separate handling.
Card: https://autodesk.atlassian.net/browse/FLEXSIM-11184 https://autodesk.atlassian.net/browse/FLEXSIM-12843
Test Model - https://github.com/flexsim-adsk/modules-Testing/pull/26