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

Need some basic information regarding costmap_2D

asked 2012-05-14 04:40:06 -0600

madmax gravatar image

updated 2012-05-14 09:57:28 -0600


I have some problems understanding the behaviour of the costmap_2D class. First, I don't get how this class is started.

Right now I have a launch file, like in the navigation stack tutorial.

  <node pkg="robot_mover" type="robot_mover" respawn="false" name="robot_mover" output="screen">
    <rosparam file="$(find robot_mover)/cfg/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find robot_mover)/cfg/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find robot_mover)/cfg/global_costmap_params.yaml" command="load" />

where robot_mover is my package which shall be similar to the move_base package in the end.

And in my robot_mover package I have this code:

tf::TransformListener tf(ros::Duration(10));
costmap_2d::Costmap2DROS costmap("my_costmap", tf);

When I launch this either with

roslaunch robot_mover robot_mover.launch

or with

rosrun robot_mover robot_mover

I always get this warning:

You have set map parameters, but also requested to use the static map. Your parameters will be overwritten by those given by the map server

Where do I request a static map here?
And why do I get this warning when I use rosrun?
I only set parameters in the yaml files which are called in the launch file, don't I?

I also start gmapping:

rosrun gmapping slam_gmapping scan:=base_scan

Does ROS mean the map from gmapping with this warning?

Don't know how else I could start this costmap.
I just wanna build a simple exploration algorithm that detects obstacles in front of my robot and therefore I wanted to use the grid with included obstacles.

Or shall I just ignore this warning?
Is it possible to get relevant data for obstacles out of the costmap variable of my class to compute the grid myself?

Hard to find anything in the ROS Wiki for this specific problem.

My yaml files look like that:


obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[-0.200, -0.350], [-0.200, 0.350], [0.200, 0.350], [0.200, -0.350]]
#robot_radius: ir_of_robot
inflation_radius: 0.55

observation_sources: laser_scan_sensor 

laser_scan_sensor: {sensor_frame: /base_laser_link, data_type: LaserScan, topic:  base_scan, marking: true, clearing: true}


   global_frame: odom
   robot_base_frame: base_link
   update_frequency: 5.0
   static_map: false


   global_frame: odom
   robot_base_frame: base_link
   update_frequency: 5.0
   publish_frequency: 2.0
   static_map: false
   rolling_window: true
   width: 6.0
   height: 6.0
   resolution: 0.05

A bit much, but hopefully someone can help me!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-05-14 07:50:05 -0600

DimitriProsser gravatar image

First, I believe this warning is due to the fact that in your global_costmap_params.yaml, you set static_map to false, but do not set rolling_window to true, and it defaults to false. You're essentially telling the costmap that it does not have a map or that it does not exist.

Second, this might just be an artifact of ROS Answers, but your parameters should be indented under the namespaces:

    global_frame: odom

I'm assuming this is done, because I don't know if it would even run otherwise, but I just wanted to check.

edit flag offensive delete link more


Oh, thanks! I will try that. And yes, in my file it is indented.

madmax gravatar image madmax  ( 2012-05-14 09:55:43 -0600 )edit

Tried it now, and it doesn't help... Is there a rolling window option in the global costmap ?

madmax gravatar image madmax  ( 2012-05-15 06:14:25 -0600 )edit

The same rolling_window options exist for both costmaps (they're both costmap_2d, you just give each different parameters)

DimitriProsser gravatar image DimitriProsser  ( 2012-05-15 06:34:44 -0600 )edit

In the navigation documentation, I only see that static_map must be false if rolling_window is true. Is it also true that rolling_window must be true if static_map is false? If so, that might explain some of my problems (I was assuming that it initialize an empty map).

mkoval gravatar image mkoval  ( 2012-05-27 09:05:51 -0600 )edit

Question Tools


Asked: 2012-05-14 04:40:06 -0600

Seen: 1,461 times

Last updated: May 14 '12