Skip to content

physics: the dynamic plants drive the terrain and collide in a Jolt world; dyn_4w as a live plant - #869

Merged
transfix merged 1 commit into
masterfrom
feat/dyn-plants-terrain
Oct 28, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/dyn-plants-terrain

Conversation

@transfix

Copy link
Copy Markdown
Owner

The dynamic plants were flat and collided with nothing. dyn_bike_plant ran dyn_plant with grade 0 and no physics world, and the four-wheel model (dyn4_plant, P8d) had no live plant, so --plant couldn't select it. This puts both on the scene's terrain and makes their chassis collide in a Jolt world.

The ground

  • Both plants read nav_plant_options::ground_height (else ground_z), the same function an application already spawns Jolt vehicles on.
  • dyn_bike_plant takes the sine of the slope along its heading, under the centre of gravity and over a wheelbase, into dyn_plant's grade. Its books gain the grade line.
  • dyn_4w_plant puts each corner's spring on the ground under its wheel, with grade_force on. It starts each vehicle at rest on the ground, with heave, roll and pitch fitted to the four wheels.

The world

  • With options.physics, each vehicle's chassis box is a dynamic body in that world, at the model's ride height and attitude (src/cvc/physics/dyn_world.h, internal).
  • Every substep, the box is set at the pose the substep starts from, moving as the model moved, and the world takes one step.
  • A box that touched something other than the ground (a building, another vehicle, a prop) takes the world's pose and twist back into its model. Heave, roll and pitch stay the model's. The energy that changed goes on a new contact line in the books.
  • A box that touched nothing leaves the model's step alone, bit for bit.
  • The substep becomes the world's fixed_dt. The plant sets the world's contact reporting to all, because a chassis pressed against a wall stays in contact.

dyn_4w_plant (new, inc/cvc/physics/dyn_4w_plant.h)

  • The four-wheel model as a vehicle_plant, with parameters from nav_plant::dyn4_si_of.
  • Per-vehicle books: stored = stored₀ + drive − brake − dissipated + lever + grade + ground + limiter + contact + residual.

plant_host

  • dynamic4w and dynamic4w:<presets> select the four-wheel plant (is_dynamic4w, dynamic4w()).
  • With Jolt in the build, both dynamic plants get a world built the way the Jolt presets' is (set_geometry's geometry, or the flat ground). Its terrain bodies are the ground, and physics() returns the world.
  • Without Jolt, they drive the same ground and collide with nothing.

Tests (Windows, MSVC 19.44 Release):

  • physics_dyn_bike_plant_test 6/6
    • Up a 5% ramp, the single track is 2.864 m/s slower than on the flat after 6 s (g·sinθ·t = 2.938).
    • Its grade line is −19.86 kJ, against m·g·Δz = −19.92 kJ.
    • Driven into a wall 30 m ahead, the nose stops at 30.000 m: 663 colliding substeps, contact −126.9 kJ. With no world it reaches 132.8 m.
  • physics_dyn_4w_plant_test 5/5
    • It steps as dyn4_plant does, bit for bit. Its books close, with residual 2.0e-5 of the flow on a 30 s weave.
    • Up the ramp it loses 3.183 m/s, against g·s·t = 2.942. The excess is the skyhook dampers' c·ż² on a steady climb, a known property of the model. Without the grade force it climbs for free.
    • Its nose stops at the wall at 29.999 m.
    • plant_host puts a sim_world's agents on it by name, and they reach their goals.
  • Regression: ctest of the physics, plant, plant_log and sim_world suites passes 204/204 (4 skipped, as on master).
  • Formatting: clang-format 18 is clean on every changed file.

Downstream: CVC-DBG/cvcdbg wires --plant dynamic4w and the books' new lines into demo3 (PR to follow). It is feature-tested, so it still builds against 3.7.1. A libcvc release with this change is needed for the hosted demo.

…orld; dyn_4w as a live plant

The dynamic plants were flat and collided with nothing: dyn_bike_plant ran dyn_plant with
grade 0, no physics world, and the four-wheel model (dyn4_plant, P8d) had no live plant at all.

The ground. Both plants now read nav_plant_options::ground_height (else ground_z), the same
function an application spawns Jolt vehicles on. dyn_bike_plant takes the sine of the slope along
its heading under the centre of gravity (over a wheelbase) into dyn_plant's grade, and its books
gain the grade line. dyn_4w_plant puts each corner's spring on the ground under its wheel, with
dyn4_params::grade_force on, and starts each vehicle at rest on the ground, its heave, roll and
pitch fitted to the four wheels.

The world. With options.physics each vehicle's chassis box (vehicle_desc::half_extents) is a
dynamic body in that world, at the model's ride height and attitude (dyn_world.h, internal). Every
substep the box is set at the pose the substep starts from, moving as the model moved, and the
world takes one step; a box that touched a body that is not the ground (a building, another
vehicle, a prop) takes the world's pose and twist back into its model (heave, roll and pitch stay
the model's) and the energy that changed is booked on a new contact line. A box that touched
nothing leaves the model's step alone, bit for bit. The substep is then the world's fixed_dt, and
the plant sets the world's contact reporting to all (a chassis pressed against a wall stays in
contact).

dyn_4w_plant (new, inc/cvc/physics/dyn_4w_plant.h): the four-wheel model as a vehicle_plant,
parameters from nav_plant::dyn4_si_of, books per vehicle:
  stored now = stored at attach + drive - brake - dissipated + lever + grade + ground + limiter
               + contact + residual

plant_host: "dynamic4w" / "dynamic4w:<presets>" select it (is_dynamic4w, dynamic4w()). With Jolt
in the build both dynamic plants get a world built as the Jolt presets' is (the geometry given
with set_geometry, or the flat ground), whose terrain bodies are the ground; physics() returns it.
Without Jolt they drive the same ground and collide with nothing.

Tests (MSVC 19.44 Release):
- physics_dyn_bike_plant_test 6/6. Up a 5% ramp the single track is 2.864 m/s slower than on the
  flat after 6 s (g sin(slope) t = 2.938), and its grade line is -19.86 kJ against m g dz =
  -19.92 kJ. Into a wall 30 m ahead the nose stops at 30.000 m (663 colliding substeps, contact
  -126.9 kJ); with no world it reaches 132.8 m.
- physics_dyn_4w_plant_test 5/5. It steps as dyn4_plant does, bit for bit, and its books close
  (residual 2.0e-5 of the flow on a 30 s weave). Up the ramp it loses 3.183 m/s against
  g s t = 2.942, the excess being the skyhook dampers' c zdot^2 on a steady climb; without the
  grade force it climbs for free. Its nose stops at the wall at 29.999 m.
- ctest of the physics, plant, plant_log and sim_world suites: 204/204 pass (4 skipped, as on
  master).
@transfix
transfix enabled auto-merge (squash) October 28, 2026 19:54
@transfix
transfix merged commit 5ca26cf into master Oct 28, 2026
23 of 24 checks passed
transfix added a commit that referenced this pull request Oct 28, 2026
The project version and the cvcpkg recipe family move to 3.7.2. Every recipe is at cvc_revision 1
already, so none restarts.

3.7.2 carries the dynamic plants on the terrain and in a Jolt world, and the four-wheel plant
(#869): --plant dynamic and dynamic4w drive the ground, collide with the
buildings and each other, and book the collisions. It also carries dyn_4w's port-Hamiltonian form
(#850), dyn_bike's wheel-frame front slip (#852), the books goldens for GRL-SNAM's twins (#848,
#849), pycvc's drive telemetry (#857) and keep-alives (#864), the macOS SDK's openssl (#846), and
the state_exec scheduler and evaluator work (#842, #843, #844, #861, #863).
@transfix
transfix deleted the feat/dyn-plants-terrain 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