Robotics StackExchange | Archived questions

accessing local costmap and footprint

I am trying to access the costmap published by move base as a topic move_base/local_costmap/footprint in another ros node like this:

tf2_ros::Buffer buffer(ros::Duration(10));

tf2_ros::TransformListener tf(buffer);
costmap_2d::Costmap2DROS cost_map("/move_base/local_costmap", buffer);
cost_map.start();

while (ros::ok())
{
cost_map.updateMap();

// Dynamic footprint according to rotation of body
std::vector<geometry_msgs::Point> P1;
P1 = cost_map.getRobotFootprint();
}

But this is not working somehow and shows and error like:

[update_footprint-6] process has died [pid 10589, exit code -11, cmd /home/ubuntu/bini_ws/devel/lib/motion_controllers/update_footprint_node __name:=update_footprint __log:=/home/ubuntu/.ros/log/0ed228d2-469a-11ec-939e-4f97b0f0f331/update_footprint-6.log].
log file: /home/ubuntu/.ros/log/0ed228d2-469a-11ec-939e-4f97b0f0f331/update_footprint-6*.log

How should i resolve this issue?

Asked by dinesh on 2021-11-16 00:01:17 UTC

Comments

Answers

cost_map("/move_base/local_costmap", buffer); should be a description to create a cost map to publish /move_base/local_costmap. I think it is not a description to subscribe( access ) to /move_base/local_costmap.

Can you adopt the method of creating a subscriber that subscribes to /move_base/local_costmap/footprint?

Asked by miura on 2021-11-16 19:06:18 UTC

Comments

I need both costmap as well as footprint data inside my ros node. what can i do?

Asked by dinesh on 2021-11-16 22:48:40 UTC

As @miura suggests, subscribe to the move_base topics. The costmap_2d::Costmap2DROS class is not what you want to use - its purpose is to create and update a costmap (typically from sensor inputs.)

Asked by Mike Scheutzow on 2021-11-17 07:09:02 UTC

@dinesh I think you can subscribe to /move_base/local_costmap/costmap and /move_base/local_costmap/footprint.

Asked by miura on 2021-11-17 20:21:52 UTC

If i subscribe to /move_base/local_costmap/costmap how am i going to calculate cost value of given cell from that topic data?

Asked by dinesh on 2021-11-18 02:56:11 UTC

@dinesh I think the content has changed since the original question. Creating another question is more likely to get more input.

Asked by miura on 2021-11-18 09:13:30 UTC