Repository navigation
dyn_bike, dyn_4w: opt-in wheel spin in pH form; plant logs carry the wheels; cvc::ph potential and input options - #982
Merged
Merged
Conversation
dyn_spin_plant and dyn4_spin_plant give each wheel (each axle's, on the single track) its own angular speed, driven and braked by torques with the existing drive/brake split, and a Pacejka longitudinal tire force of its slip ratio under the friction ellipse. The longitudinal step solves (vx, om) implicitly with the tires and brakes linearized by their secants. In pH form H gains 1/2 sum J om^2, R gains K d d^T with K = F_x / sigma >= 0 along d = (-t, r_w e_wheel) (the patch's slip velocity), and the port is (wheel torque, wheel speed). dyn_spin_plant_books and dyn4_spin_plant_books add slip and braked lines. dyn_bike_plant gets options.wheel_spin. dyn_plant, dyn4_plant and their forms are unchanged by default: DynBike.Golden, DynBikePH.*, Dyn4.Golden, Dyn4PH.* and Dyn4ExtRollout.Golden pass unchanged.
…tial and input options plant_log records each Jolt vehicle's wheel speeds (the single track's two axles' means and their rims' surface speeds), the pedals, and the ledger's shaft work and brake energy per tick. cut_flights takes an opt-in flight_layout::wide row (18 columns: attitude, wheels, pedals, shaft and brake power); the planar 8-column layout stays the default. cvc plant-log --wide writes it, with meta.json naming the columns. cvc::ph::se2: se2_setup::potential world (V(x, y), the default), none, or terrain (the logged grade and roll times two learned coefficients: the gradient of m g z read where the vehicle is). Non-world models are cvc-ph-se2/3. se2_flights carries the column names; select_inputs picks the inputs by name (e.g. the wheels' rim speeds as ports). cvc ph-train gains --inputs, --potential and --eval-runs, and reports the mean model's clean rollout loss on train, held-out seeds and the eval runs.
… slip pointer write_plant_log wrote the bundle path into meta.json unescaped, so a run on a Windows bundle path could not be read back (by load_plant_log_runs or any JSON reader). dyn4_ph_parts_at fills the slips only when given somewhere to put them.
…rm reads it The body's grade and roll carry the suspension's pitch and roll under acceleration, so a terrain term fitted to them on flat ground learns the acceleration, not the ground, and blows up on real slopes. planar_sample gains ground_grade and ground_roll from the wheels' contact points (the two axles' and the two sides' mean contact heights); the wide row gains them (20 columns), and cvc ph-train --potential terrain reads them where the runs have them. On flat ground the body tilts up to 0.027 while the ground slope stays 0.
…te windows An input with no variation in training (the ground's slope on flat ground) had a scale of zero, so every window of a run where it moves diverged and the reported loss averaged none of them. It now keeps a unit scale, and each final loss says how many windows stayed finite.
This was referenced Nov 2, 2026
Q = -R dH/dx + G u + f_eps - m g grade e_x on the five momenta, so dyn_spin_ph_rhs is J dH/dx + Q and dH/dx^T Q is dyn_spin_ph_rates_at's balance: the hook a discrete-gradient step evaluates at its midpoint. DynSpinPH.TheForcesAreTheFieldLessTheStructure checks both at 500 states (2.1e-15 of m g, 1.3e-14 of the terms).
transfix
added a commit
that referenced
this pull request
Nov 3, 2026
transfix
added a commit
that referenced
this pull request
Nov 3, 2026
transfix
added a commit
that referenced
this pull request
Nov 3, 2026
… ground (#1002) pycvc.dyn_bike_plant takes the plant's opt-in options from #982, #983 and #987: wheel_spin; side_slope; and contact, with contact_field (a sim_world handle, whose signed distance on contact_plane is copied as it is now), contact_vehicles and contact_params (a dict of dyn_contact_params' fields). ground, a pycvc.height_field in world metres (copied), gives the plant a ground height, which the vehicle climbs and the side slope reads; before, Python had only a flat ground_z. contact with a world raises, as do contact_field without contact and a contact setting that does not exist. The books gain slip, contact_energy, contact_stored, contact_dissipated and contact_exchange. options() reports the new settings. wheel_speed(i, axle) and contact_now(i) (the barrier's energy, the damper's power, the points touching and the body wrench) read an agent. test_pycvc_physics.py's test_the_dynamic_plant_options: - wheel spin on grip 0.3 books 1.75 kJ of slip, and the axles' wheels part; - a 5% ramp costs 51.5 kJ; - a 10% side slope pulls the vehicle 0.23 m downhill, where the plain ground leaves it on its line; - driven at a wall in another sim_world's map, it stops with its rear axle 4.55 m short, pressed with 4 points at 23.5 kN, and the damping books 81.6 kJ. Every run's books close to 1e-9 of the flow. The contact run uses a 0.005 s substep. At the default 0.01 s the damper, held over the substep, overshoots this 7.8 m/s impact: the books show contact_dissipated at -1.5e5 J (the contact supplying energy), the limiter takes 2.4e5 J, and the residual is 3.1e-2 of the flow. At 0.005, 0.0025 and 0.00125 s the residual is 2.4e-3, 1.3e-3 and 2.6e-4 of the flow. physics_dyn_contact_test impacts at 5 m/s only.
This was referenced Nov 3, 2026
transfix
added a commit
that referenced
this pull request
Nov 8, 2026
…inning (#1045) dyn_spin_plant_dg (detail/dyn_bike_dg.h, opt-in) solves the momenta e = (vx, vy, r, om_f, om_r), M = diag(m, m, Iz, J_f, J_r), with Q from the plant's hook dyn_spin_ph_forces_at (#982) and its optional wrench (#983). The body's rows take the midpoint. The wheels' rows take theta_wheels, 1 by default, because the wheels' slip is far stiffer than the step. The books (dyn_spin_ph_rates_at at e_th) close to the solver's tolerance, with one more line, `scheme`, for the wheels' damping. Actuators, clamp, blend and pose are dyn_plant_dg's. dyn_plant_dg now calls them through dyn_dg_actuators and dyn_dg_finish, and its step is unchanged. Nothing that calls dyn_plant or dyn_spin_plant changes. nav_dyn_bike_dg_test gains DynSpinDG.*: rate against dyn_spin_ph_rhs, actuators to the bit, books, order, stiff wheel slip at nav's 0.06 s and the live plant's 0.01 s with and without substeps, and cost. docs/NAV_TRAINING.md gets the gates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Answers the reviewers' actuation point on the vehicle pH plant (GRL-SNAM
docs/vehicle-ph-plant.tex): neitherdyn_bikenordyn_4whad wheel spin, so there was no longitudinal slip, wheelspin or lockup, and the learned plant'sG(v)uabsorbed the whole drivetrain with a potentialV(x, y)tied to world position. Every new path is opt-in; the defaults are unchanged.Wheel spin, in port-Hamiltonian form (
dyn_bike.h,dyn_4w.h)dyn_spin_state=dyn_state+om_f, om_r(each axle's wheels);dyn4_spin_state=dyn4_state+ four wheel speeds.a >= 0drives, each axle'sT_d = r_w * share(front_drive) * m a;a < 0brakes,T_b = r_w * share(front_brake) * m |a|against the wheel's rolling,-T_b sg(om)withsgsmoothed over the slip floor at the rim. A brake stops and holds a wheel, so a negativeanever drives backward (as Jolt's driver).F_x = D sin(C_x atan(B_x sigma / u)),sigma = r_w om - t^T v(the patch's slip velocity;tthe wheel's direction on the twist),D = mu F_z, under the existing friction ellipse. The step solves(vx, om)by implicit Euler with the tires and brakes linearized by their secants through their roots:(M + h R_x) d = M(...), SPD, so it never fails and stiff tires stay stable at nav's step.dyn_bike_si_of): wheel radius, each axle's wheel inertia (Humvee: 0.47 m, 12 kg m^2 an axle),C_x = C(Jolt's sliding fraction),B_xputs the peak at Jolt'stire_peak_slip(B_x 46.2, peak at slip 0.080).dyn_spin_ph_*,dyn4_spin_ph_*): x = (p, J om).Hgains1/2 sum J om^2.RgainsK d d^TwithK = F_x / sigma >= 0(the exact secant) alongd = (-t, r_w e_wheel):d^T dH/dx = sigma, the direction of wheel surface speed less ground speed. PSD at every slip, rolling, spinning or locked. On four wheelstis the patch's speed along the wheel with roll and pitch, so the coupling is reciprocal: no lever term.(wheel torque, wheel speed):G = [e_om],y^T u = om^T T, shaft power; the brakes' part-T_b om sg(om) <= 0at every state.dyn_spin_plant_books,dyn4_spin_plant_books):dH = supplied - braked - dissipated - slip + floor + grade (+ lever + ground on four wheels) + limiter + residual.dyn_bike_plant_options::wheel_spin(books gainslip;wheel_speed(i, axle);tire_usereads the slip ratio too).Plant logs and the learned plant
plant_logrecords each Jolt vehicle's wheels (the single track's two axles' mean angular speeds and rim speeds), the pedals, and the ledger's shaft work and brake energy per tick. Jolt's vehicle API does not expose a per-wheel drive torque; the ledger's shaft power over the wheels' speed is the mean drive torque.cut_flights(..., flight_layout::wide)andcvc plant-log --wide: an 18-column row (attitude, wheels, pedals, shaft and brake power); meta.json names the columns. The 8-column.npystays the default.cvc::ph::se2:se2_setup::potential=world(V(x, y), default) |none|terrain(the logged grade and roll times two learned coefficients: the gradient ofm g z, read where the vehicle is). Non-world models arecvc-ph-se2/3.select_inputspicks inputs by column name, so the wheels' rim speeds can be ports.cvc ph-train --inputs --potential --eval-runs.write_plant_logwrote the bundle path into meta.json unescaped, so a Windows bundle run could not be read back.The learned plant's fit comparison
Plant logs (
cvc plant-log --wide) of the Jolt Humvee:scene-austin-south-smallbundle from cvcpkg, terrain and buildings, seeds 200-203, mean 6.0 m/s, ground slope rms 0.052 (max 0.17).Each environment has 192 flights of 5 s.
cvc ph-trainwas run with steering as a modulation, 5000 steps, 0.05 observation noise, seeds 0 and 1. The loss is the mean model's rollout loss on clean 2 s windows (101 points), the same measure for every column: train seeds, the environment's held-out seed (203 / 103), and the other environment.Trained on Austin (held out: seed 203; other environment: the swerve)
Trained on the swerve (held out: seed 103; other environment: Austin)
What this says
ph-train, and every final loss says how many windows stayed finite. Before this, the scale was round-off (rms 7.5e-9), so all of Austin's windows diverged and the loss averaged none of them.Tests (Windows, MSVC 14.44 Release, local)
Suites run: nav_dyn_spin_test 12/12, nav_dyn_bike_test 23/23, nav_dyn_4w_test 23/23, physics_dyn_bike_plant_test 9/9, ph_se2_test 18/18, ph_se2_train_test 13/13, physics_plant_log_test 14/14, cvc_cli_test 182/182.
DynSpinPH,Dyn4SpinPH.TheStructureIsPortHamiltonianAtEverySlip)K >= 0,w^T R w >= 0in every sample;y^T u = supplied - braked. 420 of 500 states (single) and 1193 of 2000 wheels (4w) past the longitudinal peak...TheVectorFieldIsThePlantsAtEverySlip)...StepBooksCloseToSecondOrder), launch at full drive on mu 0.3 (wheels spin to kappa 8.7), then full brakes (they lock)DynSpin,Dyn4Spin.PlantGradientMatchesFiniteDifference)DynSpin.SpinsOnLowGripLocksUnderHardBrakingRollsLikeDynPlant)m + sum J / r^2= 2785 kg (4% over m) predicts, to 7e-4 m/sDynBikePlant.WheelSpinSpinsLocksAndTheBooksClose), driver on, mu 0.2DynSpinPH.Golden,Dyn4SpinPH.Golden)PlantLog.LogsAHumveeSwervingOnJolt)PhSe2Train.PotentialOptionsGradientsMatchFiniteDifferences), /3 round tripDefaults unchanged
dyn_bike_golden.json,dyn_bike_ph_golden.json,ext_rollout_golden.jsonanddyn4_ext_rollout_golden.jsonregenerate byte-identical.dyn4_golden.jsonregenerates identical to what master's owndyn_4w.hand test give when rebuilt on this box; both differ from the committed file in 11 last-bit lines (the test passes at 1e-9), so that drift predates this PR and the file is left alone.For the discrete-gradient step (added after review opened, 1005ab6).
dyn_spin_ph_forces_at(p, s, grade, Q[5])returns every force but the structure's: Q = -R dH/dx + G u + f_eps - m g grade e_x on the five momenta. Sodyn_spin_ph_rhsis J dH/dx + Q (to 2.1e-15 of m g), and dH/dx^T Q isdyn_spin_ph_rates_at's balance (to 1.3e-14 of its terms).DynSpinPH.TheForcesAreTheFieldLessTheStructurechecks both. It is the hook #978's follow-up (dyn_spin_plant_dg) evaluates at its midpoint. Nothing existing changes.