Robotics StackExchange | Archived questions

Problems subscribing to the local_costmap of move_base

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 MoveBaseClient;

typedef nav_msgs::OccupancyGrid occupancyGrid;

occupancyGrid global_map;

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

ros::Subscriber subOGrid = banananav.subscribe("movebase/localcostmap/costmapupdates",1000,costmapcallback);

fieldlength = globalmap.info.height;

fieldwidth = globalmap.info.width;

There seems to be a connection between my node and movebase/localcostmapupdates but whenever globalmap.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 globalmap occupancy grid. Why would there be a connection between the nodes, seen via RQT, yet nothing is actually stored to the globalmap occupancy grid? This is only a small portion of my code but if more is needed I will upload more.

Asked by banana_nav on 2016-02-19 15:24:18 UTC

Comments

Answers