I am trying to do a basic RRT global planner implementation in ROS Melodic. I am using a wheeled mobile robot for testing my own global planner plugin for robot navigation through move_base. I am loading the map using map server package. As you know RRT requires a point to sample from configuration space, in order to sample random points i use the map bounds obtained by following attribute from costmap_2d.
x_rand.point.x = randomDouble(costmap_->getOriginX(), costmap_->getOriginX() + costmap_->getSizeInMetersX()); x_rand.point.y = randomDouble(costmap_->getOriginY(), costmap_->getOriginY() + costmap_->getSizeInMetersY());
Now, the samples are taken from a bound of X-> (-100, 100), y-> (-100,100) which seem to be default values for ROS.
My actual map is only 40 * 40 in dimension. As you can guess, planner samples a lot of useless point. On top of it when i evaluate the cost of a point which lies outside the 40 * 40 map bounds(actual map bounds) the cost values evaluate to zero, i.e.
costmap_->getCost(x, y) = 0;
This makes the planner think it is a right point to extrapolate towards.
Am i missing something ? please let me know!