-
Notifications
You must be signed in to change notification settings - Fork 4
FLEXSIM-12843-FLEXSIM-11184-A home travel infinite loop on OnResourceAvailable* #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1529,6 +1529,38 @@ void Traveler::onArrival(bool isAtZeroSpeed) | |
| double atTravelDist = updateLocation(true); | ||
| updateSpeedMarkers(); | ||
| cullExpiredAllocations(); | ||
|
|
||
| if (activeState == Active && !isNavigatingAroundDeadlock && destNode && objectexists(te->activetask)) { | ||
| Task* task = te->activetask->objectAs(Task); | ||
| treenode tsNode = te->activetask->up; | ||
| Task* nextTask = (objectexists(tsNode) && te->activetask->rank < content(tsNode)) | ||
| ? rank(tsNode, te->activetask->rank + 1)->objectAs(Task) : nullptr; | ||
| bool isTravelHome = task->type == TASKTYPE_TRAVEL | ||
| && nextTask | ||
| && nextTask->type == TASKTYPE_DELAY | ||
| && 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)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If picklist tolerance changes in FlexSim content files, A* corrective behavior can drift unless manually updated.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| ? 0.5 * xsize(te->holder) | ||
| : xsize(te->holder) + 0.2 * std::max(xsize(destNode), ysize(destNode)); | ||
| double approachDist = (destLoc - teLoc).magnitude; | ||
| if (distancetotravel(te->holder, destNode) > threshold && approachDist > navigator->minNodeSize.x * 0.001) { | ||
| TravelPath finalPath; | ||
| Cell curCell = navigator->getCell(teLoc); | ||
| AStarPathEntry startEntry(curCell, -1); | ||
| startEntry.modelLoc = teLoc; | ||
| startEntry.atTravelDist = atTravelDist; | ||
| finalPath.push_back(startEntry); | ||
| AStarPathEntry destEntry(curCell, -1); | ||
| destEntry.modelLoc = destLoc; | ||
| finalPath.push_back(destEntry); | ||
|
Shivi-lab marked this conversation as resolved.
|
||
| finalPath.startZRot = te->b_spatialrz; | ||
| navigatePath(std::move(finalPath)); | ||
| return; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (isAtZeroSpeed) { | ||
| finalizeAtLocation(atTravelDist); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.