Skip to content

live --arms: policies side by side, with Stats and Ledger windows (Laboratory Phase 5) - #175

Merged
transfix merged 1 commit into
mainfrom
feat/ariadne-live-arms
Nov 13, 2026
Merged

transfix merged 1 commit into
mainfrom
feat/ariadne-live-arms

Conversation

@transfix

Copy link
Copy Markdown
Contributor

Plan Phase 3b: the live three-arm comparison. In the engagement docs' Laboratory doc (modernization/grl-snam-laboratory-camera-rigs-and-base-nav-demo.md) this is Phase 5, specified in §6.5 and §9.

grl-snam ariadne live austin-freedrive --plant kinematic --arms trained,untrained,constant

What it does

Each arm drives its own libcvc sim_world. Every arm has the same world, start, goal and seed, and all the worlds step tick for tick together. Each arm is drawn as a see-through ghost in its chart colour.

  • Arms can be bare names or arms-eval's syntax, NAME=PATH.cvcnav|PATH.pt|const:... (--arm adds more). The bare names are:

    • trained: the published policy. It reproduces the single-policy --plant kinematic run bit for bit, which is tested when grl-snam-weights is installed.
    • untrained: a CoefMLP from torch.manual_seed(--seed). untrained=PATH takes a step-0 blob instead.
    • constant: const:bias.

    As in arms-eval, constant arms take their layout from the first arm with a net. Each policy is exported to .cvcnav with write_coef_mlp and loaded through nav_sim_world_set_policy, from one shared policy library.

  • Retarget is a button, a menu item, or --retarget-at S,.... It moves every arm's goal on the same tick. The goal is the typed arms.goal if the SDF accepts it; otherwise Retarget says why not ("inside a building", "too tight", "off the world"). With no typed goal, it draws a free point. Each Retarget re-arms every arm's nav_stats, so the Stats rows describe the current leg.

  • Stats is a new component, docs/stats_panels.ari, which docs/live.ari imports alongside cvc://cars_panels.ari. It has one row per arm:

    • minimum and mean clearance (m);
    • penetration steps;
    • path (m);
    • elapsed time (s);
    • ms/tick: wall time, with the arms taking turns stepping first;
    • reached.
  • Ledger has one row per arm in each table:

    • The coefficients in force and U_nav's terms, read straight from nav_sim_world_drive_telemetry, all fields. Cars._read drops most of them.

    • The books, summed over the run and for the current tick:

      • dU: U's change, end to end;
      • drive = (potential_end - projection_work) - potential;
      • projection;
      • context (a Retarget books here);
      • dKE;
      • residual = dU - (drive + projection + context).

      The residual is the white paper's telescoping identity. It is 0 to float round-off on every tick of every test run.

    • The plant ledger for the picked arm. Each item is read from the collector's JSON and shows n/a where it is left out or null. On the kinematic plant every item is n/a; on the Jolt Humvee all 20 have values.

    • Cumulative charts. All charts are optional, as in coph.ari: requires: {name: chart, optional: true} and (has? "chart"). The text rows show the same numbers without them.

  • One object holds the whole run. ArmsRun (grl_snam/ariadne/_arms.py, which needs no host) keeps the per-arm poses, every telemetry field, the books, the Stats series and the legs. arrays() and meta() are what Phase 4a's RunLog will log. Until then, --log run.npz saves it as grl_snam.live_arms/v1.

  • The torch path refuses --arms. The reason it gives: the demo state is module-level (grl_snam.demos._common._STANDALONE).

  • Without --arms, live is unchanged: the new windows stay hidden behind arms.on. The plant path's HUD metrics moved into a shared plant_metrics().

plant_ledger is not bound in pycvc 3.7.13, so _arms.PLANT_LEDGER lists libcvc's item keys in plant_ledger.cpp's order. A small libcvc binding (plant_ledger_vehicle() keys, units and comments) would remove that copy. It's a follow-up, not a blocker.

What the numbers say

On open ground the three arms tie until they near a wall or the goal. Elsewhere every arm accelerates at the plant's limit straight at its goal, and the published policy sits close to CoefMLP's bias (#172).

On Austin with the kinematic plant at Sim speed 4x (300 frames, 40 s simulated), the rows part:

arm clearance min / mean (m) penetrating ticks path (m)
trained -15.24 / 8.17 187 377.6
untrained -15.26 / 8.25 180 376.0
constant -15.26 / 8.28 176 375.2

The screenshot, --offscreen --frames 300 --png --set view.speed=4 --set view.camera=orbit, was taken on the local libcvc chart build (transfix/libcvc#1169). It is in the session's shared notes, phase3b-live-arms-austin.png.

Tests

tests/test_ariadne_live_arms.py.

  • No host needed (these run in CI): arm specs and refusals, resolve's policies and hashes, the books' identity, Stats rows, the plant ledger's n/a, ArmsRun arrays and save, and goal checks.
  • Headless (skips without pycvc_gl's host, as test_ariadne_coph.py does): three arms on the flat square, on the kinematic plant, with Retarget pressed once through host.emit. It checks that:
    • the Stats rows differ;
    • every arm's goal changes at the same row, with context work spiking there;
    • the books close;
    • the log names each arm's policy;
    • the torch path refuses.
  • Optional:
    • the chart test, which needs host.set_plot;
    • an offscreen run, gated on GRL_SNAM_ARIADNE_GL=1;
    • the trained arm against the single-policy run, which needs grl-snam-weights.

Locally:

…boratory Phase 5)

grl-snam ariadne live austin-freedrive --plant P --arms trained,untrained,constant runs each arm
in its own libcvc sim_world, with the same world, start, goal and seed, stepped tick for tick
together. Each arm is a see-through ghost in its chart colour.

- Arms: bare names (trained = the published policy; untrained = a seed-init CoefMLP, or
  untrained=PATH for a step-0 blob; constant = const:bias) or arms-eval's NAME=PATH.cvcnav|
  PATH.pt|const:..., exported to .cvcnav and loaded with nav_sim_world_set_policy.
- Retarget (button, menu, --retarget-at) moves every arm's goal on the same tick, to the typed
  goal once the SDF clears it, else to a drawn free point; each arm's nav_stats starts a new leg.
- Stats (docs/stats_panels.ari, imported by live.ari): one row per arm, clearance min/mean,
  penetration steps, path, elapsed, ms/tick, reached, from nav_stats and the drive telemetry.
- Ledger: the coefficients, U's terms and the books against U_nav (dU, drive, projection,
  context, dKE, residual; the residual is the telescoping identity's), summed and per tick; the
  plant ledger with n/a where an item does not apply; cumulative charts on chart: hosts.
- One ArmsRun holds every arm's poses, telemetry, books and Stats series; --log saves it
  (grl_snam.live_arms/v1).
- The torch path refuses --arms: its demo state is module-level (_common._STANDALONE).
@transfix
transfix merged commit d471a7b into main Nov 13, 2026
4 checks passed
transfix added a commit to transfix/libcvc that referenced this pull request Nov 16, 2026
…point scrubber, and a Pages demo (#1258)

* cvc::nav arms: policies side by side, the Stats and Ledger, the run log 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.

* run_log: a JSON-quoting helper named quoted() is ambiguous with std::quoted under libc++

(cherry picked from commit 74856dffb86aa26653eef739f6077dd60352bc31)

* nav lab: a component file per unit named after it; finish() closes the 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).

* nav_arms_test: a fused multiply-add leaves dKE a last bit off zero on arm64; compare near

* cvc::nav's checkpoint scrubber: every checkpoint of a training run deployed, 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
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