Skip to content

pycvc: the dynamic single-track plant (dyn_bike_plant) as a sim_world's plant - #979

Merged
transfix merged 1 commit into
masterfrom
feat/pycvc-dyn-bike-plant
Nov 2, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/pycvc-dyn-bike-plant

Conversation

@transfix

@transfix transfix commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

What

pycvc.dyn_bike_plant wraps cvc::physics::dyn_bike_plant, the dynamic single-track vehicle (tires, load transfer, actuator lag) as a sim_world's plant. nav_sim_world_set_plant now takes it as well as a nav_plant.

plant = pycvc.dyn_bike_plant([pycvc.vehicle_desc.humvee()], mu=0.7)       # no world: nothing collides
plant = pycvc.dyn_bike_plant(descs, world=w, ground_bodies=[ground])        # chassis collide in w
pycvc.nav_sim_world_set_plant(sim, plant)
plant.books(0), plant.last_tick(0), plant.kinetic_at_attach(0), plant.body(0), plant.state(0)
  • Constructor (keywords): mu, substep, drive_lag, driver, latency, brake_margin, metres_per_world_unit, ground_z, chassis_friction.
  • Readers:
    • kind() is "dynamic".
    • state(i) is nav's view, including tire_use.
    • body(i) is the model's SI state: x, y, psi, vx, vy, r, delta, a.
    • books(i) and last_tick(i) are the books, with flow.
    • With a world: chassis(i), collisions(i), collisions_tick(i) and vehicle_contact_step(i).
    • options().
  • Lifetimes: the plant keeps its world alive, and the sim_world handle keeps the plant alive while it is set, as with nav_plant.

Why

GRL-SNAM's grl-snam capture now offers the dynamic plant beside nav's bicycle and Jolt, with the books on its HUD. pycvc had no way to put a sim_world on it. CVC-Lab/GRL-SNAM#143 uses this binding and skips the dynamic plant on a pycvc without it.

plant_host is not bound here. It builds its own world (flat ground, or a cvc::world geometry), whereas GRL-SNAM builds a Jolt world holding the scene's buildings as boxes. Binding dyn_bike_plant directly lets a caller hand it that world.

Tests

test_pycvc_physics.py's new test_the_dynamic_plant checks:

  • The agent drives the Humvee's dynamic bicycle to its goal 40 m east.
  • Its books close to 1e-9 of the flow, and the integrator's residual stays under 5e-3 of it.
  • The plant outlives its Python names while set.
  • Given a world with a wall the navigator's map lacks, the chassis hits the wall, books the contact and stops short of it.

Local run: Windows, MSVC 14.44 Release, Jolt on, pycvc built with CVC_BUILD_PYCVC=ON. test_pycvc_physics.py passed 57 checks; without CVC_PHYSICS_PARITY_EXE the C++ parity comparison was skipped.

…'s plant

pycvc.dyn_bike_plant(descs, world=None, ground_bodies=None, mu=0.9, ...) wraps
cvc::physics::dyn_bike_plant, and nav_sim_world_set_plant takes it as it takes a
nav_plant. Python reads its state, its model state (body: x, y, psi, vx, vy, r,
delta, a), its books since attach and over the last tick (with flow), the
kinetic energy at attach, and with a world its chassis, collisions and the agent
it touched. Given a physics_world, the plant keeps it alive.

test_pycvc_physics.py's test_the_dynamic_plant: an agent drives the Humvee's
dynamic bicycle to its goal and its books close to 1e-9 of the flow; the plant
outlives its Python names while set; and with a world the chassis hits a wall
nav's map lacks, books the contact and stops short of it.
transfix added a commit to CVC-Lab/GRL-SNAM that referenced this pull request Nov 2, 2026
…very demo, training through Jolt (#143)

grl-snam capture drive|multigoal --plant point|kinematic|dynamic|jolt: point is
today's Python surrogate; the others drive the same policy on libcvc's
sim_world (plant_nav.PlantNavigator) on nav's bicycle, the dynamic single track
(nav_native.DynamicPlant over pycvc.dyn_bike_plant, transfix/libcvc#979) or a
Jolt vehicle, with --vehicle, --mu, --routes, --fog, --weights and --reach-m.
On a plant the run is kept whole and played by the clock with a trail, the HUD
adds the sideslip, tire use, lateral g and energy books, and <out>.json records
how each leg ended. --caption draws a line along the bottom.

The plant elsewhere: pipeline --plant; finale --plant and --max-steps;
record_squad / record_convoy / record_pursuit_v2 plant=; squad_bench and
drive_bench --plant; sim_world_from_swarm takes a plant name and clamps the
navigator to the vehicle's limits. Squad gains goal_of / reached_of, and its
native records measure the distance to a moving goal where it is.

Training through Jolt: coef-train --backend native --rollout jolt (--vehicle,
--w-energy), nav_native.train_coef_mlp_jolt (keywords, the vehicle's own
wheelbase and limits by default) and train_coef_mlp(rollout="jolt").

Fixes: capture, build-sdf and obstacles read the bundle's bounds from
terrain.json (pycvc_gl.scenes retired terrain_grid, libcvc #670); render_drive
emptied its frames with `rm` through os.system, which did nothing on Windows,
and shared one frames directory between videos.

docs/PLANTS.md runs every demo and bench on a plant and trains through Jolt;
every command in it was run. tests/test_plant_capture.py covers the CLI, the
names, the HUD, the run summary, and with the bindings each plant, low grip,
a squad on the dynamic plant and record_squad on Jolt.
@transfix
transfix merged commit 781b9a2 into master Nov 2, 2026
25 of 28 checks passed
@transfix
transfix deleted the feat/pycvc-dyn-bike-plant branch November 2, 2026 23:21
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