Repository navigation
nav: sim_world::min_clearance() — expose the per-tick footprint clearance - #394
Merged
Merged
Conversation
…ance The drive already computes each agent's minimum footprint-to-wall clearance over a step()'s substeps, but sim_world::step() wrote it into a discarded local. Promote it to a member (minclr_) and add a min_clearance(float* out) accessor. Behavior-preserving: the drive_step*/drive_step_material/drive_step_ext calls are unchanged (same buffer, now a member); nothing else reads it, so no existing path changes. Enables clearance / corridor-fit telemetry downstream (cvc::dbg nav_stats) and is the first step in pushing that per-vehicle telemetry down into cvc::nav so the non-DBG grl-snam swarm collects it too. Value is NORMALIZED (world metres = value / cfg.scale); sentinel 1e30 until the first step(). Covered by nav_test's sim_world drive test (asserts most agents get a finite, below-sentinel measured clearance after stepping an occupied map).
This was referenced Sep 22, 2026
transfix
added a commit
that referenced
this pull request
Sep 22, 2026
Gap-analysis cleanup over the just-landed base (#394-#397). Correctness + doc-accuracy + test coverage in one module; no behavior change to the drive. - Sentinel leak (major): min_clearance_m and min_sep_m sit at the 1e30 "unmeasured" sentinel until a sampler / second vehicle lowers them; num() only nulls non-finite, so the base JSON record emitted "min_clearance_m":1e+30 — read by a trainer as *enormous* clearance, the inverse of "missing". Add a num_sentinel() helper that nulls >=1e29 and apply it to both fields in episode_nav_stats::to_json() (aggregate_nav already guarded min_sep_m; the per-episode record now matches). - Unit contract (major, root of the cvcdbg #113 bug): document nav_samplers.min_clearance_m as METRES and that sim_world::min_clearance() is NORMALIZED, so the caller must convert (/cfg.scale) before pointing it here. - Stale comments (minor): drive.h still said the CUDA twin ignores the per-agent columns; #396 wired rr/body_rr/vmax/a_max/L into the batch CUDA entry points. Correct both blocks (only the persistent sim_world_cuda path still scalars; mass stays CPU/downstream-only). - Mirror comment (minor): the header claimed field-parity with grl_snam.metrics.NavStats "pinned in cross-language parity tests" — neither true (veh_nav_stats is a superset; the match is grl_snam.scorecard, and parity is held by independent hand-computed corpora, not a gate). Correct it. - Tests: SentinelFieldsSerializeAsNull (the sentinel->null fix); BudgetEtaAndFuelBounds (the eta_multiple + fuel_budget bounds, previously only time_budget_s was exercised); and ScriptedTrajectoryAccumulators now calls e.to_json() to pin the base record shape + goals_reached. 5/5 pass locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The drive already computes each agent's minimum footprint-to-wall clearance over a
step()'s substeps, butsim_world::step()wrote it into a discarded local. This promotes it to a member (minclr_) and adds amin_clearance(float* out)accessor.Why
Enables clearance / corridor-fit telemetry downstream (a
nav_statslayer), and is the first step in pushing per-vehicle nav telemetry down intocvc::navso othercvc::navconsumers, such as the grl-snam swarm, can collect it too.Behavior-preserving
The
drive_step/drive_step_material/drive_step_extcalls are unchanged (same buffer, now a member instead of a local); nothing else reads it, so no existing path changes. Value is normalized (world metres = value /cfg.scale); sentinel1e30until the firststep().Test
Extends
nav_test'ssim_worlddrive test: after stepping an occupied map, asserts every agent has a finite clearance and most are below the sentinel (i.e. the drive actually measured clearance).Small, additive, and self-contained — designed to compose with concurrent
cvc::navwork rather than conflict.