-
Notifications
You must be signed in to change notification settings - Fork 1.6k
nav2_smac_planner: Fix incorrect conversion between costmap and worlrd coordinates #4949
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
Conversation
… coordinates The Smac planner computes paths using costmap coordinates (cell indexes). Therefore, conversions between world coordinates and costmap coordinates are required. The issue was that the world-to-costmap conversion used a floor approximation, while the costmap-to-world conversion behaved as if a ceil approximation had been used. As a result, the planner's output was often shifted in the negative direction. This commit corrects the inconsistency to ensure proper alignment between costmap and world coordinates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was changed in July to supposedly fix the issue in reverse: 137b93b (and that test that was added is now failing in this PR 😉 )
What distribution did you test this against? Main / Rolling / Jazzy is -, but humble / iron is + due to backport conflicts, so it seems like humble/iron are outliers and inconsistent with the current state of the main branches.
I'm therefore wondering if this change is actually correct. I think perhaps you need to invert that in Humble / Iron that you're using and the main change is incorrect. Or, do you think the previous PR to change it that's in Main/Rolling/Jazzy is wrong? Its worth pausing and having that conversation since your issue reports using iron but this PR is against main. I'm wondering if you inverted them in iron to fix it, but then submitted the inversion in main assuming that they were the same (and they're not; apparently).
Please test and let me know :-) If the right answer is to fix Iron / Humble, submitting PRs with the compliment of this change there should be easy for me to merge. I don't typically accept new PRs for EOL distributions (Iron), but I will in this case since this is presumably a mathematical error
|
I notice that the Iron version of the test function does not contain any Regarding the change suggested by @FrGrQuim, I believe that it would make sense (whatever the version) only if However, Conclusion |
|
After analyzing the implementatinos of On I think that's what @HovorunBh was attempting to fix in #4506 about 2-3 months later, but changed the sign because that visually fixed the issue. @HovorunBh can you let us know about your thinking/testing for that? Was it just a visual comparison (and would just removing the Assuming @BriceRenaudeau and @HovorunBh agree - I think that's a sensible move to remove from both terms. This looks to possibly be an issue that is the result of continuous coordinate updates, when we previously didn't have that feature, and we missed a spot + added another spot to compensate. |
|
@SteveMacenski, You are right, this is clearly a mistake. I might have confused with mapToWorld... |
|
@FrGrQuim or @DylanDeCoeyer-Quimesis - mind opening a PR to adjust respectively? @BriceRenaudeau thanks for the fast feedback! |
|
My fix in #4506 was indeed based on visual testing and observed misalignments in planned paths. Additionally, I noticed an inconsistency in how +0.5 was handled between mapToWorld and worldToMap, which led to the argument in my PR:
I didn't go any deeper trying to verify whether simply removing the +0.5f from worldToMapContinuous would have had the same effect. But your explanation makes sense, I think it is a good idea and it will resolve both issues! |
Done! #5049 |
|
OK! Thanks everyone for your quick feedback and confirmation! Closing this one as #5049 supersedes |
The Smac planner computes paths using costmap coordinates (cell indexes).
Therefore, conversions between world coordinates and costmap coordinates are required.
The issue was that the world-to-costmap conversion used a floor approximation, while the costmap-to-world conversion behaved as if a ceil approximation had been used.
As a result, the planner's output was often shifted in the negative direction.
This commit corrects the inconsistency to ensure proper alignment between costmap and world coordinates.
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
Description of how this change was tested
Future work that may be required in bullet points
For Maintainers: