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

Costmap_2d doesn't apply .yaml parameters

asked 2013-01-15 02:28:19 -0500

daddy1988 gravatar image

Hi all, I've tried to launch costmap_2d node with this launch code:

<!-- Run the costmap node -->
<node name="costmap_node" pkg="costmap_2d" type="costmap_2d_node" >
<rosparam file="$(find costmap_2d)/launch/params.yaml" command="load" ns="costmap" />
<param name="/use_sim_time" value="false"/>

where params.yaml file contains this

  global_frame: /world
  robot_base_frame: robot
  transform_tolerance: 0.8

  update_frequency: 5.0
  publish_frequency: 0.0

  #set if you want the voxel map published
  publish_voxel_map: true

  #set to true if you want to initialize the costmap from a static map
  static_map: false

  #begin - COMMENT these lines if you set static_map to true
  rolling_window: true
  width: 6.0
  height: 6.0
  resolution: 0.025
  #end - COMMENT these lines if you set static_map to true

  map_type: voxel
  origin_z: 0.0
  z_resolution: 0.2
  z_voxels: 10
  unknown_threshold: 10
  mark_threshold: 0

  #The default maximum distance from the robot at which an obstacle will be inserted into the cost map in meters. 
  #This can be over-ridden on a per-sensor basis.
  obstacle_range: 2.5

  #The maximum height of any obstacle to be inserted into the costmap in meters.      
  #This parameter should be set to be slightly higher than the height of your robot.
  max_obstacle_height: 2.0

  #The default range in meters at which to raytrace out obstacles from the map using sensor data. 
  #This can be over-ridden on a per-sensor basis.
  raytrace_range: 3.0

  #The footprint of the robot specified in the robot_base_frame coordinate frame as a list
  footprint: [[-0.20, -0.25], [-0.20, 0.25], [0.20, 0.25], [0.20, -0.25]]

  footprint_padding: 0.05

  #The radius in meters to which the map inflates obstacle cost values.
  inflation_radius: 0.55

  #A scaling factor to apply to cost values during inflation.
  cost_scaling_factor: 10.0
  lethal_cost_threshold: 100

  #A list of observation source names separated by spaces. 
  #This defines each of the <source_name> namespaces defined below.
  observation_sources: cloud

  cloud: {
  topic: /cloud, 
  #The data type associated with the topic, right now only "PointCloud", "PointCloud2", and "LaserScan" are supported.
  data_type: PointCloud2,
  #How often to expect a reading from a sensor in seconds.
  expected_update_rate: 0.4,
  #How long to keep each sensor reading in seconds.
  observation_persistence: 0.0, 
  #Whether or not this observation should be used to mark obstacles.
  marking: true, 
  #Whether or not this observation should be used to clear out freespace.
  clearing: true, 
  #The maximum height in meters of a sensor reading considered valid.
  max_obstacle_height: 3.4, 
  #The minimum height in meters of a sensor reading considered valid. 
  min_obstacle_height: 0.08,
  #The maximum range in meters at which to insert obstacles into the costmap using sensor data.
  obstacle_range: 4.0

but anything is published (even if /cloud topic contains data). It seems that yaml file hasn't read correctly... What is it wrong?

Thanks in advance

edit retag flag offensive close merge delete



You can use the rosparam command to verify whether the parameter values are set as expected.

joq gravatar image joq  ( 2013-01-15 11:19:05 -0500 )edit

Could you show me the result of "rosparam list"? And you can verify the values with "rosparam get **" so please try it.

moyashi gravatar image moyashi  ( 2013-01-29 14:18:58 -0500 )edit

Could you show me the result of "rosparam list"?

moyashi gravatar image moyashi  ( 2013-01-29 14:19:16 -0500 )edit

3 Answers

Sort by » oldest newest most voted

answered 2014-02-08 11:33:53 -0500

ahendrix gravatar image

I suspect you're specifying the namespace in too many places, and putting the resulting parameters in the wrong place.

To start, I would run your launch file in one terminal and then run rosparam list in another terminal to look at the parameters that you're actually creating.

I can see a couple ways to fix this:

  • Remove the ns="costmap" argument to your rosparam tag
  • Move the rosparam tag outside of the node tag
  • Remove the leading costmap: namespace from your yaml file

For reference, I have this working for my robot: local_costmap.launch and local_costmap.yaml

edit flag offensive delete link more

answered 2014-02-08 11:22:13 -0500

Try this: Change ns="costmap_node/costmap" in

<rosparam file="$(find costmap_2d)/launch/params.yaml" command="load" ns="costmap" />
edit flag offensive delete link more

answered 2014-01-22 00:26:17 -0500

dneuhold gravatar image

Hi, so what you should do is to have a look at the default configuration for costmaps. Therefore, have a look what gmapping starts to create the costmap. There are 3 launch files namely: common_costmap.yaml, local_costmap.yaml and global_costmap.yaml.

Add this configuration to your launch file and you are done! For example: global_frame: /world is definitely wrong!

Hope this helps. BR Daniel

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-01-15 02:28:19 -0500

Seen: 2,351 times

Last updated: Feb 08 '14