Skip to content

pycvc_gl.cars.HostCars: the cars template's cars in a host's own world - #1341

Merged
transfix merged 2 commits into
masterfrom
feat/host-cars
Nov 18, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/host-cars

Conversation

@transfix

Copy link
Copy Markdown
Owner

Track 3 of the local-world gaps, first part: the cars template can run its cars in the world a host's own document runs. The grl-snam ports will be rebuilt on this.

Why

The cars template ran its cars in one of two places. One was worlds of its own, built by cars.py's builders. The other, with --gym, was headless inside pycvc.WorldGym's own app, which a drawn host can't show. So a drawn demo couldn't use the world runtime.

Change

  • pycvc_gl.cars.HostCars runs the cars in the host's own world, so a drawn host shows them as that document draws its world. It has the interface Cars and GymCars have: state, step, step_navigator, new_goals, reset, world.
    • A controller's (steer, accel) goes to each car as its intent: a replace command, kept until the next call. A NaN leaves that car to nav@1.
    • step_navigator clears the intents.
    • The rays are cast on the world's grid.
  • pycvc.WorldEntities gains what HostCars needs: set_goal(id, x, y), set_wander(on), and grid() (in pycvc.WorldGym.grid's format). Each list() entry also carries the entity's velocity, steering, goal, reach, reached, collided, and its body (length, width, wheelbase, limits).
  • ARIADNE.md and the cars.py module docs describe them.

Tests

  • test_pycvc_gl_host_cars (11 checks):
    • Four cars spawn in a headless host's world, and the state comes back as a CarsState with rays.
    • nav@1 drives them toward their goals.
    • The controller's command takes over (a hard brake stops them and backs them up), and a NaN hands them back to nav@1.
    • New goals and reset work.
  • test_pycvc_world_entities (38 checks) and test_pycvc_gl_cars (67 checks) still pass, on a Windows Release build.

Not yet

  • The template's command line still defaults to its own worlds, and --gym is still headless only. Switching the template's default onto world documents comes with the demo rebuilds, where each port moves to HostCars or GymCars.

The cars template ran its cars on worlds of its own (cars.py's builders)
or, with --gym, headless in pycvc.WorldGym's own app, which a drawn host
cannot show. HostCars runs them in the world the host's own document
runs, so a drawn host shows them as that document draws its world, with
the interface Cars and GymCars have (state, step, step_navigator,
new_goals, reset, world): a controller's (steer, accel) goes to each car
as its intent (a replace command until the next call; a NaN leaves the
car to nav@1), step_navigator clears them, and the rays are cast on the
world's grid.

pycvc.WorldEntities gains what that needs: set_goal(id, x, y),
set_wander(on), grid() (as pycvc.WorldGym.grid gives it), and in each
list() entry the entity's velocity, steering, goal, reach, reached,
collided and its body (length, width, wheelbase and its limits).

Test: test_pycvc_gl_host_cars (four cars spawned in a headless host's
world, a CarsState with rays, nav@1 drives them toward their goals, the
controller's command takes over and a NaN gives them back, new goals,
reset); test_pycvc_world_entities and test_pycvc_gl_cars still pass.
The boat node's tests (AriadneBoatNode.FloatsSteersFromItsKeysAndNavTakesItToItsGoal and
NavTakesTerrainLabsLaunchAcrossTheLake) took 156 and 77 s in master's Debug package job before
#1318's inertial fluid, and ran past ctest's 300 s in #1335's, which builds on it; the crate
drifting in the scene's wind timed out once there too. The binary's tests get 900 s, as the
segmentation action test has.

(cherry picked from commit dc5fff6)
@transfix
transfix merged commit f69fbc2 into master Nov 18, 2026
55 of 57 checks passed
@transfix
transfix deleted the feat/host-cars branch November 18, 2026 05:49
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