Global planner 'not valid start or goal' unless cost of costmap==0

asked 2022-09-05 09:16:28 -0500

OverDemon gravatar image

updated 2022-09-05 09:17:52 -0500

I am working to make my own global planner and are planning to use this code as a foundation to get started.

I started by testing whether I could simulate the turtlebot3 in Gazebo navigating to a 2D Nav Goal in Rviz, using the relaxed_astar package as my global planner. It didn't work in the beginning, triggering this error: RAstar_ros.cpp line 265 - ROS_WARN("Not valid start or goal");

After some time I discovered the problem being that in RAstar_ros.cpp line 119 the places where the robot may go determined by the isFree function is only set to true if the cost of the costmap is 0. My solution was therefore to change the code so instead of:

unsigned int cost = static_cast<int>(costmap_->getCost(ix, iy));
        //cout<<cost;
        if (cost == 0)
          OGM[iy*width+ix]=true;
        else
          OGM[iy*width+ix]=false;
      }

I had:

unsigned int cost = static_cast<int>(costmap_->getCost(ix, iy));
        //cout<<cost;
        if (cost < 80)
          OGM[iy*width+ix]=true;
        else
          OGM[iy*width+ix]=false;
      }

This allows the robot to move and navigate. However, this seems like a rather crude solution with the possibility to go wrong in certain situations. I therefore wondered if there were a better solution to this whole problem than just setting if(cost < ?) with some random value that works through trial and error?

edit retag flag offensive close merge delete