0
$\begingroup$

Rosanswers logo

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"/>
</node>

where params.yaml file contains this

costmap:
  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

  #START VOXEL STUFF
  map_type: voxel
  origin_z: 0.0
  z_resolution: 0.2
  z_voxels: 10
  unknown_threshold: 10
  mark_threshold: 0
  #END VOXEL STUFF

  #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


Originally posted by daddy1988 on ROS Answers with karma: 21 on 2013-01-15

Post score: 2


Original comments

Comment by joq on 2013-01-15:
You can use the rosparam command to verify whether the parameter values are set as expected.

Comment by moyashi on 2013-01-29:
Could you show me the result of "rosparam list"? And you can verify the values with "rosparam get ****" so please try it.

Comment by moyashi on 2013-01-29:
Could you show me the result of "rosparam list"?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by ahendrix with karma: 47576 on 2014-02-08

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.