ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

laser scan to occupancy grid using costmap_2d [new user]

asked 2014-08-26 08:47:34 -0600

AliAs gravatar image

updated 2014-08-27 18:58:05 -0600

Hi all,

Acording to http://wiki.ros.org/costmap_2d it takes in sensor data from the world and builds a 2D occupancy grid of the data. I have a published topic: /scan (sensor_msgs/LaserScan) and I want to use costmap_2d to provide a current occupancy grid. (sensor data --> [2d costmap] --> 2d occupancy grid)

But the same reference ( http://wiki.ros.org/costmap_2d ) says:

  • Subscribed Topics:
  • /footprint (geometry_msgs/Polygon)
  • Published Topics:
  • /grid (nav_msgs/OccupancyGrid)
  • /grid_updates (nav_msgs/OccupancyGridUpdate)
  • /voxel_grid (costmap_2d/VoxelGrid)

It seems the costmap_2d doesn't subscribe the (sensor_msgs/LaserScan) that I have it published. The only subscribed topic for costmap_2d is: /footprint (geometry_msgs/Polygon). What should I do to have /scan topic subscribed to costmap_2d node? (I'm trying to use standalone costmap_2d node)

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-08-26 10:05:55 -0600

paulbovbel gravatar image

updated 2014-08-26 12:52:02 -0600

You can't run costmap_2d as a node, however you can write your own node that will contain a Costmap2DROS object and little else. As David points out below, you CAN run a costmap_2d node that does this for you.

Check out the API, as well as how the object is typically used in move_base.

Costmaps don't explicitly subscribe to any sensors, they delegate that to layers. Setting up an obstacle layer to subscribe to a laser sensor source is done using parameters, and is described here - http://wiki.ros.org/costmap_2d/Tutori...

edit flag offensive delete link more

Comments

Thanks Paul. It seems more complicated than I thought. I will proceed with the steps and share the result here.

AliAs gravatar image AliAs  ( 2014-08-26 10:25:48 -0600 )edit
2

You are incorrect on the first point, Paul. You can run it as its own node. https://github.com/ros-planning/navig...

The rest is correct.

David Lu gravatar image David Lu  ( 2014-08-26 11:14:32 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2014-08-26 08:47:34 -0600

Seen: 3,494 times

Last updated: Aug 27 '14