ros-navigation / navigation2

ROS 2 Navigation Framework and System
https://nav2.org/
Other
2.31k stars 1.2k forks source link

Fix map to world coordinate conversion #4506

Closed HovorunBh closed 6 days ago

HovorunBh commented 6 days ago

Basic Info

Info Please fill out this column
Ticket(s) this addresses
Primary OS tested on Ubuntu
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
Does this PR contain AI generated software? No

Description of contribution in a few bullet points

For reproducing the issue see the test I added

We noticed that ComputePathThroughPoses with SmacPlannerHybrid when asked to generate path through poses that are on the same line (in this example: [{x: 2, y: 0}, {x: 4, y: 0}, {x: 6, y: 0}]) generates path like this: Screenshot from 2024-07-01 13-33-38

It is assumed that end of path1 is the start of path2, but when end of path1 is converted from map to world, and then back to map it ends up in a different costmap cell.

When we convert world to map coordinates we add 0.5

Therefore when we convert map to world I think we should subtract 0.5. Otherwise we end up in the next costmap cell With this change path looks like more straight: Screenshot from 2024-07-01 13-35-33

Description of documentation updates required from your changes


Future work that may be required in bullet points

For Maintainers:

codecov[bot] commented 6 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Files Coverage Δ
...2_smac_planner/include/nav2_smac_planner/utils.hpp 98.64% <100.00%> (ø)

... and 2 files with indirect coverage changes

SteveMacenski commented 6 days ago

Thanks! All good points, well explained, and with visual examples!