Skip to content

Nav: train on the Jolt Humvee through the four-wheel pH model's gradient (P1-P3) - #940

Merged
transfix merged 1 commit into
masterfrom
feat/jolt-rollout
Oct 31, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/jolt-rollout

Conversation

@transfix

Copy link
Copy Markdown
Owner

Training on the Jolt Humvee. rollout_kind::jolt runs the training rollout's forward in Jolt and takes the gradient from dyn_4w's port-Hamiltonian model, evaluated at the states Jolt reached:

x[t+1] = f_PH(x[t], u[t]) + xi[t]      xi[t]: what Jolt did beyond the model, held fixed

The model's books are calibrated to Jolt's energy ledger first. Jolt is on the forward path and is never differentiated. This is phases P1–P3 of the plan in the libcvc workstream. It partly reverses cvc-engagement-docs doc 31 D2 ("Jolt is never on the gradient path"); that doc change is a follow-up.

P1: the ledger a tick, and replay

  • nav_plant::ledger_step(i): agent i's vehicle_energy over the last tick, computed by energy_lines (vehicle.h) from the ledger at the tick's start and end. The lines balance as the ledger does and sum to it.
  • nav_plant::save() / restore(): world::save plus each agent's command, energy, contacts, sample and drift, and the drift summary. A restored run continues bit for bit. A state of other agents or another world is refused, and nothing changes.

P2: the four-wheel model calibrated to Jolt's ledger (nav/dyn4_ledger.h)

  • dyn4_ph_lines_at splits the pH power the way the ledger does: port, tire, drag, rolling, damper.
  • New dyn4_params fields drive_gain, brake_gain and resist_comp describe how the drive answers a command. Their defaults leave the plant bit for bit as before.
  • calibrate_dyn4 fits the model in three parts:
    • Dynamics: the drive and its lag, plus the tire stiffness B, by Gauss-Newton on Jolt's one-tick twist.
    • Dissipation: drag, rolling resistance and the dampers, by Jolt's line totals.
    • Price: the source's price per unit of the model's port work, plus idle power, by NNLS on Jolt's fuel.
  • The model has no wheel spin, so Jolt's tire line is split between the model's lateral slip loss and a longitudinal-slip term, in the books only.
  • dyn4_books_of reports the books on held-out runs.

P3: the rollout

  • nav/rollout_plant.h is the seam, since nav cannot depend on physics. It holds the rollout_plant interface and dyn4_rollout_plant, the model itself, which serves as the exact twin for gradchecks.
  • physics::jolt_rollout builds one world per batch:
    • flat ground and the scene's walls, with each agent on its own copy of the scene;
    • a nav_plant driving each vehicle through the driver model;
    • the vehicle read back as the model's dyn4_state, and its ledger mapped onto the model's lines;
    • starts turned until the body fits.
  • In coef_trainer, the window steps all agents together in Jolt, and the backward is dyn4_bike_step_bwd at Jolt's states. With w_energy, the term's value is Jolt's fuel and its gradient goes through the calibrated port.
  • Also new: record_plant_ticks, bike_veh_of, and train_config::start_clearance, which defaults to half a wheelbase on this rollout and to 0 elsewhere, as before.
  • The policy's forward and backward moved into shared helpers, with unchanged arithmetic. The existing trainer tests pass as before.

Measured

Windows MSVC Release; the Humvee on the trainer's city at about 0.106 normalized units per metre.

Result
Calibration, held out dissipation −46.7% → −10.5%; fuel +3.5% (r² 0.53); one-tick twist 0.0183 → 0.0181
Fitted drive gain 1.00, lag 0.068 s (spec 0.1 s); B ×0.81
Gradient against Jolt's central differences α, β, γ output biases within 5–7%; along the gradient Jolt's slope is 1.26× the model's
Training on Jolt 25 steps lower the horizon loss on one batch, 1.2344 → 1.2321
Model as its own plant gradcheck dir_rel 1.3e-2, and 3e-5 with the energy term; a perturbed model is recovered to three digits
Cost about 80–100 µs per Humvee step, ledger on

The gradient check starts from vehicles already moving. From rest, a short window changes the loss less than Jolt's float arithmetic does, so a check there shows only noise.

Tests

  • New: physics_jolt_rollout_test (6 tests).
  • nav_coef_train_test: three new tests (model-plant gradcheck, guards, calibration recovery).
  • nav_dyn_4w_test: power lines against the rates; the drive's answer.
  • nav_plant_test: ledger lines balance; save/restore replays bit for bit.
  • Unchanged suites pass: physics_world, physics_vehicle, physics_energy, physics_plant_log, and the rest of nav_coef_train, nav_dyn_4w and nav_plant (convergence tests excluded).

Docs

  • NAV_TRAINING.md: new section "Training on Jolt".
  • PHYSICS_API.md: the ledger a tick, replay, and the header.

Next

  • P4: material_train and pycvc/GRL-SNAM --rollout jolt.
  • P5: cvcdbg's comm trainer.
  • P6: harness evaluation.
  • Docs 31 and 32: the D2 change.

rollout_kind::jolt drives the training rollout's forward in Jolt (the Humvee
through nav_plant's driver model, the scene's walls in the world, one copy of
the scene per agent) and takes its gradient from dyn_4w's port-Hamiltonian
model evaluated at the states Jolt reached, with the model's books calibrated
to Jolt's energy ledger.

- P1: nav_plant::ledger_step (each tick's vehicle_energy lines, energy_lines in
  vehicle.h) and nav_plant::save/restore (world::save plus the agents' state),
  which replays a run bit for bit.
- P2: calibrate_dyn4 (nav/dyn4_ledger.h) fits the model's drive (new
  dyn4_params drive_gain, brake_gain, resist_comp; defaults step bit for bit),
  drive lag and tire stiffness to Jolt's one-tick motion, its drag, rolling and
  dampers to Jolt's ledger lines, and the source's price of its port to what
  Jolt's fuel paid. dyn4_ph_lines splits the pH rates as the ledger does.
- P3: the rollout_plant seam (nav/rollout_plant.h), physics::jolt_rollout, the
  Jolt window in coef_trainer, record_plant_ticks, and the start clearance.

Measured: held-out books close (dissipation -10.5%, fuel +3.5%); the gradient
matches Jolt's central differences within 5-7% on alpha, beta and gamma and
1.26x along the gradient; 25 steps on Jolt lower the loss 1.2344 -> 1.2321.
@transfix
transfix enabled auto-merge (squash) October 31, 2026 07:35
@transfix
transfix merged commit 65c6bd0 into master Oct 31, 2026
21 of 27 checks passed
@transfix
transfix deleted the feat/jolt-rollout branch October 31, 2026 10:46
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