I might find a wrong sentence in map_grid.cpp
In base_local_planner/src/map_grid.cpp, line 150, here is a sentence to find "steps" which is used to smooth(I think) the global_plan we input, which is like this:
int steps = ((sqrt(sqdist) - sqrt(min_sq_resolution)) / resolution) - 1;
I think this sentence is wrong, it should be like this:
int steps = ((sqrt(sqdist) - sqrt(min_sq_resolution)) / resolution) + 1;
cause the "steps" tells us how many nodes we should add between two origin nodes in global_plan_input, and it should be positive. The old sentence may lead to less nodes that we add than we should, and in some extreme cases, like the sqrt(sqdist) equals 3 times of the resolution, it might carsh in the next two lines:
double deltax = (loop_x - last_x) / steps;
double deltay = (loop_y - last_y) / steps;
because the steps equals 0.
If you think this is a bug in the implementation, you can submit an issue on their GitHub issues page.
Once it is confirmed as a bug you could submit a pull request that fixes it.
Thanks.But I think it has little influence on robot's nav.Just lead to less added points while adjusting the orignal plan, and those points might be needless to be added in many conditions.Anyway, not everytime do we need to add points between two points.