Skip to content

nav: an external-force port on the four-wheel plant (dyn4_bike_step, dyn4_rollout_ext) - #780

Merged
transfix merged 4 commits into
masterfrom
feat/dyn4-ext-force
Oct 24, 2026
Merged

transfix merged 4 commits into
masterfrom
feat/dyn4-ext-force

Conversation

@transfix

Copy link
Copy Markdown
Owner

This is P8d's open item: the four-wheel plant (diff::dyn4_plant, #731) now takes the external force, the same port #728 gave the bicycle and P8a's dyn_bike_step.

What changes

  • dyn4_bike_step / dyn4_bike_step_bwd (detail/dyn_4w.h):
    • Take an optional ext_in: the force is joined to the controller's, steering or not, exactly where rollout_impl adds ext_force.
    • The backward returns dL/dF_ext and adds Jᵀ dL/dF_ext to the position's gradient.
    • A null ext_in is the step as it was.
  • ext_rollout.h: dyn4_rollout_ext<G> / dyn4_rollout_ext_bwd<G> are the trajectory on a ground sampler. The force is sampled every hold steps and held between, and the tape (dyn4_tape) holds dyn4_state. This mirrors dyn_rollout_ext.
  • Docs (NAV_TRAINING.md): the force section covers the four-wheel plant, and its "not yet" list loses the port.
  • Not here: the roadmap line. nav: 32 validation seeds and zeroth-order fine-tuning on Jolt reach (P8b); P8d on the roadmap #723 rewrites that part of the roadmap (P8d done; next the ext port, then P8c), so I'll mark the port done there once nav: 32 validation seeds and zeroth-order fine-tuning on Jolt reach (P8b); P8d on the roadmap #723 has merged, to avoid a conflict.

Tests (nav_dyn_4w_test, RoboRacer on a friction split with a bump)

Check Result
A zero force against no force, steering and not identical, bit for bit
One step, dL/dF_ext against central differences, steering / not 8.6e-5 / 0 (the speed command at its limit: both sides zero)
One step, the position's gradient through a position-dependent force (J) 3.6e-4
10-step trajectory: equals its steps; a null sampler equals the plain rollout identical
10-step trajectory, hold 1 / 3: dL/d(initial state), dL/dF 5.7e-3 / 1.9e-3, 1.3e-3 / 1.4e-3
  • Switch filter: the finite differences skip and count the cases on a controller or plant switch (fd_acc: the one-sided differences disagree, or the central ones at eps and eps/2 do), as nav_dyn_bike_test's fd_sum does.
  • Seed sweep: CVC_EXT_CASE_SEED 1..100, none fails. The worst were 1.4e-2 for one step's dL/dF, 3.4e-2 for the trajectory's dL/dF, and 6.6e-2 for its initial-state gradient. That last one runs through every step's plant and clamps, so it's held to 1e-1.
  • Fixture for GRL-SNAM's torch twin: Dyn4ExtRollout.Golden writes tests/data/dyn4_ext_rollout_golden.json. It has four agents, 10 steps, all 14 state components and their reverse gradients, with the field, the plant's parameters and the ground. The twin's four-wheel path isn't written yet. Rewrite the fixture with CVC_DYN4_EXT_GOLDEN_WRITE=1.
  • Locally (Windows, MSVC, RelWithDebInfo, Jolt): nav_dyn_4w_test 16/16 and nav_dyn_bike_test 20/20 pass.

…dyn4_rollout_ext)

P8d's open item. The four-wheel vehicle (diff::dyn4_plant) takes the external force as the bicycle
and P8a's dyn_bike_step do since #728:

- dyn4_bike_step / dyn4_bike_step_bwd take an optional ext_in (the force joined to the
  controller's, steering or not) and return dL/dF_ext, adding J^T dL/dF_ext to the position's
  gradient; null is the step as it was.
- ext_rollout.h: dyn4_rollout_ext<G> / dyn4_rollout_ext_bwd<G>, the trajectory on a ground
  sampler, with a force sampled every `hold` steps and held between (dyn4_tape).

nav_dyn_4w_test: a zero force is the step bit for bit; one step's dL/dF (8.6e-5) and the
position's gradient through J (3.6e-4) against central differences; the trajectory is its steps,
a null sampler the plain rollout, and its reverse against central differences for hold 1 and 3,
cases on a controller switch skipped and counted (fd_acc); none of CVC_EXT_CASE_SEED 1..100 fails.
Dyn4ExtRollout.Golden writes tests/data/dyn4_ext_rollout_golden.json for GRL-SNAM's torch twin.
@transfix
transfix enabled auto-merge (squash) October 24, 2026 00:42
@transfix
transfix merged commit eed7456 into master Oct 24, 2026
24 checks passed
transfix added a commit that referenced this pull request Oct 24, 2026
Carries the master merge (#776 squash, #774, #775, #777, #780, #782,
#784, #785) up the H1 stack.
@transfix
transfix deleted the feat/dyn4-ext-force branch October 29, 2026 20:52
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