ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Correct way to use Costmap2DROS

asked 2015-06-11 20:01:03 -0600

Sebastian gravatar image

I have an "algorithm" node, which designs a path for a turtlebot to follow based on a static_map being published by a map_server.

Inside my algorithm node, I instantiate a Costmap2DROS object. Then, I do stuff like map->getCostmap()->getCost(x,y) etc. in order to get the cost values and information about the map.

Is this the correct way to go about reading maps in the ROS system? I just want to make sure I am on the right track so far.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-06-12 03:01:07 -0600

Sebastian Kasperski gravatar image

It seems like a reasonable thing to do. You basically initialize a global costmap with your static_map from the map server. However, if you don't need specific functions from Costmap2d, you can also just subscribe the map topic in your node and directly work on the nav_msgs::OccupancyGrid data. But especially for planning I think using Costmap2d is the way to go.

edit flag offensive delete link more


Ok, thanks. I was confused because there are so few examples using Costmap2D that I wasn't confident about the intended usage.

Sebastian gravatar image Sebastian  ( 2015-06-12 11:54:00 -0600 )edit

answered 2015-06-12 06:29:36 -0600

On a related note: What is the best way to perform collision queries for a global planner? There is the base_local_planner::WorldModel::footprintCost which returns negative cost if the footprint collides with an obstacle. Is there something similar for the global_planner that checks the point-robot against the inflated obstacles for better performance?

edit flag offensive delete link more


I think I have found the answer: costmap_2d::Costmap2D::getCost returns the point-robot collision against the master layer of the costmap.

Progtologist gravatar image Progtologist  ( 2015-06-12 09:12:34 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-06-11 20:01:03 -0600

Seen: 845 times

Last updated: Jun 12 '15