Skip to content

Nav: a parked vehicle on a plant brakes with its brakes, not at a_max - #960

Merged
transfix merged 1 commit into
masterfrom
fix/sim-world-park-brakes
Nov 1, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/sim-world-park-brakes

Conversation

@transfix

@transfix transfix commented Nov 1, 2026

Copy link
Copy Markdown
Owner

When a vehicle on a plant reached its goal, sim_world's park braked it at the drive's a_max (2 m/s² on the Humvee), not at what its brakes achieve. A Humvee arriving at 7 m/s rolled about 12 m on, well past its reach_tol, and stopped there.

The park now brakes at plant_limits::a_brake: nav_plant's brake_margin × max_decel, 6 m/s² on the Humvee. It falls back to a_max when the plant reports no brakes.

This is the park fix from #957 on its own, so it can ship without the training stack.

Measured

On the Jolt Humvee (20 held-out seeds, 48 vehicles, 60 s, #957's scoring), the untrained seed policy's reach goes from 41.5% to 77.2%, with 95% of arrivals held at their goals.

Test

NavTerrain.AParkedAgentStopsOnItsBrakes parks an agent arriving at 7.9 m/s, 2 m short of its goal, on a plant that integrates exactly what it's told:

plant's brakes rolled after the park ends
6 m/s² 4.9 m (v²/2a = 5.2 m) held at its goal
none (falls back to a_max) 15.3 m (v²/2a = 15.5 m) past its goal

Without the fix, the 6 m/s² case also rolls 15.3 m and the test fails. Checked locally on Windows (MSVC, Release). The changed files are clean under clang-format 19.

sim_world's park braked a vehicle that reached its goal at the drive's
a_max (2 m/s^2 on the Humvee), not at what its brakes achieve. A Humvee
arriving at 7 m/s rolled ~12 m on, well past its reach_tol, and stopped
there. The park now brakes at plant_limits::a_brake (nav_plant's
brake_margin x max_decel, 6 m/s^2 on the Humvee), and at a_max when the
plant gives none.

On the Jolt Humvee (20 held-out seeds, 48 vehicles, 60 s) the built-in
policy's reach goes from 41.5% to 77.2%, with 95% of arrivals held.

NavTerrain.AParkedAgentStopsOnItsBrakes parks an agent arriving at
7.9 m/s 2 m short of its goal: with 6 m/s^2 of brakes it stops in 4.9 m
and holds; a plant that reports none stops it at a_max, 15.3 m on and
past the goal. Without the fix the first case rolls 15.3 m and fails.
@transfix
transfix enabled auto-merge (squash) November 1, 2026 19:09
@transfix
transfix merged commit 401d162 into master Nov 1, 2026
27 checks passed
@transfix
transfix deleted the fix/sim-world-park-brakes branch November 1, 2026 19:12
transfix added a commit that referenced this pull request Nov 1, 2026
…g options (#957)

* Nav: time pressure and continuing episodes on the Jolt rollout

The rollback-trained Jolt Humvee policy reaches 73.8% of held-out goals
but drives slowly: 2.2 m/s in a harness run against the untrained 6.5,
and on nav_plant's held-out seeds it reaches 4.7% of its goals within
4 m/s's time against the untrained 42.6%.

Scoring (cvc::physics::score_on_plant):
- plant_reach_options::time_budget_mps and plant_drive_score::
  reach_in_time: the share that first reached their goals within the
  straight line's distance at that speed.
- speed_mps (en route, to arrival or the run's end), arrive_mps (over
  the agents that arrived), stopped_frac (under 0.5 m/s before arriving),
  building_hits and vehicle_contact_s.

Training (rollout_kind::jolt):
- train_config::w_progress / progress_speed / progress_tol: each step
  pays its shortfall from progress_speed's progress toward the goal, as
  a fraction of a step's worth, until the vehicle is within progress_tol.
  The window-end distance alone hardly prices time, and a sum of steps'
  progress would telescope back to it.
- train_config::episode_steps / episode_tol: a batch drives on across
  outer steps until every agent is at its goal or the limit, instead of
  a fresh batch from rest every outer step (3.6 s at a horizon of 60,
  with goals 25-100 m away, so training never saw a vehicle arrive).
  coef_trainer::episodes() / episodes_arrived() count the batches.

Experiments (CVC_JOLT_TRAIN_EXPERIMENT=1):
- JoltTrainedHumveeOnJoltReach: arms take a w_progress; JOLT_EXP_
  {BUDGET_MPS, SELECT_MPS, PROGRESS_MPS, EPISODE, SCORE} add selection on
  reach in time, the progress term, episodes and scoring saved policies;
  every arm reports the new scores.
- WhyTrainingSlowsTheJoltHumvee (JOLT_WHY=1): the horizon loss split into
  its goal and collision terms with the 4 m/s shortfall beside them, each
  part's gradient and the share of parameters it decides, and on Jolt
  what a sign step along each does.

Tests: JoltRollout.ProgressTermPricesTheShortfall (the term is each
step's shortfall to 1e-5; its model gradient agrees in sign with Jolt's)
and JoltRollout.ContinuingEpisodesKeepTheBatchDriving.

* Nav: the collision penalty on the vehicle's own footprint

The Jolt rollout's collision penalty was one disc of the scene's rr on
the rear axle with the scene's d_hat as d_safe: at demo3's metric a 3 m
disc and a 7 m margin, so a Humvee paid within ~10 m of any wall. On the
experiment's batches that term was 13 times the goal term, the training
step followed its gradient (cosine 0.999), and a step along it slowed
the Humvees (2.21 -> 1.71 m/s at the rollback policy).

train_config::coll_offsets / coll_rr put the penalty on discs along the
heading from the rear axle instead; empty is the old disc, bit for bit.
The experiments' JOLT_EXP_BODY_MARGIN_M uses nav's footprint (four discs
of 1.3 half-widths, tail to nose) with that margin as d_safe. At 0.55 m
the diagnostic's collision term is 0 on the launches, and the training
step follows the goal term (cosine with the 4 m/s shortfall +0.986).

Test: JoltRollout.BodyPenaltyOnTheVehiclesFootprint.

* Nav docs: why the trained Jolt Humvee is slow, and what time pressure did

score_on_plant also scores, of the agents that arrived, the share still
at the goal at the end (held_frac), how far off they ended (end_m) and
their speed on arrival (arrival_mps).

NAV_TRAINING.md gets the measurements:
- the rollback policy's reach is a slow policy's: 4.7% within 4 m/s
  (untrained 42.6%), arriving at 1.6 m/s, so sim_world's park holds 93%
  of its arrivals inside the 3 m tolerance;
- the diagnostic: the 3 m disc with the 7 m margin made the collision
  term 13 times the goal's, and the loss's gradient is its (cosine
  0.999); a step along it slows the Humvees;
- the sweep: with the old penalty no arm improves timely arrival; with
  the footprint and 60 s episodes training raises it for the first time
  (+2.5 and +5.3 points within 4 m/s), but the policies arrive at 6-7 m/s,
  the park's 2 m/s^2 cannot stop them in the tolerance, and reach falls.

* Nav: stop at the goal -- a stopping profile in training, the park on the brakes

The time-pressured Jolt policies arrived at 6-7 m/s and ended 7.5-10 m
past their goals: training asked for full speed up to the tolerance,
and sim_world's park braked at the controller's a_max (2 m/s^2 on the
Humvee), not at what the brakes achieve.

- train_config::progress_decel: with w_progress, p* is also capped at a
  step of v_stop(d) = sqrt(2 decel (d - tol)), the speed the vehicle can
  still stop from at the tolerance, and each step pays its speed over
  v_stop at its end as a fraction of progress_speed (at the goal, any
  speed). The shortfall's gradient follows p*'s bound; the overspeed's
  reaches vx and, through v_stop, the position.
- sim_world: a parked vehicle on a plant brakes at plant_limits::a_brake
  (nav_plant's brake_margin x max_decel, 6 m/s^2 on the Humvee), a_max
  when the plant gives none (on master first, on its own, as #960).
- The Jolt experiments: JOLT_EXP_STOP_DECEL (m/s^2) and JOLT_EXP_DHAT_M,
  the controller's barrier range (the scene's d_hat) in metres, for
  training and scoring alike (experiment_scene).

ProgressTermPricesTheShortfall checks the profile's shortfall and
overspeed against the states step by step, far from the goals and at
them. nav_test, physics_dyn_bike_plant_test, physics_dyn_4w_plant_test,
nav_route_follower_test, nav_coef_train_test and physics_jolt_rollout_test
pass.

* Nav docs: the park on the brakes, and every fix retrained

With sim_world's park braking at the brakes' limit the untrained Jolt Humvee policy reaches 77.2% of held-out goals (41.5% before): it reached them and could not stop inside the tolerance, and the rollback policy's +32 points were it learning to creep in. With the footprint penalty, 60 s episodes, a stopping profile and the fixed park, no arm improves on the untrained policy at d_hat 7, 2 or 1 m, and a shorter barrier alone costs it about 3 points of reach.

* Jolt rollout tests: the progress term's gradient need not match Jolt's sign

ProgressTermPricesTheShortfall held the model's derivative of the time
pressure along alpha's bias to Jolt's central difference in sign. On
macOS arm64 they part (model +1.2e-5, Jolt -9.7e-5; on Windows +8.5e-4
and +1.6e-3): the slope is small enough that a contact the perturbation
adds or removes flips Jolt's difference, as the gradcheck test already
allows for beta and gamma there. The test now holds the model's to
finite and non-zero and prints Jolt's beside it.
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