Skip to content

cvc::nav's nav lab: arms, Stats/Ledger, run log and replay, the checkpoint scrubber, and a Pages demo - #1258

Merged
transfix merged 6 commits into
masterfrom
feat/nav-lab
Nov 16, 2026
Merged

transfix merged 6 commits into
masterfrom
feat/nav-lab

Conversation

@transfix

@transfix transfix commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Now carries the whole stack: #1259 (the checkpoint scrubber, cvc nav scrub, pycvc_gl.nav_lab scrub, component nav_lab_scrub.ari) and #1260 (examples/ariadne/nav_scrub in the Pages gallery) were squash-merged into this branch with green CI. master was merged in afterwards (conflicts in src/cvc-cli/main.cpp, bindings/pycvc/pycvc.i and bindings/pycvc/CMakeLists.txt with cvc mujoco / cvc ph / pycvc_ph, where both sides were kept). See those PRs for the scrubber's and the demo's details and screenshots.

GRL-SNAM's policy-comparison tools, in cvc::nav, so libcvc's own navigator and its own trainer's checkpoints have them too. It started as the first of three stacked PRs (arms with the Stats and Ledger, the run log and its replay); the other two are merged into it now.

The behaviour is ported from CVC-Lab/GRL-SNAM#175 and #176, with libcvc's own names. The logic is C++ (cvc::nav) with pycvc bindings. Python builds the worlds and draws the ghosts. docs/NAV_LAB.md has the model.

cvc::nav (C++)

  • cvc/nav/nav_arms.h: arms_run takes one sim_world per arm, with the same agents, tick, frame and centre. It steps them in lockstep, each arm first in turn, and times each step.
    • retarget() moves every arm's goals on the same tick and re-arms nav_stats as a new leg.
    • With N agents per arm, a Stats row covers the arm's agents (one agent: the vehicle's numbers), and the Ledger shows a chosen agent.
    • Also here: books_of(), the books against U_nav (dU, drive, projection, context, dKE, residual), and the drive telemetry fields by name.
  • cvc/nav/run_log.h: cvc.nav.run_log/v1, JSON lines.
    • The header holds the arms (policy key, file, sha256), the starts, the world keys, the settings and the column names. Then come the legs, the ticks and an end record.
    • Each tick holds, per arm and agent: the pose, size, telemetry, books and plant ledger (NaN/null where an item does not apply). Per arm it holds the wall time and the Stats row.
    • Numbers are written in their shortest round-trip form, so a log reads back exactly. A log cut short reads to its last whole tick.
    • The writer streams as the run goes. stack() puts arms of several logs side by side.
    • An input trace records inputs; the run log records outcomes.
  • cvc/nav/nav_panels.h:
    • The Stats and Ledger tables and charts at tick k, written into a state tree in the layout Host.set_table / set_plot use. A live run is shown at its last tick and a replay at its play head, so they show the same cells.
    • The play head, driven by sim_transport's keys.
    • replay_view.
  • src/cvc/ariadne/components/nav_lab_stats.ari and nav_lab_ledger.ari: the shipped components (a file per unit, named after it, as AriadneComponents.ShippedComponentsLoadClean requires).
  • cvc nav log FILE: a run log's arms, legs and Stats rows.

pycvc / pycvc_gl

  • pycvc_nav_lab.i binds:
    • nav_arms_* and nav_run_log_*: read, write, arrays as (T, A, N), tables, charts, publish, stack, poses;
    • nav_replay_view_*;
    • nav_plant_ledger_vehicle() / _episode(): key, unit, comment, kind, source, needs;
    • nav_sim_world_plant_ledger(): each item's applies and value.
  • pycvc_gl.nav_lab:
    • arms runs default and NAME=PATH.cvcnav arms on any plant plant_host names, with ghosts, Retarget, --retarget-at and --log.
    • replay LOG rebuilds the recorded world.
    • Documents: nav_lab_arms.ari, nav_lab_replay.ari.
    • Cars.stepped().

Measured (gtest nav_arms_test, test_pycvc_nav_lab.py, test_pycvc_gl_nav_lab.py)

  • The books' residual stays under 1e-5 on every tick of a 3-arm, 3-agent, 200-tick kinematic run, and across retargets. A retarget books as context.
  • An arm runs bit for bit as its policy alone (C++, and as pycvc_gl's Cars navigator).
  • A run log reads back value for value, from memory and streamed. The tables at a tick are identical live and read back.
  • On the kinematic plant all 20 plant-ledger items are n/a.

pycvc_gl.nav_lab arms on Austin, kinematic, default beside libcvc's trained policy (--set nav.vehicle.vmax=8 --set nav.vehicle.d_hat=12 --retarget-at 20):

arms

pycvc_gl.nav_lab replay of that log, at 12 s (paused):

replay

On the Jolt Humvee (--plant humvee), the Ledger's plant note reads "20 of 20 items apply".

CI does not build pycvc, so the Python tests ran locally only: ctest -R "pycvc_nav_lab|pycvc_gl_nav_lab" (129 and 29 checks), nav_arms_test (20 tests) and cvc_cli_test --gtest_filter='*NavLog*'.

…og and its replay

Several navigation policies run side by side in cvc::nav, one sim_world each, on the same world
from the same starts to the same goals, stepped in lockstep (arms_run). A retarget moves every
arm's goals on the same tick and starts a leg. Each tick records, per arm and agent, the pose,
size, drive telemetry, the books against U_nav (dU, drive, projection, context, dKE, residual)
and the plant ledger, and per arm the wall time and the Stats row, into cvc::nav's run log
(cvc.nav.run_log/v1, JSON lines, read back value for value).

The Stats and Ledger windows are a shipped component (nav_lab_panels.ari), written from a run log
at a tick by nav_panels (the live run at its last tick, a replay at its play head, so the cells
are the same). pycvc binds the arms, the run log, the replay view and the plant ledger's items;
pycvc_gl.nav_lab runs arms live and replays a run log; cvc nav log prints one. The behaviour is
GRL-SNAM's live --arms and replay (CVC-Lab/GRL-SNAM#175, #176). docs/NAV_LAB.md.
…quoted under libc++

(cherry picked from commit 74856dffb86aa26653eef739f6077dd60352bc31)
transfix added a commit that referenced this pull request Nov 15, 2026
- #1241: the schema's menu_collapse was an enum, so a bad value warned twice (the schema, then
  the loader, which falls back to auto) and MenuCollapseSetting counted 2. The enum also refused
  the yes/no/on/off the loader takes. The schema now checks only the type (boolean or string);
  the loader's warning, which names the fallback, is the one.
- #1258: master's ShippedComponentsLoadClean includes each component file's unit named after it.
  nav_lab_panels.ari had only nav_lab_stats and nav_lab_ledger. It gains nav_lab_panels, a group
  of both windows; the two includes still work as they did.
- #1257: cvcgl_ari_golden found orthoslicer.ari in the golden set with no orthoslicer.png. This is
  the frame the test rendered (Linux, NVIDIA), checked by eye.
- The chart is in libcvc 4.0, not 3.7.14: data_feed.ari, nav_lab_*.ari and NAV_LAB.md.
…e streamed run log

The shipped-component check (AriadneComponents.ShippedComponentsLoadClean) wants each file in
src/cvc/ariadne/components to hold a unit named after it: nav_lab_panels.ari is now
nav_lab_stats.ari (the Stats window) and nav_lab_ledger.ari (the Ledger), each in INDEX.ari, and the
documents import both. arms_run::finish() now closes the file it streams the log to, so the log is
whole and free to read, move or remove at once: Windows refused to remove it while the run still
held it (NavArms.TheLogReadsBackValueForValue).
transfix added a commit that referenced this pull request Nov 15, 2026
- #1241 (AriadneLoader.MenuCollapseSetting): the schema's menu_collapse was an enum, so a bad
  value warned twice (the schema, then the loader, which falls back to auto), and the enum refused
  the yes/no/on/off the loader takes. The schema now checks only the type; the loader's warning,
  which names the fallback, is the one.
- #1257 (cvcgl_ari_golden): orthoslicer.ari had no orthoslicer.png. This is the frame CI renders
  (Linux, from #1270's earlier run; Windows renders the same).
- The chart is in libcvc 4.0, not 3.7.14: data_feed.ari, nav_lab_*.ari, nav_lab_stats.ari and
  NAV_LAB.md.

#1258's earlier failures (its component test and NavArms on macOS and Windows) are fixed on its
own branch now.
…ployed, k beside step 0 (#1259)

* cvc::nav's checkpoint scrubber: every checkpoint of a training run deployed, k beside step 0

Watch a policy learn. read_training_history() reads a training history (cvc::nav's own
coef_trainer history, cvc.nav.coef_train_history/v1, or GRL-SNAM's: JSON lines whose checkpoint
records name a .cvcnav blob), and scrub() deploys every checkpoint on one scenario, headless, as a
one-arm arms_run: the built-in blocks (a walled square of city blocks) or a recorded input trace's
world. Each run is a run log cached at <history>.scrub/<blob sha16>-<scenario hash>.cvcrun, the
hash covering the world, agents, settings, ticks and the versions. scrub_view shows checkpoint k
beside step 0: the deployed metric against the step with step 0 dashed, the table, a curve from
the history, and both runs' Stats and Ledger at the play head (three more units in
nav_lab_panels.ari).

cvc nav scrub HIST prints every checkpoint's metrics and writes a cvc.nav.scrub/v1 report;
pycvc binds the scrubber, and pycvc_gl.nav_lab scrub draws it. One blob deployed twice is the same
run, and checkpoint 0 deployed is the untrained policy's arm (nav_scrub_test). The behaviour is
GRL-SNAM's ariadne scrub (CVC-Lab/GRL-SNAM#181).

* nav_scrub_test: each test trains in a directory of its own (ctest runs them in parallel processes)

* nav_scrub: the checkpoint scrubber in libcvc's demo gallery, training and deploying in the page (#1260)

* nav_scrub: the checkpoint scrubber in libcvc's demo gallery, training and deploying in the page

examples/ariadne/nav_scrub is a C++ Ariadne host for cvc::nav's scrubber. With no --history it
trains cvc::nav's own coef_trainer for 60 steps on the built-in blocks' own map (in its frame,
occupancy_scene), a checkpoint every 6, deploys every checkpoint there and shows nav_scrub.ari
(the nav_lab_panels component's windows, written by cvc::nav::scrub_view), drawing the walls and
the two runs' ghosts. It joins the gallery's _wasm_demos with its document and the component
library preloaded, so in the browser the training, the deploys and the view run in the page: the
same numbers as natively (under 3 s there). demos.json and deploy-pages.yml's live check list it.

* nav_scrub: import the split nav lab components
# Conflicts:
#	bindings/pycvc/CMakeLists.txt
#	bindings/pycvc/pycvc.i
#	src/cvc-cli/main.cpp
@transfix transfix changed the title cvc::nav arms: policies side by side, the Stats and Ledger, the run log and its replay cvc::nav's nav lab: arms, Stats/Ledger, run log and replay, the checkpoint scrubber, and a Pages demo Nov 16, 2026
@transfix
transfix enabled auto-merge (squash) November 16, 2026 04:45
@transfix
transfix merged commit dc94570 into master Nov 16, 2026
29 of 30 checks passed
@transfix
transfix deleted the feat/nav-lab branch November 16, 2026 17:01
transfix added a commit that referenced this pull request Nov 16, 2026
…#1305, #1310, #1311)

#1305 gives each Runtime program-lane providers of its own (add_program_intrinsics), so two
documents on one app no longer reach each other's verbs and host functions, and moves
AppRuntime's provider there from the app's list. This branch had split that provider in seven,
each registered on the app with its kind (S1-Q7). Conflicts in ariadne.h, app_runtime.cpp and
ariadne.cpp keep both:

- Runtime::add_program_intrinsics takes a kind too (the form without one is host_only, as
  register_action_intrinsics's), and the Runtime's own list keeps it. AppRuntime adds its seven
  providers there, each with the kind it had, in the same order.
- install_providers runs any list by kind; the Runtime's own run after the app's, by the same
  rules, wherever an env is built: an action, a resident, a spawned child (finish_context), the
  names probe, and init: and a module's init: (every kind as it is, on their own thread).
- host_only_bindings counts the Runtime's own host_only providers, so one that binds anything
  pumps the document's group on the host thread, as an app provider does.
- add_program_intrinsics marks the placement stale, as a late host verb does.
- The own list is read where an env is built, a spawned child's on its pumping worker, so it is
  under a mutex of its own (own_mutex), copied, and run unlocked; names_mutex no longer guards it.

STATE_EXEC_THREADED.md: the Runtime's own providers, AppRuntime's seven among them, and the
fourth late-registration path. Built locally (MSVC Release; AB.lock held the box, so the suites
were not run here); a test of the own providers by kind follows.
transfix added a commit that referenced this pull request Nov 17, 2026
#1258 wrote the arms run's retarget at 3 s as tick 60, a 0.05 s tick.
#1275 made the sim tick 0.06 s, so the leg starts at tick 50. The test
takes the tick as round(3.0 / cars.DT) for the legs, the goals and the
alone run it compares against.
transfix added a commit that referenced this pull request Nov 17, 2026
…it (#1170)

* Ariadne L4: the gym (WorldGym, pycvc.WorldGym), and pycvc_gl.cars on it

A world document driven headless by reset(seed), step(steer, accel) and
observe(), with a reward of the user's and an episode log: one app per gym,
its clock paused, every draw seeded. WorldVehicles gains per-tick commands,
held goals, reseeding and per-step contact counts; SceneWorld::restart hands
the vehicles the new ground bodies. GymCars and --gym run the cars template's
controllers in a world document; world_gym.ari/.py are the example.

* Gym follow-up: every plant in a scene world, buildings as obstacles, a world per episode

WorldVehicles runs jolt, kinematic, dynamic and dynamic4w entities, a navigator per plant (the
dynamic models' chassis in a world of their own holding the world's colliders); entity_spec and
vehicles.spawn.plant name it; across plants vehicles touch by their chassis boxes, and cvcGL draws a
vehicle with no chassis from its pose. A world's terrain alone is its ground
(SceneWorldBody::ground), so a building is an obstacle. WorldGym's regenerate makes a generated
world per episode from the reset's seed (SceneWorld::regenerate_world). GymCars and --gym take the
cars template's plant names; dyn_bike_plant and dyn_4w_plant gain add_desc.

* Vehicles start on a slope, not inside it

A vehicle in world_gym.ari's generated world (seed 1, agent 3 at about
(-51.7, 46.4)) fell straight down from its first step. The terrain
collider has no hole there: a raycast at every free grid cell hits the
ground. The spot is a slope of about 0.75, and nav_plant placed every
start level at one ground sample (the nearest 2 m grid cell under the
rear axle) plus its resting height. Facing uphill, the Humvee's origin
started under the ground at its own centre and its nose more than a
metre deep; a body that starts below a height field falls through it.

nav_plant: with ground_height set, a start is tilted onto the plane
fitted to the ground under its chassis, its origin its resting height
above that plane, then lifted clear of the highest ground under the
chassis and the wheels at full reach. Level ground and a constant
ground_z keep the pose they had.

WorldVehicles: every plant's ground height (and height_at) is the world's
terrain where it has one, the physics collider's own heights, else the
grid bilinear between its samples, not the nearest sample.

Tests: a downward raycast at every free cell of the generated world finds
the ground at the grid's height; twelve Humvees placed on its slopes
(1 in 3 to 1 in 1, up and across) start above the ground and are on it
3 s later (two fell to z -27 before).

* Generated world: a cell's water class is its own depth

Each terrain cell took its material from one raster sample, its NE corner where the raster and
the mesh share samples. On a steep shore that corner can be dry or shallow while the cell is
metres deep, so the navigator and the physics took deep water for drivable ground: 151 cells
deeper than 0.5 m on world_gym.ari's generated world, the deepest at -1.91 m.

The materials stage now classes each cell's water by the mean of its corners against the sea,
with derived_class's depths (deep below sea - 0.5, shallow below sea, sand for a dry cell the
raster called water). A prop's footprint keeps its own material.

Test: WorldGenerated.ACellsWaterIsTheMeshsDepth checks every ungraded cell's class against its
mean height.

* Terrain edge walls: nothing leaves a world over its edge

add_world_geometry adds four static boxes around the rectangle the collide height fields cover
(world_bodies::edges): 2 m thick, 1 cm outside the edge, from 20 m below the lowest height to
20 m above the highest. They are not items and not ground, so a vehicle touching one has hit an
obstacle. SceneWorld keeps them as the terrain node's bodies, so they go and come with it.

world_gym.ari's generated world, seed 1: from agent 1's start (-122.9, -72.6) toward its goal on
the west shore, the vehicle slid down the slippery underwater slope and off the west edge in 14
of 18 runs (3 masses x 3 top speeds x nav@1 and world_gym.py's policy). Now 0 of 18; seeds 1-20
under both controllers have no agent out.

Tests: PhysicsWorldGeometry.NothingLeavesTheTerrainOverItsEdge (a box sliding at 15 m/s down a
mu 0.1 slope stops at the wall; rays down on the edge still meet the terrain) and
AriadneWorldGym.AGeneratedWorldsEdgeHoldsAVehicleIn (Humvees flat out at each edge stay in). The
body counts of generated and data worlds include the 4 walls.

* World edge modes: walls, a shore and the sea, or nothing

What is at a generated world's edge is now a choice (generated_world_params::edge, world_edge):

- wall (the default): the invisible walls of the previous commit.
- shore: a band at the rim (15 % of half, 40-250 m) becomes coast. From the band's inner end the
  ground eases down to a beach sloping 1 in 50 to the waterline, then under the sea to the island
  preset's shelf depth at the edge. Ground already lower keeps its bed. It wraps any terrain
  generator (fbm, dem, registered), lots stay off the shore, and the sea goes on past the world:
  outer_sea() is a ring at the waterline out 6 km, which cvcGL draws under <id>_water. No walls.
- none: the edge is open.

world_geometry::edge_walls() says whether add_world_geometry adds the walls; a generated world sets
it from its edge (only wall), and every other world_geometry keeps them on.

Ariadne: a generated_world node's `edge: wall | shore | none`. pycvc: generate_world's "edge"
param, and info()["edge"]. docs/ARIADNE.md describes it.

Tests: WorldGenerated.AShoreEdgeLinesTheWorldWithABeachAndTheSea (deep water all round the rim, a
sand beach inside it, the relief untouched past the band, the outer sea ring),
PhysicsWorldGeometry.TheEdgeWallsCanBeLeftOut, AriadneSceneWorld.AGeneratedWorldsEdgeCanBeAShore,
cvcgl_ariadne_realize (the drawn outer sea), test_pycvc_plant_host.py.

* Shore edge: a wider coast and a wandering coastline

Rendered, the shore's blend from the relief to the beach was short enough (about 11 m on a 300 m
world) that high ground met the coast as a rock cliff, and the coastline ran dead straight. The
band is now 20 % of half (50-300 m), the blend takes its inner half (sea floor to waterline by
25 %, beach to 50 %), and the coastline lies up to 15 % of the band further in by a smooth wobble
the seed sets. The edge stays the sea floor and the relief past the band is untouched.

* Shore edge: rounded corners, bays and headlands

The shore's coast followed the world's square outline, corners and all. It now follows a rounded
square, |x|^4 + |y|^4 = half^4 (world_shore_roundness), so the corners curve away into the sea,
and its wobble is up to 35 % of the band on longer waves (2.5 and 0.8 bands), for bays and
headlands. The square's edge is still the sea floor everywhere and the relief past the band is
untouched; the test measures the band from the rounded edge.

* Terrain lab: the world's edge is a live setting (world.edge, an Edge picker)

A generated_world node's edge was only its authored `edge:` key, so the terrain lab's World panel
could not change it. It is now a world.* key like the preset: world.edge (0 wall, 1 shore, 2 none),
seeded from the node, read on Regenerate, and part of the world's signature, so an edit marks the
world pending until Regenerate. world_controls.ari has an Edge combo (Wall, Shore, None) after
Water level. The walls follow the new world's colliders, and cvcGL draws or empties the outer sea
on the swap. pycvc_gl.cars logs it with the other world keys.

Tests: AriadneSceneWorld.TheWorldsEdgeIsALiveSetting (seeded 0; 1 waits, then Regenerate makes a
shore world with no walls; 0 brings them back) and the loader's world_controls check for the
Edge picker. Checked drawn too: an offscreen host switched a walled world to Shore and
regenerated it. 711/711 related ctest.

* world_gym.h: clang-format a comment's spacing

* Ariadne gym: what a differentiable twin of the world reads (WorldGym::fields, WorldGym::plants)

* One simulation tick: 0.06 s by default everywhere, vehicle worlds on the 0.01 s clock, real time catching up 0.25 s a frame

* ariadne_scene_world_test: built with -ffp-contract=off, as the plant it replays bit for bit

* Generated world: the cells round a lowered waterline sliver take their water class again

Master's #1271 lowers the terrain mesh's waterline slivers at the end of the grade stage, after
the materials stage classed each cell's water by its corners' mean height. A cell round a lowered
sample kept the class of the ground before it (sand, or shallow water over half a metre deep), so
WorldGenerated.ACellsWaterIsTheMeshsDepth failed. The materials stage's rule is now cell_class(),
and the cells touching a lowered sample are classed by it again from the lowered mesh.

* python_engine: the bridge ops pass self to server_link

#1276 made server_link take the module object (self) so it finds the
link on its own host, and #1302 landed after it with five calls that
pass nothing: room, bridge_presence, bridge_absent, bridge_post and
listen_chat. Master's pycvc-linux build fails on them. Name self in
those five functions and pass it.

* test_pycvc_gl_nav_lab: the retarget's tick from the sim tick

#1258 wrote the arms run's retarget at 3 s as tick 60, a 0.05 s tick.
#1275 made the sim tick 0.06 s, so the leg starts at tick 50. The test
takes the tick as round(3.0 / cars.DT) for the legs, the goals and the
alone run it compares against.
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