Ask Your Question

local costmap remember past obstacles

asked 2019-10-14 16:39:40 -0600

logan.ydid gravatar image

updated 2019-10-16 00:14:47 -0600

A bit of background about my setup: I have a robot with a lidar sensor at about 4 feet off the ground and a kinect sensor at about 1.5 feet off the ground. the two sensors are directly above each other with the kinect pointing forward. this was done in a attempt to give the robot a full 360 degree view of the room while also giving it a view of lower objects like table legs. i am using depthimage_to_laserscan to get a laser scan out of the kinect. then im using laser_merge to combine the scan from the lidar and the scan from the kinect into a single laser scan. what results is a lasercan of the room that shows data from whatever sensor sees a closer object.

The Problem: Because the kinect has a small field of view, a couple degrees of rotation from the robot is enough for an object to go out of view. this results in the robot adding objects to the local costmap as it approaches but then clearing them as it rotates to go around. often it will then cut the corner really hard because it thinks there's nothing there and it hits the object. at this point it is often too close for the kinect to detect anything. Is there a way to have some sort of buffer where the local costmap remembers for a short period that something was there even when it leaves its view? and if not do you all have any suggestions of how i can prevent my robot from hitting things?


EDIT: Here are my config files

common params

footprint: [[0.5, 0.35], [0.5, -0.35], [-0.5, -0.35], [-0.5, 0.35]]
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: camera_link, data_type: LaserScan, topic: scan, marking: true, clearing: true}

local params

  global_frame: /odom
  robot_base_frame: base_link
  rolling_window: true

global params

  global_frame: /map
  robot_base_frame: base_link
  static_map: true
  transform tolerance: 0.5

base local planner params

  holonomic_robot: false
  max_vel_x: 0.25
  max_vel_theta: 0.25
  min_in_place_vel_theta: 0.25

New common params after raytrace_range was added

footprint: [[0.75,0.35],[0.75,-0.35],[-0.5,-0.35],[-0.5,0.35]]
raytrace_range: 1.5

observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: camera_link, data_type: LaserScan, topic: scan, marking: true, clearing: true}
edit retag flag offensive close merge delete


Do these obstacles also get cleared from the global costmap?

Jari gravatar image Jari  ( 2019-10-14 19:51:23 -0600 )edit

Yes, because the laser (which can see over many tables and chairs) cant see the obstacles it gets cleared from the local and global costmap. If i cover the lidar and just use the kinect obstacles stay in the global costmap because there isnt scan data saying that its clear.

logan.ydid gravatar image logan.ydid  ( 2019-10-14 21:50:16 -0600 )edit

Did you try tinkering with the raytrace_range for the observation_sources in your obstacle_layer? Also please you edit your question and post your costmap config files?

pavel92 gravatar image pavel92  ( 2019-10-15 02:49:33 -0600 )edit

I have played a bit with raytrace_range and obstacle_range. I tried setting raytrace_range to a lower value so that it will only clear the map of obstacles that would hopefully already be in range of the kinect. The issue still arrises though where it turns to go arround the object and clears it when it goes out of range. it works better but still not great.

logan.ydid gravatar image logan.ydid  ( 2019-10-16 00:12:22 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-20 18:15:58 -0600

fergs gravatar image

You probably don't want to merge the lasers external to navigation. I would suggest using the VoxelCostmapPlugin which does computation in 2.5d instead of 2d, and then having two laser scan observations. Be sure to set the min_obstacle_height and max_obstacle_height of each laser scan observation and make them a smallish (non-overlapping) range that is at your 1.5 and 4ft heights (the defaults are 0 and 2m, so your laser clears at all heights). This way the laser won't clear out what the Kinect saw.

edit flag offensive delete link more


I think I might need a bit more guidance i tried including the VoxelCostmapPlugin - {name: voxel_layer, type: "costmap_2d::VoxelLayer"} but i was unable to see it in rviz and i didnt notice a difference in navigation i also tried using spatio_temporal_voxel_layer but i was unable to get that to work either.

logan.ydid gravatar image logan.ydid  ( 2019-10-21 23:17:38 -0600 )edit

Thank you! i ended up getting the spatio_temporal_voxel_layer to work but im gettin a TF Exception error now as a result. I ended up posting another question here to try to get to the bottom of it.

logan.ydid gravatar image logan.ydid  ( 2019-10-23 22:13:24 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-10-14 16:39:40 -0600

Seen: 280 times

Last updated: Oct 20 '19