Skip to content

nav_stats: progress-to-goal base stats (Track 1b) — stall_steps + closest_approach_m - #422

Merged
transfix merged 1 commit into
masterfrom
feat/nav-stats-stall-approach
Sep 25, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/nav-stats-stall-approach

Conversation

@transfix

Copy link
Copy Markdown
Owner

Track 1b of the nav_stats intrinsic-stats build (follows #421). Adds an always-on progress-to-goal measure to the RF-free cvc::nav base, computed collector-side from the snapshots + goal the collector already holds.

What lands

  • veh_nav_stats.closest_approach_m — nearest the vehicle got to its objective. Seeded to straight_m at begin_episode (finite from t=0 for any collected episode; the 1e30 default is only for a hand-built record → serialized null, aggregated out), then min of per-step distance-to-goal.
  • veh_nav_stats.stall_steps — steps that fail to beat the closest-so-far by more than nav_stats_params.stall_progress_eps_m (default 0.05 m, strict <).
  • nav_scorecard.{mean_closest_approach_m (finite runs only), mean_stall_steps} + aggregate_nav.
  • JSON emit: episode per-vehicle (closest_approach_m via num_sentinel), scorecard means.

Why collector-side, not sim_world getters

The roadmap originally said "fill from sim_world getters." On inspection that's wrong: sim_world::stall_ is a reset-happy streak counter (zeroed on escapes/mode-transitions) and best_/init_ are in normalized units — and neither exists in grl-snam. Reading them would break the C++⟷Python fixture-parity invariant. The collector definition is portable, so the grl_snam.metrics twin reproduces it bit-for-bit (0.05 m is a shared cross-repo constant). The Track 1b roadmap bullet is corrected in this PR.

Parity

The 5 pinned corpus cases stay byte-identical (new fields only; no existing accumulator touched; no raw 1e+30 emitted). New ProgressStallAndClosestApproach case pins the feature against hand-computed values: dg = 7,7,3,3,0 → 2 stalls, closest 0; corpus mean stall 4, mean closest 2.

Review

Ran a 4-lens adversarial review (parity / numeric-edge / serialization / portability). No functional defect — parity and no-sentinel-leak both hold, arithmetic is correct. It surfaced contract/doc ambiguities that would bite the Python twin (a stale header comment about the sentinel, the exact-eps boundary wording, eps as an undocumented shared constant); all fixed here so the twin cannot pick the wrong side.

Test

7/7 nav_stats_test pass (5 pinned + formation (1a) + progress (1b))

…sest_approach_m

Add an always-on progress measure to the RF-free cvc::nav base, computed
collector-side from the snapshots + goal the collector already holds:

  - veh_nav_stats.closest_approach_m: nearest the vehicle got to its objective.
    Seeded to straight_m at begin_episode (finite from t=0 for any collected
    episode; 1e30 default only for a hand-built record -> null on emit), then
    min of per-step distance-to-goal.
  - veh_nav_stats.stall_steps: steps that fail to beat the closest-so-far by
    more than nav_stats_params.stall_progress_eps_m (default 0.05 m, strict).
  - nav_scorecard.{mean_closest_approach_m (finite runs only), mean_stall_steps}
    + aggregate_nav.
  - JSON emit: episode per-vehicle (closest via num_sentinel), scorecard means.

Deliberately NOT read from sim_world::stall_/best_/init_: sim_world's stall_ is
a reset-happy streak counter and best_/init_ are in normalized units, and
neither exists in grl-snam -- reading them would break the C++<->Python
fixture-parity invariant. The collector definition is portable, so the grl_snam
Python twin reproduces it bit-for-bit from the same trajectory (0.05 m is a
shared cross-repo constant). Roadmap Track 1b bullet corrected accordingly.

Additive/off-nothing: the 5 pinned corpus cases stay byte-identical; new
ProgressStallAndClosestApproach case pins the feature (dg 7,7,3,3,0 -> 2 stalls,
closest 0; corpus mean stall 4, mean closest 2). 7/7 nav_stats_test pass.

Contract wording (header comment + eps boundary + scorecard 0-fallback) tightened
per an adversarial review so the Python twin cannot pick the wrong side.
@transfix
transfix merged commit 0e0d2cf into master Sep 25, 2026
13 checks passed
@transfix
transfix deleted the feat/nav-stats-stall-approach branch September 25, 2026 23:23
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