Skip to content

Ariadne: entity intents, so a document, a server or a host steers a world vehicle - #1233

Merged
transfix merged 2 commits into
masterfrom
feat/ariadne-entity-intents
Nov 14, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/ariadne-entity-intents

Conversation

@transfix

Copy link
Copy Markdown
Owner

A world entity can now be steered from outside its navigator. Until now WorldVehicles::before_step let only nav@1 command a vehicle, and no document, script, server or C++ caller could add a command or a force. This is the generic hook for that (ARIADNE_WORLDS.md §14, the new L2a row).

What an entity takes

entity_intent (world_vehicles.h) holds a command, a force, or both, and keeps them until they are changed:

  • The command.
    • replace: a steer (rad, + left) and an acceleration (m/s²) in place of the controller's.
    • blend: weight of the intent and 1 - weight of the controller's.
    • off: the controller's alone.
    • It is held to the same lock and top speed as the navigator's own command.
  • The force: a planar push (m/s², world x and y). It is added to the drive's force the way cvc::nav::ext_force adds one, with or without the steering bias.
  • The external controller: an entity driven by its intent alone. With no intent it brakes to a stop and holds.

Where intents come from

  • Its keys: entities.<id>.intent.{mode,steer,accel,weight} and entities.<id>.force.{x,y,steer}.

    • They are read at each navigator tick (20 Hz), and a change replaces the intent.
    • With no mode, a steer or an acceleration means replace.
  • A second table: world: vehicles: intents: <path>, read by id or by name.

    • This is how a server document steers. It publishes the namespace (server: publish: [drive]), the relay replicates it, and its program writes (state-set "drive.lead.intent.accel" "2").
  • C++: WorldVehicles::set_intent, clear_intent and intent, callable from any thread. They are guarded by a mutex and applied at the next tick.

  • Python: pycvc.WorldEntities does list(), spawn(...), despawn(id), set_intent(id, steer=, accel=, mode=, weight=, force=(fx, fy)), intent(id) and clear_intent(id). Three ways to get one:

    • AriApp.entities();
    • pycvc.world_entities(app, capsule), over a GL host's runtime (pycvc_gl.AriRuntime.app_runtime_capsule());
    • pycvc.ari.Host.entities.

    AppRuntime::running_world() finds the world whether the runtime runs it itself or its adapter does (new SceneAdapter::scene_world()), so it works on ariglx too.

What the plant took is published as entities.<id>.command.{steer,accel,by}.

In nav

sim_world::override_command(i, steer, accel, weight = 1).

  • Below 1 it blends with the drive's command on a plant: the drive's share comes first, then the usual holds.
  • The kinematic arm steers each substep, so it has no single command to blend with; a weight below 1 throws there.
  • At the default weight the code path is the same as before.

Tests

Built and run locally (Linux Release, GCC 13, Jolt):

  • ariadne_scene_world_test: 30/30, five of them new.
    • The world block takes intents: and external.
    • An external entity holds still, drives on the setter and on its keys, turns, then stops and holds.
    • A blend is the weighted command on the first tick (0.75 · nav + 0.25 · intent, to 1e-5).
    • A force north moves a nav@1 run north of the plain one. An intent with zero force leaves the state hash unchanged.
    • set_intent from another thread while the world steps.
    • A ServerDocument that publishes drive steers an entity by name.
  • nav_terrain_test: 13/13, with AnOverrideCommandBlendsWithTheDrivesOnAPlant.
  • cvcgl_ariadne_physics, test_vehicle_intents_headless_and_drawn: a run scripted on the keys reaches the same state_hash headless (SceneWorld on its clock) and drawn (realize_scene + tick_scene, as arigl --offscreen steps it). It covers an external entity, a nav@1 one with a force and then a blend.
  • pycvc_world_entities (new): 33 checks.
  • Also passing: pycvc_ariadne, pycvc_nav_override, pycvc_ari, nav_route_follower_test, nav_yield_test, ariadne_server_document_test.
  • The writable-data scan adds nothing (cvc, cvcGL and pycvc objects). clang-format 18 is clean on changed lines.

Not checked locally: ariadne_runtime_test doesn't compile on master since #1203. #1225 fixes it, so the lanes that build it fail here until that lands.

Docs

  • ARIADNE.md: Vehicles gets "Intents" (a table of the keys) and "From Python".
  • ARIADNE_WORLDS.md §14: the as-built note and the L2a row.

The other half of this work, every plant in a scene world (kinematic, dynamic, dynamic4w beside jolt), follows as its own PR.

…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.
@transfix
transfix merged commit c4696d8 into master Nov 14, 2026
28 checks passed
@transfix
transfix deleted the feat/ariadne-entity-intents branch November 14, 2026 21:50
transfix added a commit that referenced this pull request Nov 14, 2026
Master's #1233 (entity intents) conflicts with this branch's plants, where
each plant has its own group and navigator, not one sim. Intents now run per
group: the drive's external force is each group's, sampled by its
navigator's own agent indices. apply_intents overrides each entity's command
on its group's sim and sets or clears each group's ext_force. An external
entity's hold reads its speed from pose(), which every plant has.
before_step reads and applies the intents, then a gym's one-tick command
takes over (command.by "gym"), then each group steps.

entity_info keeps this branch's fields and adds master's command_steer,
command_accel and intent; the entity keeps both sides' members. ARIADNE.md
and the header say each plant's drive has its own force-steering switch.
transfix added a commit that referenced this pull request Nov 15, 2026
Master's #1217 keeps nothing per thread in state_exec: a native's context (call_args::context())
carries its group, registry and stream, async_host::call and begin_external take it, and the pool
drops in_pump_all() and the one-argument run_on_host.

- async_host.h: begin_external takes the context, as on master, and keeps this branch's note that
  a call is finished through the host it was made on.
- script_engine.cpp: the sliced form finds the calling program's group from the call's context
  (exec_group::current(ctx)), else group 0, and reads its data step from the context.
- ariadne.cpp: file-pick opens its picker through run_on_host for the group its verbs were bound
  for (the env's, as its host is), and inline in group 0 and the init lane.
- exec_pool: in_pump_all() is back, for the host-thread calls' debug assertion and
  ScriptLane::run's refusal, read from the pool's calls (their callers' and pumpers' thread ids)
  under its mutex rather than from thread-locals.
- ariadne_runtime_test: the init lane's cycles test no longer compares against the calling
  thread's own registry, which master removed; it is AriadneInit.RunsAScriptThatLeavesCycles.
- ci.yml: the sanitizer's required list names the test by its new name.
- STATE_EXEC_THREADED.md: B29-B31 and the file-pick and sliced-call notes name the context-based
  calls.
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