ros2
navigation
ai_generated
true
Nav2 costmap shows obstacles that have been removed, robot avoids phantom obstacles
ID: ros2/nav2-costmap-not-clearing-obstacle
82%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
Nav2 costmap obstacle layer has separate 'marking' (adding obstacles) and 'clearing' (removing obstacles) behaviors. If the sensor's clearing parameters are misconfigured, obstacles are added but never removed. Raytrace clearing requires correct sensor origin and max range.
genericWorkarounds
-
92% success Configure obstacle layer with correct clearing parameters
obstacle_layer: clearing: true, obstacle_max_range: 5.0, raytrace_max_range: 6.0 # raytrace must be >= obstacle max range
-
90% success Set correct sensor_frame and ensure TF from sensor to robot is published
observation_sources: scan: {sensor_frame: laser_frame, clearing: true, marking: true, data_type: LaserScan} -
82% success Add a voxel layer instead of obstacle layer for 3D clearing
Voxel layer handles 3D raytrace clearing better than 2D obstacle layer for sensors with variable height
Dead Ends
Common approaches that don't work:
-
Assume costmap automatically clears obstacles when sensor no longer sees them
85% fail
Clearing happens via raytrace from sensor origin. If sensor origin frame is wrong, clearing rays miss the old obstacles. If obstacle_max_range < actual sensor range, far obstacles are never cleared.
-
Increase costmap resolution to fix stale obstacles
72% fail
Higher resolution makes the problem worse - more cells to clear. The issue is clearing behavior configuration, not resolution.