Skip to content

nav_stats: belief-coverage + sense-flips base stats (Track 1c) - #423

Merged
transfix merged 1 commit into
masterfrom
feat/nav-stats-coverage
Sep 26, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/nav-stats-coverage

Conversation

@transfix

Copy link
Copy Markdown
Owner

Track 1c of the nav_stats intrinsic-stats build (follows #421, #422). Adds the epistemic counterpart to the motion stats — belief coverage + sense-churn — additive/off-by-default.

What lands

  • nav_coverage {explored_frac, visible_frac, believed_free_frac, phantom_frac} + episode_nav_stats.coverage + nav_scorecard.mean_coverage.
  • compute_coverage(truth, belief, everseen, lastvis, planes, cells) — a pure reducer over the belief rasters (plane-major; truth is one shared plane broadcast per cell): explored = ever seen, visible = in view, believed_free = belief FREE, phantom = believed OCCUPIED where truth is FREE. Null/empty → all zero. Kept out of the collector so the collector stays raster-free (mirrors the min_clearance caller-provides pattern).
  • veh_nav_stats.sense_flips (int64_t) + nav_samplers.sense_flips per-step feed; collector sums the per-agent delta. nav_scorecard.mean_sense_flips.
  • JSON: episode nested "coverage" + per-veh "sense_flips"; scorecard nested "mean_coverage" + "mean_sense_flips".

Portability (Track 2 will mirror this in grl_snam)

Both are bit-identical to the Python twin given matching inputs. The grl-snam survey confirmed all four rasters + the flips[] count exist on the Python side ((M,H,W) shape, real last_visible). The header pins the shared contract so the twin can't desync: the to_occupancy binarization literals (p_thresh 0.5 / band 0.15 / optimistic), the plane-major + broadcast-truth flattening, the int64 width (LP64 == Windows/LLP32), and the divide-by-total mean convention (deliberately distinct from the finite-only min_sep rule).

Parity

5 pinned corpus cases stay byte-identical; new CoverageReducerAndSenseFlips case pins the feature against hand-computed values (explored 5/8, visible 2/8, believed_free 5/8, phantom 2/8; corpus mean_coverage 0.5, mean_sense_flips 5).

Review

4-lens adversarial review (parity / numeric-indexing / serialization / portability): no functional defect — the truth[c] shared-plane indexing, phantom/free logic, denominator, and null guards all verified correct; JSON re-parsed cleanly. It surfaced the long→int64 Windows-width fix and three contract-spec gaps (unpinned binarization literals, implicit plane-major/broadcast obligation, divide-by-total vs finite-only) — all fixed here as type/doc hardening so the Track 2 twin has exact values to implement against.

Test

8/8 nav_stats_test pass (5 pinned + formation + progress + coverage)

Add the epistemic counterpart to the motion stats, additive / off-by-default:

  - nav_coverage {explored_frac, visible_frac, believed_free_frac, phantom_frac}
    + episode_nav_stats.coverage; nav_scorecard.mean_coverage.
  - compute_coverage(truth, belief, everseen, lastvis, planes, cells): a PURE
    reducer over the belief rasters (plane-major; truth is one shared plane
    broadcast per cell). explored=ever seen, visible=in view, believed_free=
    belief FREE, phantom=believed OCCUPIED where truth is FREE. Null/empty ->
    all zero. Kept out of the collector so it stays raster-free.
  - veh_nav_stats.sense_flips (int64) + nav_samplers.sense_flips feed; collector
    sums the per-step per-agent delta. nav_scorecard.mean_sense_flips.
  - JSON: episode nested "coverage" + per-veh "sense_flips"; scorecard nested
    "mean_coverage" + "mean_sense_flips".

Both coverage (over the binary to_occupancy output) and sense_flips (the
sense_batch flips[] count) are bit-identical to the grl-snam twin given matching
inputs. The header pins the shared contract so Track 2 can mirror it exactly:
the to_occupancy binarization literals (p_thresh 0.5 / band 0.15 / optimistic),
the plane-major + broadcast-truth flattening, the int64 width (LP64 == LLP32),
and the divide-by-total mean convention (distinct from the finite-only min_sep
rule). All from an adversarial review; no logic changed.

The 5 pinned corpus cases stay byte-identical; new CoverageReducerAndSenseFlips
case pins the feature (explored 5/8, phantom 2/8; mean_coverage 0.5, mean_sense_
flips 5). 8/8 nav_stats_test pass.
@transfix
transfix merged commit 796db96 into master Sep 26, 2026
13 checks passed
@transfix
transfix deleted the feat/nav-stats-coverage branch September 26, 2026 00:04
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