Skip to content

nav: base navigation-statistics layer (cvc::nav::nav_stats) - #397

Merged
transfix merged 1 commit into
masterfrom
feat/nav-stats-base-in-nav
Sep 22, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/nav-stats-base-in-nav

Conversation

@transfix

@transfix transfix commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Adds the domain-neutral base half of the two-layer nav-stats design to cvc::nav, so the grl-snam swarm, any cvc::nav-only demo, and downstream apps all collect the same base row — instead of it living only in an application-specific layer, which strands every other consumer.

What

  • inc/cvc/nav/nav_stats.h + src/cvc/nav/nav_stats.cpp: veh_nav_stats / episode_nav_stats / nav_stats_collector (begin_episode → step → finish over the sim_world::snapshot arrays) + budget_policy / nav_samplers, and the corpus nav_scorecard + aggregate_nav. Motion, clearance, collisions/penetration, material dwell, time, fuel, budgets. Domain-neutral and stdlib-only (no libcvc-internal dependency); field names mirror grl_snam.metrics NavStats.
  • nav_stats_test: the same hand-computed scripted trajectory + corpus as GRL-SNAM/tests/test_scorecard.py and the downstream extension layer's own test, so all three test suites pin the same base numbers (the shared-schema contract). Passes locally.

Layering

Application-specific extensions on nav_stats stay downstream, joined by veh_index. Additive here (no existing code changes); a follow-up downstream PR re-points the extension layer's base to these types once this is in the nightly and drops that layer's duplicate, and grl-snam gains a pycvc binding to collect them.

Add the RF-free BASE half of the two-layer nav-stats design (CVC-DBG/cvcdbg
docs/nav-stats-design.md) to cvc::nav, so the non-DBG grl-snam swarm, any cvc::nav-only
demo, and the cvcdbg convoy demos all collect the SAME base row instead of it living only
in cvc::dbg (which strands grl-snam-non-DBG).

- inc/cvc/nav/nav_stats.h + src/cvc/nav/nav_stats.cpp: veh_nav_stats / episode_nav_stats /
  nav_stats_collector (begin_episode -> step -> finish over the sim_world::snapshot arrays)
  + budget_policy / nav_samplers, and the corpus nav_scorecard + aggregate_nav. Motion,
  clearance, collisions/penetration, material dwell, time, fuel, budgets. RF-free and
  stdlib-only (no libcvc-internal dep); field names mirror grl_snam.metrics NavStats.
- Test nav_stats_test: the same hand-computed scripted trajectory + corpus as
  cvcdbg/tests/nav_stats_test.cpp and GRL-SNAM/tests/test_scorecard.py, so all three repos
  pin the same base numbers (the shared-schema contract).

The RF/comms-force extension (exposure, PDR/SINR, band/retunes) stays in cvc::dbg, joined by
veh_index. A follow-up cvcdbg PR re-points its base to these types (once this is in the
nightly) and drops its duplicate; grl-snam gains a pycvc binding to collect them.
@transfix
transfix merged commit e58a830 into master Sep 22, 2026
13 checks passed
@transfix
transfix deleted the feat/nav-stats-base-in-nav branch September 22, 2026 09:10
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.
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