Fixed bug causing global planner to plan to wrong cell #1219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixed a bug that was causing the global planner to compute paths to the wrong cell.
This allowed the global planner to return paths that were in collision.
You can see in the picture below how the global plan clearly ends inside the inscribed region of the costmap (i.e. collision!)
When the param
old_navfn_behavior
was set tofalse
, theworldToMap
function was subtracting0.5
from the resulting cell coordinates, which is wrong. Although it makes sense to add0.5
when converting from map to world (in order to return the center of the cell rather than the corner), the opposite is not true!You can also confirm how in
Costmap2D::mapToWorld
we add0.5
to get the center of the cell, but we don't subtract0.5
when doing the opposite operation inCostmap2D::worldToMap
.navigation/costmap_2d/src/costmap_2d.cpp
Lines 202 to 206 in 47c9c62
navigation/costmap_2d/src/costmap_2d.cpp
Lines 208 to 220 in 47c9c62