Problems subscribing to the local_costmap of move_base

asked 2016-02-19 14:24:18 -0600

banana_nav gravatar image

I am trying to subscribe to the local costmap produced in move_base in order to use it, in a separate node, for navigation. This is how I am currently approaching it in my code:

typedef actionlib::SimpleActionClient<move_base_msgs::movebaseaction> MoveBaseClient;

typedef nav_msgs::OccupancyGrid occupancyGrid;

occupancyGrid global_map;

void costmapcallback(occupancyGrid costmap){ global_map = costmap; }

ros::Subscriber subOGrid = banana_nav.subscribe("move_base/local_costmap/costmap_updates",1000,costmapcallback);

field_length = global_map.info.height;

field_width = global_map.info.width;

There seems to be a connection between my node and move_base/local_costmap_updates but whenever global_map.info.height/width is called it always returns zeros for both which leads me to believe that the local costmap is never being sent to or saved by the global_map occupancy grid. Why would there be a connection between the nodes, seen via RQT, yet nothing is actually stored to the global_map occupancy grid? This is only a small portion of my code but if more is needed I will upload more.

edit retag flag offensive close merge delete