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

obstacle_layer does not clear area

asked 2014-05-15 21:55:46 -0600

Luke_ROS gravatar image

updated 2014-05-20 00:21:27 -0600

I'm experiencing a very strange and to me random behavior from the obstacle_layer. To visualize my point I recorded a bag file and launched it over and over again with the same settings. The situation is like this: The costmap is getting initialized with a previously recorded pgm image. Without changing the settings of the *_params. files I get different outcomes. I moved the trash can in the lower left corner to the area right-above its original position. Sometimes the original position gets cleared (as called for) and sometimes it does not get cleared. Can anybody help me with that problem?


I reached the necessary karma level and can provide you with screen shots. So the "real world situation" is like that. I place and do not move the robot. Then I move the trash can from its original position (just when you come through the door to your right) to its new position (right wall). The screen shots are taken at the approximately same time but as mentioned above with different outputs from different runs.

The first image shows the situation when the clearing does not seem to work and the second image shows the situation where the clearings works as expected. The effect can also be seen at the left wall of the entrance door. The green dots should visualize the clearing_endpoints and the red dots represent the laser scan.

image description

image description

If relevant: I use Hydro on an Ubuntu 12.04 LTS.


  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: true
  rolling_window: false
    - {name: static_layer, type: "costmap_2d::StaticLayer"}
    - {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}


global_frame: /map
robot_base_frame: /base_link
map_type: voxel
publish_voxel_map: true
footprint: [[0.235, 0.31], [-0.515, 0.31], [-0.515, -0.31], [0.235, -0.31]]

  map_topic: /map

  max_obstacle_height: 2.0
  obstacle_range: 2.5
  raytrace_range: 3.0

  origin_z: -0.08
  z_resolution: 0.2
  z_voxels: 6
  unknown_threshold: 6
  mark_threshold: 0

  track_unknown_space: true
  combination_method: 0

  observation_sources: laser

  laser: {sensor_frame: base_laser_link, data_type: LaserScan, topic: scan, marking: true, clearing: true}


<?xml version="1.0" encoding="UTF-8" ?>


    <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen" clear_params="true">
    <!-- default:20.0. with this value dwa planner fails to find a valid plan a lot more -->
    <param name="controller_frequency" value="10.0" />
    <param name="controller_patience" value="15.0" />
    <param name="planner_frequency" value="2.0" />
    <param name="clearing_rotation_allowed" value="false" />
    <rosparam file="$(find scitos_2d_navigation)/scitos_move_base_params/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find scitos_2d_navigation)/scitos_move_base_params/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find scitos_2d_navigation)/scitos_move_base_params/global_costmap_params.yaml" command="load" />

    <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
    <rosparam file="$(find scitos_2d_navigation)/scitos_move_base_params/dwa_planner_ros.yaml" command="load" />


launch-file for starting the bag-file:

<?xml version="1.0" encoding="UTF-8" ?>

    <!-- launch map server -->
    <node name="map_server" pkg="map_server" type="map_server" args="$(find scitos_2d_navigation)/maps/floorsix.yaml"/>

    set up time nicely so there is no problem with old, outdated timestamps; rosparam set use_sim_time true
    <param name="/use_sim_time" value="true"/>
    <node pkg="rosbag" type ...
edit retag flag offensive close merge delete


I think you have adequate karma now. Please post pictures, because otherwise it is unclear what you are talking about. If you can't post pictures on the forum, please upload them elsewhere and link to them.

David Lu gravatar image David Lu  ( 2014-05-19 18:32:02 -0600 )edit

Thanks David. I updated my question with the screen shots.

Luke_ROS gravatar image Luke_ROS  ( 2014-05-20 00:19:18 -0600 )edit

Does the laser you're using move relative to the base of the robot? (like the PR2's tilting laser?)

David Lu gravatar image David Lu  ( 2014-05-20 06:24:23 -0600 )edit

The tf tree is fixed. So no moving lasers or anything.

Luke_ROS gravatar image Luke_ROS  ( 2014-05-20 21:22:13 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-05-21 06:54:25 -0600

David Lu gravatar image

updated 2014-06-24 14:55:58 -0600

I think that the reason you get different outcomes on different runs is that you're maintaining a 3 dimensional costmap when you only need a two dimensional one. Try changing your VoxelLayer to an ObstacleLayer.

Edit: The different outcomes I believe are related to this bug. since the points that are not getting cleared from the costmap are from the static map

edit flag offensive delete link more


Sorry for the late reply. It took me some time to get a hand on the robot again. It does not make a difference. Neither layer clears the area...

Luke_ROS gravatar image Luke_ROS  ( 2014-06-03 11:00:35 -0600 )edit

Can you share the bag file?

David Lu gravatar image David Lu  ( 2014-06-13 15:40:39 -0600 )edit

Sure. Let me check if I can organize some server space for that.

Luke_ROS gravatar image Luke_ROS  ( 2014-06-17 07:04:08 -0600 )edit

Thanks a lot. The thing is that I wanted to start simple with just the laser. Other sources will come into play in a later step.

Luke_ROS gravatar image Luke_ROS  ( 2014-06-26 08:14:29 -0600 )edit

answered 2021-01-12 06:53:02 -0600

ZGJ gravatar image

Hi, i have some questions about the obstacle layer. When the robot moved, the obstacles on the costmap are not moved. So the costmap published is not correct! Have you encountered the same problem?

edit flag offensive delete link more

answered 2014-05-15 23:13:09 -0600

AbuIbra gravatar image

When you visualize your laserScan with "rostopic echo /scan" does it show a lot of zeros (or Infs)?

If so, create a filter to change these values to your laser max range values.

Maybe you are not clearing because your lasers do not tell that "they see staff beyond" the place where there used to be an obstacle.

edit flag offensive delete link more


Thanks for the reply. The ranges values are all above 0 and below inf. Only the intensities are all 0.0 but that should not be a problem. I checked the laser output and it actually shows the wall behind the obstacle. If my karma would be higher I would post a screen shot.

Luke_ROS gravatar image Luke_ROS  ( 2014-05-16 04:08:17 -0600 )edit

Question Tools

1 follower


Asked: 2014-05-15 21:55:46 -0600

Seen: 2,627 times

Last updated: Jun 24 '14