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

Difference between Costmap2D and OccupancyGrid not clear

asked 2013-04-04 11:27:38 -0500

Anis gravatar image

updated 2014-01-28 17:16:03 -0500

ngrennan gravatar image

Hello

It is not clear to me what the difference between costmap2d and OccupancyGrid is.

From what I learned in Tutorials, OccupancyGrid will be formed using gmapping and it will have three values: 0 for free space, 100 for obstacle, and -1 for unknown. This map will be used later for navigation.

But in navigation stack, it says that global planner uses costmap2d to make a plan and not the occupancyGrid and that costmap2D has also three values for free, occupied and unknown.

So, may questions are: 1- What is the difference between Costmap2D and OccupancyGrid 2- How to convert from one to another and where this is done? 3- Why Global Planner does not use OccupancyGrid, which seems to provide similar information to Costmap2D

Any clarification of these will be appreciated.

Thanks.

Anis

edit retag flag offensive close merge delete

Comments

I agree that the names are confusing.

joq gravatar image joq  ( 2013-04-05 03:48:30 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
9

answered 2013-04-05 09:48:46 -0500

fergs gravatar image

nav_msgs/OccupancyGrid is a ROS message. This is a map that can be passed around between tools, namely gmapping/karto, amcl, and move_base.

costmap2d is a ROS package, which offers a costmap generation tool, which in fact is really 2.5D. That is, it does raytracing from sensor data into a 3d-voxel map, but it outputs a 2d costmap. It is mainly used via a C++ api, not the ROS message api. When used over ROS messages, it posts nav_msgs/GridCells on a variety of topics corresponding to obstacles, inflated obstacles, and unknown space.

Now, in the context of global planner, all planners use the C++ costmap2d interface. And thus, the global costmap2d is typically initialized from some map, which is typically received over a latched topic using nav_msgs/OccupancyGrid. The costmap2d then can do things needed for planning, like inflating obstacles or adding sensor data to the costmap if desired/configured as such.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2013-04-04 11:27:38 -0500

Seen: 3,305 times

Last updated: Apr 05 '13