[roadmngr] Fixed Position::Delta sometimes flipping dLandId#266
[roadmngr] Fixed Position::Delta sometimes flipping dLandId#266eknabevcc merged 4 commits intoesmini:masterfrom
Conversation
| if (path->visited_.size() > 0) { | ||
| RoadPath::PathNode* lastNode = path->visited_.back(); | ||
| RoadPath::PathNode* firstNode = lastNode; | ||
| while (firstNode->previous) { |
There was a problem hiding this comment.
I understand this loop. It seems like a flaw that visited[0] is not the actual first road in the "path".
Still it would be nice to skip the loop. I'll check later if there is another solution (to store FIRST road).
There was a problem hiding this comment.
The loop is taken from RoadPath::Calculate, which faces the same problematic of finding the first connection. The method could therefore store that value once found, so that it can be used elsewhere.
esmini/EnvironmentSimulator/Modules/RoadManager/RoadManager.cpp
Lines 4505 to 4528 in 73390cc
There was a problem hiding this comment.
Yes, I like the idea to store the already calculated start direction. And then re-use it the Delta method which could be used frequently, hence we want to minimize unnecessary work.
I took the liberty of committing an attempt to achieve this on your branch. If it builds, please test and report how it works.
then re-use it for all Delta calculations (which could be many and often...)
|
Good that a test case caught a bad attempt from my side. I made another commit that seems to work better. But since it included also changes in RoadManager.hpp (which is not changed in your commit) I can't edit it in this PR. I tried to figure out a way to commit to the PR branch, but I had to give up. Instead I created a branch fix_flip. Could you perhaps merge that branch on your (PR branch)? As a last resort we could close this PR and I could merge fix_flip on master instead. |
|
I merged your branch on this PR, and I ran the test that initially failed (see #261), and it worked as expected. So all is ok on my end. |
|
Excellent, thanks for the fix! |
Hi Emil,
This should fix #261. I've taken this opportunity to also make the
ifcondition more readable.