Skip to content

pycvc_gl.cars: the template's panels and run pieces for other hosts; Humvees drawn as Humvees - #1040

Merged
transfix merged 7 commits into
masterfrom
feat/pycvc-gl-cars-pieces
Nov 7, 2026
Merged

transfix merged 7 commits into
masterfrom
feat/pycvc-gl-cars-pieces

Conversation

@transfix

@transfix transfix commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Why

GRL-SNAM's Ariadne ports (fleet, live) now take the multi-car template's settings, worlds, plants, panels and headless log (#1035). They reuse the template's pieces rather than copying them, so this makes those pieces importable.

Joe also asked why the template drew boxes rather than the Humvee model. The Austin package it loads carries Humvee.glb, so the template now draws with it.

What

  • The panels become units in pymod_gl/cars_panels.ari, which cars.ari imports by cvc://cars_panels.ari:

    • cars_settings (window): the navigator, vehicle and plant knobs;
    • cars_world (window): the generator's parameters;
    • cars_world_choice (group): the World combo, the city's URI and Load;
    • cars_coefficients (group): the four coefficient plots;
    • cars_rasters (window): the two pictures; arg cost is the second one's caption.

    pycvc_gl.cars.COMPONENTS is the directory a host passes as a component path. run() passes it, and so do GRL-SNAM's ports.

  • The run's pieces become functions:

    • add_args(parser): --world, --uri, --data-path, --set, --params, --log, --raster-every, --min-arrivals;
    • apply_settings(host, args, flags): --params, then --set, then flags, then --world; then --uri points data.city there;
    • state_from(world, x, y, heading, speed, goal, ...): a CarsState for cars a host steps some other way, with the ranges and contacts worked out on the world, so CarsLog, the pictures and the panels take them;
    • raster_arrays(...), where a belief may now be a probability (an agent that has not seen everything), and raster_pictures(...);
    • plot_coefficients(...), chosen(host, n), raster_size(host, length);
    • save_log(log, host, path, **meta): every setting and the world.* keys in its meta;
    • exit_code(code, error=, arrivals=, min_arrivals=): 0, 1 or 3.

    make_world takes cell=, and Cars takes starts= and goals=. run() is built from these pieces and behaves as before.

  • Humvees are drawn as Humvees:

    • A Humvee, or a car on nav's bicycle (which has a Humvee's body), draws with the Humvee's glTF model and a tag in its colour above it.
    • The model is an installed vehicle-humvee's, else the Austin package's: from the city, or, with another world in use, asked for once as data.vehicles (from the data cache after the first download).
    • A RoboRacer, or any car before the model arrives, stays a box its size.
  • Docs. docs/CARS.md gets a new section, "Your own host", and a note on the scene. Its known-limits note on visible: now says cvcGL: a hidden scene node hides its whole subtree, and generated_world's parts follow it #1037 fixed it; show_world()'s workaround stays and is harmless.

Tests

  • test_pycvc_gl_cars goes from 39 to 52 checks. The new ones:
    • cars.ari loads with its panels from cars_panels.ari (no import or unit warnings);
    • state_from, and CarsLog taking it;
    • raster_arrays (a probability belief stays one) and raster_pictures;
    • plot_coefficients;
    • Cars(starts, goals);
    • add_args with apply_settings (--set over --params);
    • save_log's meta and exit_code.
  • Windows: it passes against a local build with pycvc: nav_sim_world_override, set_pose, plant_host and generate_world (your own commands, any plant, any world) #1031's bindings.
  • Rendered offscreen: the panels look as before, and the Humvee model draws on Austin. In a generated world the model arrives through data.vehicles in 0.4 s from the cache.
  • GRL-SNAM's fleet and live run on these pieces; their port tests (27, plus the nav and squad suites) pass against this branch.

GRL-SNAM's branch feat/ariadne-ports-settings needs this and #1035 (merged) in a release (3.7.12).

…mmands on any plant

sim_world::override_command takes a caller's (steer, accel) for one step in the
navigator's place, on nav's bicycle and on a plant (Jolt's nav_plant, the dynamic
vehicle). pycvc had no way to reach it, so a Python controller could not drive the
agents itself. nav_sim_world_override(sim, steer, accel) takes (N,) arrays (NaN leaves
that agent to the navigator) and returns how many took a command.
nav_sim_world_set_pose(sim, i, x, y, heading, speed=0) binds sim_world::set_pose, so
agents can start at chosen headings before a plant attaches at their poses.

test_pycvc_nav_override.py checks the overridden bicycle against libcvc's
kinematic_step in numpy to float precision, NaN pass-through, one-step scope, the lock
and top-speed holds, malformed arrays, set_pose, and a Jolt Humvee attached at a set
pose driving straight then turning left on a positive steer.
pycvc.plant_host binds cvc::physics::plant_host: the plant a sim_world drives on,
chosen by name (kinematic, humvee, roboracer, a comma list, dynamic[:presets],
dynamic4w[:presets]), in code (use) or live from the state tree (pull reads
<prefix>.nav_plant.vehicle and the plant's own knobs). set_geometry takes a
world_geometry (a city bundle's data_world, a generated world) as the colliders and
starts the vehicles on its terrain (plant_host_options' ground_height, which nothing set
before, so vehicles spawned at ground_z under a city's relief). kind, driving, limits,
state, vehicle_state and body read the active plant. The host holds the sim_world it
drives and puts it back on the bicycle before it goes.

pycvc.generate_world binds cvc::world::generate_world on a dict of its params (the
generated_world node's world.* key names or the struct's) and an optional building
library: world() for physics and nav, terrain(), height(), info(). It is a pure
function of its params, so Python gets the scene node's world from the same keys.

test_pycvc_plant_host.py: 24 checks (generator determinism and errors; the presets;
Jolt Humvees and their limits; a Humvee started on a generated world's terrain and
driven by an override; a live switch from the state tree to RoboRacers, an unknown name
ignored, back to the bicycle and on to the dynamic plant; both lifetimes).
…iadne document

python -m pycvc_gl.cars --copy DIR writes cars.py and cars.ari: controller(s, p) gets
every car's state as numpy arrays each tick and returns (steer, accel) per car, which
each car's plant takes in the navigator's place (nav_sim_world_override).

- The world: the document's data: block (scene-austin-south-small from cvcpkg.org by
  default; Run's URI or --uri loads another package or a local bundle), libcvc's
  terrain generator (the World window's world.* keys, Regenerate; Python generates the
  world for the cars, the navigator and the physics, the scene's generated_world node
  draws the same one), or a flat square. Each gives the same occupancy, terrain height
  and collision geometry.
- The plant: nav_plant.vehicle (plant_host): kinematic, humvee, roboracer, a comma
  list, dynamic[:presets], dynamic4w; it switches live, the cars keeping their poses.
- Settings: libcvc's own keys (nav.*, nav.vehicle.*, nav_plant.*), set in init:,
  bound to sliders, --set / --params, or from Python; settings() lists them with their
  units and ranges.
- Panels: readouts, a row per car, speed and gap plots, four coefficient plots (the
  controller's info or the navigator's telemetry: alpha, beta, gamma, ...), and rasters
  around the chosen car (signed distance with the predicted path, the controller's
  cost or the navigator's belief).
- Headless: --headless --frames N --log run.npz (states, commands, coefficients, rasters,
  predicted paths, and the world, seed and every setting in meta); exit 1 when the
  controller raises, 3 when --min-arrivals is unmet.
- Navigator baseline: --controller navigator, and --nav-weights for a .cvcnav policy.

pycvc_gl now ships *.ari files beside its modules. docs/CARS.md describes it (the
settings table generated from the keys' own metadata), linked from README.md,
ARIADNE.md 9.3 and the pycvc README. test_pycvc_gl_cars.py: 39 checks, headless.
A policy is trained in a normalized frame (GRL-SNAM's published one at 1 unit = 300 m);
Cars(scale=...) and --nav-scale build the sim_world in it, so --nav-weights drives in
the frame it expects. The default stays nav's 0.05. The log's meta records it.
…Humvees drawn as Humvees

The panels become units in cars_panels.ari (cars_settings, cars_world, cars_world_choice,
cars_coefficients, cars_rasters), which cars.ari imports by cvc:// with COMPONENTS on the
host's component path. The run's pieces become functions: add_args and apply_settings (the
world, --set, --params and log flags), state_from (a CarsState from a host's own arrays),
raster_arrays (a belief may be a probability), raster_pictures and plot_coefficients,
save_log and exit_code; make_world takes cell=. Cars takes starts= and goals=.

The scene draws each Humvee (and nav's bicycle, Humvee-sized) with the Humvee's glTF model
from the city's package (the Austin package carries Humvee.glb) or an installed
vehicle-humvee, with a tag in the car's colour; a RoboRacer stays a box its size.

docs/CARS.md, "Your own host"; test_pycvc_gl_cars 39 -> 52 checks.
Base automatically changed from feat/pycvc-gl-cars to master November 7, 2026 04:16
…pieces

# Conflicts:
#	bindings/pycvc/pymod_gl/cars.ari
#	bindings/pycvc/pymod_gl/cars.py
#	bindings/pycvc/test_pycvc_gl_cars.py
#	docs/CARS.md
@transfix
transfix merged commit f8f33f7 into master Nov 7, 2026
26 of 28 checks passed
@transfix
transfix deleted the feat/pycvc-gl-cars-pieces branch November 7, 2026 06:25
transfix added a commit that referenced this pull request Nov 7, 2026
Bumps the project version and every recipe's upstream_version from 3.7.11 to 3.7.12. The v3.7.12 tag on this commit is the first release with the multi-car controller template (pycvc_gl.cars, #1031 #1035 #1040), the hidden-subtree fix in cvcGL (#1037), the discrete-gradient dyn_bike step (#978), semi-implicit Euler by default in the nav rollout (#981), the implicit contact damper (#1004, #1038), and generated_world's roads and water (#1032, #1034).
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