Skip to content

nav_native: collect base NavStats on the native sim_world path - #86

Merged
transfix merged 1 commit into
mainfrom
feat/native-base-navstats
Sep 22, 2026
Merged

transfix merged 1 commit into
mainfrom
feat/native-base-navstats

Conversation

@transfix

Copy link
Copy Markdown
Contributor

The native path (NativeSimWorld, driving the torch-free C++ cvc::nav::sim_world) gains base-stats collection via the world's internal nav_stats collector (libcvc #402) — the 3rd grl-snam base-stats source after the pure-Python SdfNavigator and the vectorized Swarm, so all three collect the same base row.

What

  • NativeSimWorld.begin_nav_stats(...) — arm the C++ collector (captures the current pose as the episode start; call before the first step()). nav_stats() — json.loads the episode record. episode_stats() — map it into a scorecard EpisodeStats via from_nav_stats, mirroring Swarm.episode_stats. The C++ record already carries min_sep_m, per-vehicle veh_contacts and time_to_goal_s, so they come across for free.
  • HAS_SIM_WORLD_NAVSTATS feature flag (hasattr nav_sim_world_begin_nav_stats) keeps the module import-safe on a pycvc built before the bindings shipped; the gated test in tests/test_sim_world_parity.py skips until then.

Validation

Module imports cleanly and the flag/methods resolve; the test skips gracefully on a pycvc without the bindings (verified locally). It runs in CI once #402 is published in the nightly pycvc (pycvc recipe cvc_revision bump — in flight).

Depends on transfix/libcvc#402. Deferred: material_time_share (no per-point palette on sim_world), set_identity, exact Swarm↔native bit parity.

The native path (NativeSimWorld, driving the torch-free C++ cvc::nav::sim_world) gains
base-stats collection via the world's INTERNAL nav_stats collector (libcvc #402) — the
3rd grl-snam base-stats source after the pure-Python SdfNavigator and the vectorized
Swarm, so all three collect the same base row.

- NativeSimWorld.begin_nav_stats(...): arm the C++ collector (captures the current pose as
  the episode start; call before the first step). nav_stats(): json.loads the episode
  record. episode_stats(): map it into a scorecard EpisodeStats via from_nav_stats,
  mirroring Swarm.episode_stats — the C++ record already carries min_sep_m, per-vehicle
  veh_contacts and time_to_goal_s, so they come across for free.
- HAS_SIM_WORLD_NAVSTATS feature flag (hasattr nav_sim_world_begin_nav_stats) keeps the
  module import-safe on a pycvc built before the bindings shipped; the gated test in
  tests/test_sim_world_parity.py skips until then.

Depends on transfix/libcvc#402 (the sim_world internal collector + pycvc bindings). Runs
in CI once #402 is published in the nightly pycvc (pycvc recipe cvc_revision bump).
Deferred: material_time_share (no per-point palette on sim_world), set_identity, exact
Swarm<->native bit parity.
@transfix
transfix merged commit a7d827a into main Sep 22, 2026
3 checks passed
@transfix
transfix deleted the feat/native-base-navstats branch September 22, 2026 21:52
transfix added a commit that referenced this pull request Sep 22, 2026
…umer (#87)

The base nav_stats collectors (Swarm #84, native #86) and the scorecard (#82) had no
production consumer — the corpus aggregation was demonstrated only in tests. Add a
scorecard eval CLI that runs a CoefMLP checkpoint over a scene corpus with the Swarm's
base collector and aggregates one NavScorecard: the RF-free fitness row grl-snam uses to
rank its own base-policy checkpoints (design §7, PR5 training bridge).

- grl_snam/tools/scorecard_eval.py: load_model (a grl-snam train .pt or the bias net) +
  scene_specs (city corpus) + evaluate(scenes/agents/steps/grid/contact_r) ->
  Swarm(collect_stats=True) per scene -> episode_stats() -> aggregate_nav -> NavScorecard.
  Prints a compact row + the full JSON (the record a campaign ranks on), optional --json.
  Convention matches the other `python -m grl_snam.tools.X` tools (coef_eval/coef_train).
- tests/test_scorecard_eval.py: a tiny corpus reduces to a well-formed, in-range card;
  seeds give distinct corpora; the default (no checkpoint) is the bias net. 3 pass, and
  the CLI runs end-to-end locally (torch 2.12 via the cvcpkg .venv).

The scorecard field-mirrors the C++ nav_scorecard + the native collector, so a checkpoint
scores identically whichever path evaluates it. Follow-up (optional): register as a
`grl-snam scorecard-eval` Click subcommand; a --native flag to score via NativeSimWorld.
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