Repository navigation
sim_world: opt-in internal base nav_stats collector + pycvc binding - #402
Merged
Merged
Conversation
The native path (grl_snam NativeSimWorld, driving cvc::nav::sim_world torch-free off-thread) had no base-stats collection — the C++ world owns the SDF/occupancy and its snapshot has no clearance column, so Python can't collect faithfully. Give sim_world its own internal nav_stats_collector so the native path gets the base episode record the same way the Python Swarm now does. - sim_world::begin_nav_stats(params, budget, scene, seed, ckpt): arm the collector, capturing the CURRENT pose as the episode start (call before the first step) and goals_world() as the goal. step() folds one tick at its tail (after drive + de-overlap + reached), reusing the world snapshot arrays + a truth-occupancy sampler for penetration + min_clearance_world()->double METRES for clearance. nav_stats() finishes -> the episode_nav_stats. Opt-in; default off = byte-unchanged runs. Pure C++ in step(), so it's safe on the sim thread (no Python per-tick pull). No CMake change (nav_stats.cpp already linked). - pycvc_nav.i: nav_sim_world_begin_nav_stats (scalar args) + nav_sim_world_nav_stats (returns episode_nav_stats::to_json() as a str; Python does json.loads). Same PyObject idiom as nav_sim_world_retarget/_set_material; GIL held, no thread-release. - Test NavSimWorld.BaseNavStatsArmedCollectsSaneFields: arm, step 300x over the bordered-room-with-bar, assert sane world-metre fields (clearance measured + bounded, arrival within budget, penetration_pct in [0,100], min_sep finite), unarmed throws, and bit-identical to_json() for an identically-seeded/stepped world. Passes locally. Follow-up PR-B (grl-snam NativeSimWorld.begin_nav_stats/episode_stats -> from_nav_stats) lands once this ships in the nightly pycvc (needs a pycvc recipe cvc_revision bump + publish). Deferrals: material_id sampler (no per-point palette on sim_world), set_identity (convoy/class/mass), exact Swarm<->native bit parity (no collectible gate; safe while parked agents brake to zero).
This was referenced Sep 22, 2026
transfix
added a commit
that referenced
this pull request
Sep 22, 2026
#402 added the sim_world internal base nav_stats collector + its pycvc bindings (nav_sim_world_begin_nav_stats / nav_sim_world_nav_stats) to bindings/pycvc/pycvc_nav.i. Bump the core pycvc column recipes so the resolver republishes/picks up the rebuilt pycvc (3.4.0+cvc.2) that carries the new symbols — unblocking grl-snam PR #86 (NativeSimWorld base-stats collection), which gates on HAS_SIM_WORLD_NAVSTATS. Core columns only (pycvc-cp311/312/313 + pycvc-cp311-cuda); the pycvc-gl columns wrap cvcGL (CVC_BUILD_PYCVC_GL) and don't include pycvc_nav.i, so they're unchanged.
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Sep 22, 2026
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.
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 native path (grl-snam
NativeSimWorld, drivingcvc::nav::sim_worldtorch-free, off-thread) had no base-stats collection — the C++ world owns the SDF/occupancy and its snapshot has no clearance column, so Python can't collect faithfully. This givessim_worldits own internalnav_stats_collector, so the native path gets the base episode record the same way the PythonSwarmnow does (grl-snam #84) — collecting in C++ on the sim thread rather than pulling snapshot+clearance over the pybind boundary every tick.What
sim_world::begin_nav_stats(params, budget, scene, seed, ckpt)— arms the collector, capturing the current pose as the episode start (call before the firststep()) andgoals_world()as the goal.step()folds one tick at its tail (after drive + hard-de-overlap +reached), reusing the world snapshot arrays + a truth-occupancy sampler for penetration +min_clearance_world()→ double metres for clearance.nav_stats()finishes → theepisode_nav_stats. Opt-in; default off = byte-unchanged runs. Pure C++ instep(), so it's safe on the sim thread. No CMake change (nav_stats.cppalready linked).pycvc_nav.i—nav_sim_world_begin_nav_stats(scalar args) +nav_sim_world_nav_stats(returnsepisode_nav_stats::to_json()as astr; Python doesjson.loads). SamePyObjectidiom asnav_sim_world_retarget/_set_material.Test (passes locally)
NavSimWorld.BaseNavStatsArmedCollectsSaneFields— arm, step 300× over the bordered-room-with-bar, assert sane world-metre fields (clearance measured + bounded, arrival within budget,penetration_pctin [0,100],min_sepfinite), unarmednav_stats()throws, and bit-identicalto_json()for an identically-seeded/stepped world. The exact normalized→metres clearance conversion is separately pinned by the existingmin_clearance_worldassertion.Follow-ups
NativeSimWorld.begin_nav_stats()/episode_stats()→EpisodeStatsviafrom_nav_stats— lands once this ships in the nightly pycvc (needs a pycvc recipecvc_revisionbump + publish).material_idsampler (no per-point palette onsim_world),set_identity(convoy/class/mass), and exactSwarm↔native bit parity (the collector has noactive & ~parkedgate — safe while parked agents brake to zero).