Hi all,
I am planning to write my own node in ROS and I need to access the `global_costmap` which is being published. I have the following piece of code:
int main(int argc, char** argv){
ros::init(argc,argv,"publish_multiple_goals");
ros::NodeHandle n;
tf::TransformListener tf_(ros::Duration(10));
costmap_ros_ = new costmap_2d::Costmap2DROS("global_costmap", tf_);
costmap_ros_->start();
costmap_ = costmap_ros_->getCostmap();
unsigned int sizeX = costmap_->getSizeInCellsX();
unsigned int sizeY = costmap_->getSizeInCellsY();
std::cout << "SX: " << sizeX << " SY: " << sizeY << std::endl;
return 0;
}
Now the problem is I don't think I am getting the `global_costmap` because the size getting printed is (200,200) (Its the default I guess). The correct size of the global_costmap is (280,457). Can anyone tell me what is wrong here? Or If there is any other way to obtain a copy of the `global_costmap`, please let me know. Let me know if you need more information from my side.
**Update:**
Yeah, I was able to subscribe to `/move_base_node/global_costmap/costmap` and obtain `nav_msgs/OccupancyGrid` message but I was wondering how can I have a new Costmap object which is an exact copy of the global_costmap being published my move_base instead of just getting the OccupancyGrid data or how can I create a costmap object once I have this Occupancy Grid data? I would like to have this so that I can use all the costmap functions.
Thanks in advance.
Naman Kumar
↧