Skip to content

Ariadne: every plant in a scene world: kinematic, dynamic and dynamic4w beside jolt - #1235

Merged
transfix merged 5 commits into
masterfrom
feat/ariadne-scene-world-plants
Nov 15, 2026
Merged

transfix merged 5 commits into
masterfrom
feat/ariadne-scene-world-plants

Conversation

@transfix

Copy link
Copy Markdown
Owner

A scene world now runs every vehicle plant, not only jolt. Before this, WorldVehicles::spawn refused kinematic, dynamic and dynamic4w ("the dynamic plants step a world of their own", ARIADNE_WORLDS.md §14). This PR runs them in the scene's one physics world, on its clock, against its buildings, using libcvc's existing plants. It is the new L2b row in ARIADNE_WORLDS.md.

Stacked on #1233 (entity intents). Until that merges, this diff includes its commit. I'll rebase onto master once #1233 is in.

The plants

plant: Runs as Its body in the scene's world
jolt nav_plant, as before the Jolt vehicle
dynamic (dynamic:<preset>) dyn_bike_plant its chassis box; the world's contacts go back into the model
dynamic4w (dynamic4w:<preset>) dyn_4w_plant as dynamic's
kinematic nav's bicycle a kinematic box, moved along the bicycle's tick a step at a time; it pushes what it meets
  • One fleet per plant. A sim_world drives a single plant, so WorldVehicles keeps a navigator and plant per plant kind, made when the first entity on it is placed. All fleets share one grid and one tick, and every body is in the same world, so they meet each other.

  • The dynamic plants on a host's clock. dyn_bike_plant_options::step_world and dyn_4w_plant_options::step_world (default true, unchanged) can be turned off:

    • the host steps the world itself and calls before_world_step() / after_world_step() around each step, one substep each;
    • advance() then ends the tick those steps ran and begins the next.

    To do that, advance() was split, mechanically, at its world step. New tests show that a hosted plant runs bit for bit as one stepping its own world, into a wall and with wheel spin. Compliant contact (contact) steps in pieces of its own, so it can't be hosted, and the constructor refuses that combination.

  • Also added to the plants:

    • add_desc on both dyn plants, as nav_plant has;
    • world_gone(). SceneWorld::restart rebuilds the world in place and re-adds the scene's bodies under the same ids. Without this, the old plant's destructor would have removed scene bodies (the crate, the wall) through the old box ids. A test pins it.
  • A smooth ground. WorldVehicles now gives every plant the grid bilinear between its corner samples, where it used to give the nearest sample. dyn_4w_plant takes the slope under each wheel from differences about 3 mm apart, so the old stepped ground stopped a Humvee dead at the first cell edge on a hill. That is how I found it.

  • dynamic:<preset> / dynamic4w:<preset> in plant: name the vehicle, as plant_host's names do. A different vehicle: preset is an error.

What you see

  • physics.stats.vehicles names each line's plant. The dynamic plants report their books' power and energy, an odometer, and throttle and brake as shares of the command.
  • WorldVehicles::wheels(id) gives each wheel in the chassis box's frame:
    • Jolt: on its suspension, from its contact;
    • dynamic4w: on the ground under it, Ackermann-steered;
    • dynamic and kinematic: on the ground under it, steered.
  • cvcGL's pose_vehicle_wheels poses a box look's four wheels from that every frame, through setPoseMatrix (change-detected, published, no vertex rewrite). A mesh look keeps its own wheels.
  • pycvc's WorldEntities.list() gains plant.

Tests

Linux Release, GCC 13, Jolt:

  • ariadne_scene_world_test, three new tests:

    • all four plants drive with nav@1 on a hill, each a body in the world, with books where they keep them; the four-wheeler's wheels are steered and on the ground;
    • Jolt and both dynamic plants stop at a wall at 2.5 m/s², and the kinematic one pushes a crate;
    • a restart with every plant keeps the scene's bodies, and an intent-driven run replays to the same state hash.

    The kinematic walker in SpawnsAndRemovesFromTheKeys now spawns.

  • cvcgl_ariadne_physics, test_every_plant_headless_and_drawn: all four plants reach the same state_hash headless and drawn, and the drawn four-wheeler's wheel node sits where its plant has it.

  • physics_dyn_bike_plant_test and physics_dyn_4w_plant_test: AHostThatStepsTheWorldRunsItTheSame (bit for bit), plus their existing tests.

  • pycvc_world_entities: a dynamic4w spawned and driven from Python.

  • A full build, then the related ctest set ([Aa]riadne|[Nn]av|pycvc_world|pycvc_ari|pycvc_plant|cvcgl_ariadne|SceneWorld|[Pp]hysics|[Pp]lant|[Ww]orld[Rr]ules|arisrv|arigl): 1,211 of 1,213 passed. The other two are ariadne_runtime_test, which does not compile on master since No singletons: libcvc's process-wide state per app, per object or gone [4.0, breaking] #1203; Build again after #1203: cmd_trace and the rich-text tests take their app #1225 fixes it.

The writable-data scan adds nothing. clang-format 18 is clean on changed lines.

Docs

  • ARIADNE.md: Plants (a table), the publish keys, and Drawing.
  • ARIADNE_WORLDS.md §14: the as-built plants note and the L2b row.

Overlap: #1170 (the gym) adds the same add_desc and its own WorldVehicles::after_step. Whichever merges second takes the other's.

…orld vehicle

A world entity takes an intent from outside its navigator: a wanted steer and
acceleration that replaces or blends with its controller's command, an external
planar force on its drive (cvc::nav::ext_force), or both. The new external
controller is driven by its intent alone.

- Keys entities.<id>.intent.{mode,steer,accel,weight} and .force.{x,y,steer},
  read at each navigator tick; world: vehicles: intents: names a second table
  (a relay's published namespace) read by id or name.
- WorldVehicles::set_intent / clear_intent / intent, callable from any thread.
- sim_world::override_command takes a blend weight on a plant.
- pycvc.WorldEntities (AriApp.entities(), pycvc.world_entities over a GL
  host's runtime capsule, pycvc.ari.Host.entities): list, spawn, despawn and
  set intents. AppRuntime::running_world finds an adapter's world too.
- entities.<id>.command.{steer,accel,by} publish what the plant took.
…4w beside jolt

A scene world runs each vehicle plant in its one physics world, on its clock,
against its buildings, with libcvc's existing plants:

- WorldVehicles keeps a fleet (a sim_world and its plant) per plant kind on
  the world's grid and tick; kinematic entities get a kinematic box.
- dyn_bike_plant / dyn_4w_plant: step_world = false lets a host step the
  world, with before_world_step / after_world_step around each step (advance()
  split at its world step; a hosted run is bit for bit the plant's own);
  add_desc; world_gone for a world rebuilt in place.
- The plants' ground is the grid bilinear, not its nearest sample (the
  four-wheel model's grade force stalled on the old steps).
- plant: dynamic:<preset> / dynamic4w:<preset>.
- physics.stats.vehicles names each plant; WorldVehicles::wheels and cvcGL's
  pose_vehicle_wheels pose a box look's wheels where the plant has them.
@transfix
transfix enabled auto-merge (squash) November 14, 2026 19:32
…world-plants

# Conflicts:
#	bindings/pycvc/pycvc_ariadne.i
#	bindings/pycvc/test_pycvc_world_entities.py
#	docs/ARIADNE.md
#	docs/roadmap/ARIADNE_WORLDS.md
#	inc/cvc/ariadne/world_vehicles.h
#	src/cvc/ariadne/world_vehicles.cpp
#	src/cvc/tests/ariadne_scene_world_test.cpp
#	src/cvcGL/test/cvcgl_ariadne_physics.cpp
@transfix
transfix merged commit 83abf17 into master Nov 15, 2026
49 of 50 checks passed
@transfix
transfix deleted the feat/ariadne-scene-world-plants branch November 15, 2026 16:03
transfix added a commit that referenced this pull request Nov 15, 2026
Master's #1235 runs every plant in a scene world's one physics world (fleets per plant; dynamic
chassis boxes and kinematic boxes as bodies there; wheel poses). The gym's own plant groups (the
dynamic models in a world of their own, the bicycle with no body, the markers that drew it) give
way to it. Kept from L4 on master's fleets: a spawn's own plant (entity_spec::plant,
vehicles.spawn.plant), the gym's API (reseed, set_wander, command, set_goal, tick_seconds,
steps_per_tick, grid) and its per-tick command, the velocity, steer, goal and reach in
entity_info, contacts counted from the world's events (a kinematic box's obstacles by its grid
footprint, two kinematic boxes by overlap), the terrain's own heights under the vehicles, and
world_reset with the new ground bodies.
transfix added a commit that referenced this pull request Nov 16, 2026
…#1253, #1255, #1256, #1264, #1268, #1271, #1273, #1277)

- ci.yml: the sanitizer list keeps this branch's tests (stream_test, net_ws_client_test,
  ariadne_host_test) and master's segmentation_intrinsics_test.
- STATE_EXEC_THREADED.md: the room-call verbs (room-run is #1273's) and #1252's segment.seeded
  provider in the provider table, both registered without a kind. room-call's async functions
  stay on the app's host: a reply settles on the relay client's reader thread through
  host.finish, so moving them to *ictx.host needs a finisher first.
transfix added a commit that referenced this pull request Nov 22, 2026
…#1449)

* Fleets: placing and removing vehicles is linear; fleet lookups build no strings

Loading a fleet took about twice as long as at FL1a: 88 ms for 800 kinematic
vehicles, 500 for 2000. Two causes:

- Placing a kinematic vehicle recomputed its fleet's per-vehicle kinematics
  (kinematics()), which walks every entity with two fleet lookups each. So n
  vehicles took n^2 lookups (since #1235). Removing one did the same, so
  teardown, a restart or reseed, and a navigator rebuilt were quadratic too.
- FL1b (#1403) gave a named fleet its own navigator, keyed "<plant>/<fleet>",
  and fleet_of() built that key on every call, which doubled each lookup.

The fix:

- A fleet's kinematics are marked stale when a vehicle comes or goes, and made
  once before its navigator next steps. Only the step reads them.
- The fleets are searched by the key's parts (nav_ref, through a transparent
  comparator), so fleet_of() builds no string.

FleetBench's [fleet doc] rows also time a reseed, with the tick after it.
Medians of three runs, alternating with the code before the fix:

- load, 800 vehicles: 105 to 117 ms before, 20 now;
- load, 2000 vehicles: 640 to 755 ms before, 40 now;
- reseed with summary keys: 228 to 28 ms at 800, 1.6 s to 118 ms at 2000.

Ticks didn't change beyond the noise. The roadmap's §3.1 has the numbers.

* Fleets: a step without contacts looks no vehicle up; a summary fleet's stats are one line

At 2000 kinematic vehicles with summary keys a tick took 23 % longer than at FL1a (43.9 ms
against 35.6), more than the seventh physics step (OW1's 120 Hz) accounts for. Timing each
phase, with FL1a's code and this branch's run alternately, it was 35.5 against 40.5 ms: 14 %,
the rest a busier day. Of the 5.0 ms:

- A step is more than its physics: it also counts the step's contacts and moves the kinematic
  boxes, at 2000 vehicles about half the physics again. At FL1a's costs a step, the seventh is
  2.3 ms.
- count_contacts() looked up every vehicle (a map of their chassis) before it read the step's
  contacts, and its lookups cost more since FL1b: 0.52 ms a step at FL1a, 0.69 now. A
  kinematic fleet's boxes meet nothing, so there were none to count.
- The navigator's tick took 0.9 ms more (the same lookups in its loops), and FL1d's pose
  snapshot 0.25.

The fixes:

- A step with no contacts that count looks nothing up.
- physics.stats.vehicles gives a summary fleet's quiet vehicles one line, as entities.summary
  does, not a line each built from info() every tick (3.3 ms at 2000 vehicles).

Alternating with the code before: 31.8 ms a tick at 2000 vehicles (40.5 before) and 9.5 at 800
(12.4), under FL1a's 35.5 and 10.9 with the seventh step. The roadmap's 3.1 has the numbers.
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