Skip to content

NavMap ObstacleFilter: optional obstacle memory - #126

Merged
fmrico merged 1 commit into
rollingfrom
navmap_obstacle_memory
Oct 16, 2026
Merged

fmrico merged 1 commit into
rollingfrom
navmap_obstacle_memory

Conversation

@fmrico

@fmrico fmrico commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Closes #125

With memory.enabled (off by default, so existing configurations behave as before), ObstacleFilter remembers what it has seen:

  • Evidence in log-odds. Each NavCel accumulates evidence in obstacles_logodds, an int16 layer clamped as in OctoMap. A point above the surface is a hit. A cell is a miss when a ray from the robot to a point crosses it along the surface, or when a ground point lies on it.
  • Decay. With memory.decay_time, cells that are no longer observed fade back to unknown.
  • What the sensors know. obstacles_sensor holds obstacle, free or unknown for each cell.
  • Composition. obstacles is the static map with the sensor layer on top (navmap::combine_layer, max). The sensors can mark cells that the static map does not know about, but they never erase a static obstacle. NO_INFORMATION is the declared unknown value of these layers.
  • Layer identity. Both filters now detect a replaced layer through a weak_ptr instead of its address, so a cleared change record no longer causes a rebuild.

Cost per cycle, with a robot moving through home2 at 5 cm and a 720-beam laser: ObstacleFilter takes 1.07 ms with memory and 0.24 ms without.

Eight new tests cover:

  • memory off by default;
  • an obstacle out of sight is remembered;
  • rays clear it within 2–3 cycles, and later cycles with the same evidence record no change;
  • the sensors fill in unknown static cells and never erase a static obstacle;
  • decay;
  • clearing disabled;
  • a new map resets the memory;
  • invalid probabilities fall back to the defaults.

The simulation battery gives the same results in summit_warehouse_amcl, summit_bonxai_amcl and tiago_navmap_bonxai_amcl, both with and without memory (all reach the goal).

With memory.enabled (off by default), the evidence is accumulated per
NavCel in log-odds (obstacles_logodds, OctoMap clamping): points above
the surface are hits; the cells a ray from the robot crosses along the
surface, and those where a ground point lies, are misses; unobserved
cells can decay back to unknown (memory.decay_time). obstacles_sensor
holds what the sensors know, and the obstacles layer is the static map
with the sensors on top (navmap::combine_layer, max): they fill in
unknown static cells and never erase a static obstacle. NO_INFORMATION
is the declared unknown value of these layers.

The filters tell a replaced layer by weak_ptr, not by its address.

Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
@fmrico
fmrico merged commit 3cefb34 into rolling Oct 16, 2026
1 check passed
@fmrico
fmrico deleted the navmap_obstacle_memory branch October 16, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NavMap ObstacleFilter forgets obstacles as soon as they are out of sight

1 participant