Fix bug where global planner lethal cost is always 1 unit smaller than expected #78
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
This is a fix to an issue I reported on upstream over 2 years ago:
I found this issue again while working on the route deviation layer.
We set
lethal_cost_
of the global planner to be 253 (i.e.costmap_2d::INSCRIBED_INFLATED_OBSTACLE
).This is correct -- if the robot center is at a cell of cost 253, the robot is in collision.
The problem is that the global planner treats this cost as if it was the
costmap_2d::LETHAL_OBSTACLE
cost, and so assumes thatlethal_cost_ - 1
is also in collision (i.e.costmap_2d::INSCRIBED_INFLATED_OBSTACLE
).The whole point of this param being dynamically reconfigured is that we don't have to be tied to the value of
costmap_2d::LETHAL_OBSTACLE
and so we also shouldn't assume thatlethal_cost_ - 1
is lethal too.So if you happen to have an aggressive inflation factor that causes most cells to have the highest possible free cost (i.e. 252), then the potential field will look like in the image, where every cell outside the route is not expanded because we set
lethal_cost_
tocostmap_2d::INSCRIBED_INFLATED_OBSTACLE
and socostmap_2d::INSCRIBED_INFLATED_OBSTACLE - 1
is also treated as lethal.This will result in the global planner failing to find any valid paths as soon as the robot center touches the gray area.