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

Why doesn't costmap clear the old obstacles outside the scanner scope?

asked 2015-08-07 09:35:00 -0500

Dragon Qu gravatar image

updated 2015-08-07 09:56:51 -0500

image description

I can't upload the snapshot. So hopfully I can make the issue clear.

When I was using turtlebot to navigate along the known map, the costmap would inflate the static map which is fairly well. The XTion scanner found the obstacles marked as yellow which was removed after a while. The scanner was not aware of this new situation because was outside the scanner scope at the moment. I setup a new destination on the map but ROS reported Failed to find the route on the map. It was caused by those obstacles who were in the way minutes ago.

I wonder why costmap doesn’t remove the out of date obstacles in a given period? In this situation how to make the ROS navigation stack figure out a route?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-08-11 17:31:36 -0500

David Lu gravatar image

Sidd is correct. The costmap aims to keep the map up to date with the most recent information it got. If it sees obstacles and then moves away without clearing them, it will keep that information forever (or until new sensor data clears the obstacles).

If this causes no path to be found, the recovery behaviors should trigger to clear the obstacles.

If you wish not to remember this data at all, you can remove the obstacles layer from your global costmap, and the obstacle layer in the local costmap will keep you from hitting obstacles.

edit flag offensive delete link more


David, thanks for answering this. Could you possibly give more specifics for how to remove the obstacles layer from the global costmap? For example, what files do I need to modify/how? New to ROS- thanks so much.

jackiescay gravatar image jackiescay  ( 2017-09-27 08:22:47 -0500 )edit

FYI - I just submitted a PR that adds an obstacle_timeout parameter to voxel_layer, which removes obstacles from the voxel grid, using a timeout based on each voxel's insertion time.

vpradeep gravatar image vpradeep  ( 2018-06-06 09:50:39 -0500 )edit

answered 2020-09-03 05:34:01 -0500

Ahmed Osman gravatar image

updated 2020-09-03 07:06:10 -0500

don't include obstacles layer in the costmap_common_params or global_costmap_params insert it only in local_costmap_params

I mean this part or alternative depend on how you configure your obstacles layer

observation_sources: scan scan: {sensor_frame: base_scan, data_type: LaserScan, topic: scan, marking: true, clearing: true}

however it'll effect global path planner behavior. otherwise you can clear using this service

rosservice call /move_base/clear_costmaps "{}"

edit flag offensive delete link more

answered 2015-08-11 16:07:30 -0500

updated 2015-08-11 16:08:43 -0500

If the sensor does not see new objects, it will not clear the object out of the map and retains the previous valid information it received. The costmap will retain the previous data (retain the presence of the previous obstacle) until it gets fresh data from it's sensor indicating that there is no obstacle.

One way to get around this is to create a node that would fill the rest of the laser scan with max range (~20m) so that the maps would be cleared. This is code for the node -

However you must keep in mind that it isn't completely safe - if something blocks the laser or it fails your robot will drive straight into things, which is why it's not the default.

edit flag offensive delete link more

Question Tools



Asked: 2015-08-07 09:35:00 -0500

Seen: 2,507 times

Last updated: Sep 03 '20