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

ROS Navigation. Global Costmap clears obstacles behind robot.

asked 2017-04-05 23:12:37 -0500

enthusiast-robotics gravatar image

updated 2017-04-06 01:25:29 -0500


So I am starting out in ROS 2D navigation (with RTABMap), and I have managed to create a database, saving it, and then have the turtlebot navigate on it (following the RTABMap navigation demo). I am using an Astra camera (following the 3dsensor.launch with the Astra SDK), and using the depthimage_to_laserscan to produce a scan topic.

Now, when I add a new obstacle in front of the camera, the global costmap updates and shows the area as an obstacle, wherever I place them, this is working fine. The problem is, that when I rotate the robot and it can no longer see the obstacle, the global costmap immediately updates and clears the obstacle from the map.

I have tried reading the navigation stack documentation, and I thought that raytracing only clears obstacles if the laserscanner sees that there's an unblocked view on where the obstacle used to be. It seems that it is just clearing any obstacle that is no longer in the laser scanner field of view.

I also tried going through the forum, but all the questions I could find were referring to actually clearing the obstacle (while my problem is that they are clearing when they shouldn't). Seems that the problem for most people is that the obstacles do not clear.

The problem I am having is:

  1. The global costmap clears any obstacle that it cannot see, even if the obstacle is outside of the field of view of the laser scanner.

Could someone provide me with some pointers to fix this? I tried changing the costmap_params (common, global), but the obstacles keep clearing.

This is my costmap_common_params.yaml

max_obstacle_height: 0.60  # assume something like an arm is mounted on top of the robot

# Obstacle Cost Shaping (
robot_radius: 0.20  # distance a circular robot should be clear of the obstacle (kobuki: 0.18)
# footprint: [[x0, y0], [x1, y1], ... [xn, yn]]  # if the robot is not circular

map_type: voxel

  enabled:              true
  max_obstacle_height:  0.6
  origin_z:             0.0
  z_resolution:         0.2
  z_voxels:             2
  unknown_threshold:    15
  mark_threshold:       0
  combination_method:   1
  track_unknown_space:  true    #true needed for disabling global path planning through unknown space
  obstacle_range: 2.5
  raytrace_range: 3.0
  origin_z: 0.0
  z_resolution: 0.2
  z_voxels: 2
  publish_voxel_map: false
  observation_sources: bump
    data_type: PointCloud2
    topic: mobile_base/sensors/bumper_pointcloud
    marking: true
    clearing: false
    min_obstacle_height: 0.0
    max_obstacle_height: 0.15
  # for debugging only, let's you see the entire voxel grid

#cost_scaling_factor and inflation_radius were now moved to the inflation_layer ns
  enabled:              true
  cost_scaling_factor:  5.0  # exponential rate at which the obstacle cost drops off (default: 10)
  inflation_radius:     0.5  # max. distance from an obstacle at which costs are incurred for planning paths.

  enabled:              true

Thank you!

EDIT1: So one of the problems was that I had not added the obstacle layer definition in the global_costmap_params.yaml. I changed it to this and it is now partly working:

   global_frame: /map
   robot_base_frame: /base_footprint
   update_frequency: 1.0
   publish_frequency: 0.5 ...
edit retag flag offensive close merge delete



The problem seems to be on rtabmap side. Can you update your question with which version are you using (Indigo/Kinetic/source)? Can you show a screenshot of the map? Without the obstacle_layer, the obstacle should also stay in the global map. Maybe related to

matlabbe gravatar image matlabbe  ( 2017-04-06 08:10:06 -0500 )edit

Dear matlabbe,

I am using Ubuntu 16.04 with ros kinetic. Rtabmap (and rtabmap ros) was compiled from source from the github code. Unfortunately, I will not have access to screenshots until next week. It looks like a perfectly normal map (no weird arc behind like in the link).

enthusiast-robotics gravatar image enthusiast-robotics  ( 2017-04-06 10:26:05 -0500 )edit

Except that obstacles disappear when the robot is facing the opposite way from the obstacle. The screenshot would be similar to my previous [fixed] question here: http://official-rtab-map-forum.67519....

enthusiast-robotics gravatar image enthusiast-robotics  ( 2017-04-06 10:28:32 -0500 )edit

It may be worth noting that this happens during localization mode. When I just want to navigate the map, and create new obstacles as I navigate a known map.

enthusiast-robotics gravatar image enthusiast-robotics  ( 2017-04-06 10:30:18 -0500 )edit

I will check next week by trying the flip_scan parameter set to true!

enthusiast-robotics gravatar image enthusiast-robotics  ( 2017-04-06 10:55:53 -0500 )edit

Also worth noting: without the obstacle layer added on the first EDIT, NULL laser scan topic values would clear any obstacles. E.g., an obstacle is added, costmap shows, I block the camera with my hand (without moving the robot) causing the topic to be null, and the costmap would clear the obstacle.

enthusiast-robotics gravatar image enthusiast-robotics  ( 2017-04-06 11:05:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-11 20:22:24 -0500

enthusiast-robotics gravatar image

updated 2017-04-11 20:24:50 -0500

Dear Matlabbe,

Thank you for your answer! I was able to fix it by setting:

<node pkg="rtabmap_ros" type="rtabmap" name="rtabmap">
    <param name="map_negative_poses_ignored" type="bool" value="true"/>

This way, the obstacles behind the robot no longer disappear (Ubuntu 16.04, ROS Kinetic, Rtabmap compiled from Source Feb 2017).

Sadly, the "better fix" with:

<node pkg="rtabmap_ros" type="rtabmap" name="rtabmap">
    <param name="flip_scan" type="bool" value="true"/>

Did not work. Do you have any idea why?


edit flag offensive delete link more

Question Tools



Asked: 2017-04-05 23:12:37 -0500

Seen: 1,402 times

Last updated: Apr 11 '17