Skip to content

nav: sim_world belief (observed) material (B2) - #744

Merged
transfix merged 4 commits into
masterfrom
feat/nav-belief-material-sim
Oct 20, 2026
Merged

transfix merged 4 commits into
masterfrom
feat/nav-belief-material-sim

Conversation

@transfix

@transfix transfix commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

This is B2 of docs/roadmap/NAV-BELIEF-MATERIAL-ROADMAP.md: sim_world builds its material planes from what each belief plane has seen, using B1's kernels.

On top of B1, #742, merged as 8b5c0ca. master is merged in (b4b9bb0), so the diff is B2's change alone. It follows §9's recommended column. It is additive and off by default.

sim_world::set_material_belief(risk_raw, hard, mc, bp, material_every = 1)

The truth is one world plane, because material is world state. One material plane and one gate plane are kept per belief plane, and agents index them by map_id.

Each plane's inputs

  • Seen mask: the sense ray-cast's field of view, taken from sense_batch's material mask. At the default range this is ever_seen(m). A shorter material_range_m keeps only the cells within it, and seen_rule::disc uses the range disc instead.
  • Planes: material_build on belief_material_inputs.
  • Gate surface: belief_gate_surface over the plane's own planning raster (belief_occ(m)), not truth. With the default unknown_gate_hard, a ray through unseen ground never certifies a detour.

When planes are rebuilt

  • A plane's planes are re-derived on a sense tick on which its mask grew.
  • Its gate surface is re-derived on such a tick, and also when its occupancy changed.
  • Either happens at most once every material_every sense ticks, and planes are rebuilt in parallel.
  • The drive and the gate are unchanged.

Interaction with the existing calls

  • It replaces set_material and is replaced by it. clear_material() turns both off.
  • It throws under freeze_sense (nothing is ever seen), for invalid params, for a material range above the sense range, and for material_every < 1.

Read surface

  • material_seen(m), material_plane_data(m), material_gate_hard(m), material_clear_m(m) and material_version(m).
  • raster_version(m) also bumps when a material mask grows.

Memory: about 36 bytes per cell per belief plane, as the header notes.

pycvc (new symbols)

  • nav_sim_world_set_material_belief: every precondition that throws is checked before the GIL is released.
  • nav_sim_world_material_seen

Tests

SimWorldBelief adds 8 cases to nav_belief_material_test:

  • With every cell seen, set_material_belief gives set_material's planes, gate surface and clearance, byte for byte.
  • An unseen hazard has no barrier.
  • The throws.
  • Private planes see only their own agents.
  • Re-derivation happens exactly when a mask grows, at material_every 1 and 3.
  • The shorter range and the disc behave as specified; the disc sees behind a wall that the ray-cast cannot see past.
  • set_material and clear_material replace it.
  • Runs are deterministic.

test_pycvc_nav_belief also drives a sim_world through the bindings.

These existing suites pass unchanged (counts are passing tests):

suite tests
nav_test 61
nav_material_test 29
nav_coef_train_test 14
nav_stats_test 11
nav_terrain_test 6
nav_route_follower_test 4
nav_binding_test 4

belief_material.h holds the pieces that build material planes from what a belief
plane has seen (docs/roadmap/NAV-BELIEF-MATERIAL-ROADMAP.md, B1):
- belief_material_params: the pinned unseen values (risk 0, hard 0), whether an
  unseen cell blocks the witness gate (yes), the seen rule and the material range;
- belief_material_inputs: the truth rasters where seen, the pins elsewhere;
- belief_gate_surface: hard_b | occ | unseen and its metres clearance, the chain
  set_material uses;
- seen_disc: the optional range-disc rule, in numpy linspace arithmetic.
material_build and witness_gate run unchanged on their output. sense_batch keeps an
optional material-range mask (belief_planes::material_seen / material_changed,
sense_agents::material_range_m); left null, every output is byte-identical.

pycvc: nav_belief_material_inputs, nav_belief_gate_surface, nav_seen_disc and
nav_sense_batch_material, all new symbols. nav_sense_batch now shares its
implementation and is unchanged.

Tests: nav_belief_material_test (11 cases). NavBeliefMaterial.Golden writes
src/cvc/tests/data/belief_material_golden.json: four cases (the defaults, a 7 m
material range, the disc, pessimistic pins with unseen cells open to the gate),
three sense ticks, two planes, the SHA-256 of every raster and the gate's outputs.
GRL-SNAM's numpy references (BeliefGrid.sense, MaterialGrid, MaterialRuntime,
witness_gate_batch) reproduce all 432 values bit for bit. test_pycvc_nav_belief
reproduces the golden through pycvc.
sim_world::set_material_belief(risk_raw, hard, mc, bp, material_every) builds the
material planes from what each belief plane has seen
(docs/roadmap/NAV-BELIEF-MATERIAL-ROADMAP.md, B2). The truth is one world plane; one
material + gate plane is kept per belief plane:
- its seen mask is the sense ray-cast's field of view (sense_batch's material mask;
  ever_seen at the default range), or the range disc;
- its planes are material_build of belief_material_inputs;
- its gate surface is belief_gate_surface over the plane's own planning raster
  (belief_occ(m)), not truth.
A plane's planes are re-derived on a sense tick on which its mask grew, its gate surface
also when its occupancy changed, at most once every material_every sense ticks, in
parallel across planes. The drive and the gate are unchanged. It replaces set_material
and is replaced by it; clear_material turns both off. It throws under freeze_sense, for
invalid params, for a material range above the sense range, or for material_every < 1.
Read surface: material_seen, material_plane_data, material_gate_hard, material_clear_m
and material_version; raster_version also bumps when a material mask grows.

pycvc: nav_sim_world_set_material_belief and nav_sim_world_material_seen, new symbols;
every throwing precondition is checked before the GIL is released.

Tests: SimWorldBelief, 8 cases in nav_belief_material_test. With every cell seen it
gives set_material's planes, gate surface and clearance byte for byte; an unseen hazard
has no barrier; the throws; private planes see only their own agents; re-derivation
exactly when a mask grows, at material_every 1 and 3; the shorter range and the disc;
set_material and clear_material replace it; runs are deterministic.
test_pycvc_nav_belief drives a sim_world through the bindings. The existing nav,
material, terrain, stats, route-follower and binding suites pass unchanged.
@transfix
transfix changed the base branch from feat/nav-belief-material-kernels to master October 20, 2026 16:01
…erial-sim

# Conflicts:
#	bindings/pycvc/test_pycvc_nav_belief.py
#	docs/NAV_MATERIAL.md
#	docs/roadmap/NAV-BELIEF-MATERIAL-ROADMAP.md
#	src/cvc/tests/nav_belief_material_test.cpp
…as a macro

MSVC sees `far` (minwindef.h) as an empty macro, so the declaration read as
`..., = phi[...]` and the Windows lanes failed with a syntax error.
@transfix
transfix merged commit 0c1384d into master Oct 20, 2026
23 of 24 checks passed
transfix added a commit that referenced this pull request Oct 21, 2026
…emented (#755)

The status line of docs/roadmap/NAV-BELIEF-MATERIAL-ROADMAP.md still said B3 follows. B1 (#742), B2 (#744) and B3 (#746) have all merged, built with section 9's recommended column.
@transfix
transfix deleted the feat/nav-belief-material-sim branch October 29, 2026 20:52
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.

1 participant