I might find a wrong sentence in map_grid.cpp

asked 2018-11-29 20:26:33 -0500

MichaelPan0905 gravatar image

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.

edit retag flag offensive close merge delete


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.

Isha Dijcks gravatar image Isha Dijcks  ( 2018-11-30 02:44:03 -0500 )edit

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.

MichaelPan0905 gravatar image MichaelPan0905  ( 2018-12-01 02:15:52 -0500 )edit