Repository navigation
pycvc_gl.cars: a template for your own multi-car controller (any plant, Austin / generated / flat worlds, panels, headless) - #1035
Merged
Conversation
…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.
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Nov 6, 2026
…ator baseline The template moved to libcvc as pycvc_gl.cars (transfix/libcvc#1035, on #1031's bindings): general rather than GRL-SNAM specific, with the plant and the navigator's settings in the document's state tree, Austin from the data: block by default, the terrain generator as an alternative, rasters and coefficient panels, and the same run headless. GRL-SNAM keeps a thin entry: grl-snam ariadne cars runs it (or --copy), and --grl-policy gives libcvc's navigator the published grl-snam-weights policy, exported to .cvcnav and run in its trained frame (--nav-scale). With a pycvc_gl before 3.7.12 the entry says what to install. grl_snam/cars.py and the template copy are gone. The README, the quickstart, PLANTS.md and grl_snam/ariadne/README.md link to libcvc's docs/CARS.md. tests/test_ariadne_cars.py: 5 tests (the entry, its message without the template, a headless run, --copy, the navigator on GRL-SNAM's policy).
# Conflicts: # bindings/pycvc/README.md
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Nov 7, 2026
… GRL-SNAM's policy as a baseline (#155) * Ariadne: a cars template for your own multi-car controller, on kinematic or Jolt physics grl-snam ariadne cars runs N Ackermann cars that a controller of the user's own drives: controller(s, p) at the top of a copyable cars.py gets every car's state (pose, speed, wheel angle, goal, range rays, collisions, limits) as numpy arrays each tick and returns (steer, accel) per car, bypassing the navigator. --copy DIR writes cars.py and cars.ari to edit. The document's sliders feed the controller's parameters (ctl.*), New goals / Reset call back into Python, and the panels show a row per car and two plots. --headless --frames N --log run.npz|csv runs without GL and records every tick's states and commands. grl_snam.cars is the library under it: plants kinematic (nav's bicycle), jolt (roboracer, humvee, or a comma list cycled over the cars) and dynamic; worlds flat, blocks (scaled to the cars) and austin. With a pycvc that has nav_sim_world_override (transfix/libcvc#1031) every plant runs in libcvc's sim_world with the command in its navigator's place; with an older pycvc, kinematic runs the same bicycle in numpy and jolt drives physics_world.drive (no reverse). navigator=True runs libcvc's navigator as a baseline. The README, the quickstart and PLANTS.md link the Ariadne ports and the template; grl_snam/ariadne/README.md gains a 'Write your own multi-car controller' section: the state, the panels, why the plant is the host's choice and not the document's, what kinematic vs Jolt means for a controller (steering rate, the driver model, tire slip, measured), and batch runs. tests/test_cars.py: 23 tests (3 need the override binding and skip without it; none needs torch). * cars: Austin with its aerial image, loaded once through the document's data store --world austin drew the city with load_geometry_bundle, which paints the terrain one colour, so the aerial image never showed. cars.ari now has the city node live.ari has (source: data city, shown only on the Austin world), and cars.py loads Austin into the data store at data.city: an installed bundle when there is one, else scene-austin-south-small from cvcpkg.org, downloaded once and cached. The terrain is drawn with satellite.png draped, and grl_snam.cars builds its occupancy and terrain from the same loaded objects (austin_world(city=...)), so the bundle is read once. A headless test runs the port on Austin when a bundle is installed. * cars: run libcvc's multi-car template; GRL-SNAM's policy as the navigator baseline The template moved to libcvc as pycvc_gl.cars (transfix/libcvc#1035, on #1031's bindings): general rather than GRL-SNAM specific, with the plant and the navigator's settings in the document's state tree, Austin from the data: block by default, the terrain generator as an alternative, rasters and coefficient panels, and the same run headless. GRL-SNAM keeps a thin entry: grl-snam ariadne cars runs it (or --copy), and --grl-policy gives libcvc's navigator the published grl-snam-weights policy, exported to .cvcnav and run in its trained frame (--nav-scale). With a pycvc_gl before 3.7.12 the entry says what to install. grl_snam/cars.py and the template copy are gone. The README, the quickstart, PLANTS.md and grl_snam/ariadne/README.md link to libcvc's docs/CARS.md. tests/test_ariadne_cars.py: 5 tests (the entry, its message without the template, a headless run, --copy, the navigator on GRL-SNAM's policy).
This was referenced Nov 7, 2026
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1031 (base
feat/pycvc-nav-override). It needs that PR's bindings, so retarget it to master after #1031 merges.Why
The lab's researchers want to test their own multi-car controllers in Python. The goal is general, not tied to one navigator:
data:block;What
pycvc_gl.carsis a library, plus a template to copy.python -m pycvc_gl.cars --copy DIRwritescars.py(a controller and its parameters) andcars.ari(the panels).Your controller.
controller(s, p)gets every car's state each tick, as numpy arrays in SI units:It returns
(steer, accel)per car, which each car's plant takes in the navigator's place (nav_sim_world_override). An optional third value,{"coeffs": ...}, is plotted and logged.cost(s, p, i, X, Y)is drawn as a raster.The world (
run.world). Each world gives the cars the same occupancy, terrain height and collision geometry, so a controller can't tell them apart.data, the default: the document'sdata:block,cvcpkg://cy-pca/scene-austin-south-small(lazy). Run's URI field or--uriloads another package or a local bundle.generated:pycvc.generate_worldfrom the World window'sworld.*keys, with Regenerate. Python generates the world for the cars, the navigator and Jolt, and the scene'sgenerated_worldnode draws the same world.flat: a flat square.The plant:
nav_plant.vehicle(plant_host):kinematic,humvee,roboracer, a comma list,dynamic[:presets]ordynamic4w. It switches live, the cars keeping their poses. Jolt collides with the world's own terrain and buildings.Settings: libcvc's own keys (
nav.*,nav.vehicle.*,nav_plant.*), with their units and ranges.init:, on sliders (the Settings window), with--set/--params, or from Python.settings()lists them.Panels:
alpha/beta/gamma/lam_*/potential/clearance;rollout(): your controller on nav's bicycle), goal and the other cars; and your cost, or the navigator's belief.Headless:
--headless --frames N --log run.npz. Exit 1 when the controller raises; exit 3 when--min-arrivalsis unmet. The log holds:--raster-everyticks;meta: the world's source or the generator's parameters, the seed, and every setting's value.Navigator baseline:
--controller navigator, with--nav-weightsfor a.cvcnavpolicy. GRL-SNAM can pass its trained one.Packaging and docs:
*.arifiles beside its modules, forcars.ari.docs/CARS.mdis the guide. Its settings table is generated from the keys' own metadata, and it says what kinematic vs Jolt vs dynamic means for a controller, with measured steering lag and slip.README.md,ARIADNE.md§9.3 and the pycvc README link to it.A cvcGL limitation found (not fixed here)
A scene node's
visible:hides that node's own actor only (SceneNode::setVisible). What asource: { data }node drew as children, and agenerated_worldnode's meshes beside it, stay on screen. Yet ARIADNE.md says a node hidden withvisible:"is gone from every view".The template works around it: it clears
data.cityby pointing it at a dataset with nothing to draw, and hidesgen_*by name. A real fix would make visibility hide a subtree, and havegenerated_world's parts follow their node. That's a separate change.Tests (local: Windows, MSVC 14.44, Jolt on, with #1031)
test_pycvc_gl_cars.py: 39 checks pass, headless.vmaxcaps the speed, andsettings()reports units and ranges.rollout,local_rasterandCarsLog(npz and csv).--uri;--copy.By hand: