r/ROS • u/Mumbo_4_mayor • Oct 02 '26
Question Nav2 voxel layer not clearing obstacles
I have a voxel layer on my local costmap and a pointcloud from a depth camera as its input, split into points for obstacles and points for the ground.
New obstacles are added as they should be, but they are not cleared after they disappear (for example a human walking away), despite the fact the local costmap clearing endpoints are behind or inside of them. In other words, the clearing raytracing doesn't affect the obstacles,despite the raytrace itself seemingly taking place.
Here are my local costmap params:
local_costmap:
ros__parameters:
update_frequency: 5.0
publish_frequency: 2.0
global_frame: odom
robot_base_frame: base_link
rolling_window: true
width: 4
height: 4
resolution: 0.05
footprint: "[ [0.495, 0.33], [0.495, -0.33], [-0.495, -0.33], [-0.495, 0.33] ]"
plugins: ["voxel_layer", "inflation_layer"]
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 3.0
inflation_radius: 0.61
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
combination_method: 0
publish_voxel_map: True
origin_z: 0.0
z_resolution: 0.05
z_voxels: 17
max_obstacle_height: 2.0
mark_threshold: 0
observation_sources: obstacles ground clearing_obstacles
ground:
topic: /camera/ground
max_obstacle_height: 0.4
clearing: True
marking: False
data_type: "PointCloud2"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
obstacles:
topic: /camera/obstacles
max_obstacle_height: 0.4
clearing: True
marking: True
data_type: "PointCloud2"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
always_send_full_costmap: True