Repository navigation
pycvc: nav_sim_world_override, set_pose, plant_host and generate_world (your own commands, any plant, any world) - #1031
Merged
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).
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).
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.
Why
The lab's researchers want to drive N Ackermann cars in Python with a controller of their own. They want it on any plant and any world, with the plant and the navigator's settings chosen from an Ariadne document. libcvc already has the pieces:
sim_world::override_commandreplaces the navigator's command for one step;plant_hostswitches the plant by name, in code or from the state tree;generate_worldis terrain_lab's world.pycvc reached none of them. This PR binds them. The template built on them is the PR stacked on this branch:
pycvc_gl.cars.What
Bindings only: no C++ change.
pycvc.nav_sim_world_override(sim, steer, accel)pycvc.nav_sim_world_set_pose(sim, i, x, y, heading, speed=0)bindssim_world::set_pose.pycvc.plant_host(...)bindscvc::physics::plant_host.use(sim, name)takes a name:kinematic,humvee,roboracer, a comma list,dynamic[:presets]ordynamic4w[:presets].pull(app, prefix, sim)reads<prefix>.nav_plant.vehiclelive, along with the plant's own knobs.set_geometry(world_geometry)takes a city's or a generated world's colliders, and starts the vehicles on its terrain.This sets
plant_host_options::plant.ground_height, which nothing set before. Given a city with relief, vehicles spawned atground_z, under the terrain.kind,driving,limits(i),state(i),vehicle_state(i)andbody(i)read the plant.Lifetime: the host holds the sim_world it drives, and puts it back on the bicycle before it goes.
pycvc.generate_world(params, building_library="")bindscvc::world::generate_world.paramsis a dict, by thegenerated_worldnode'sworld.*key names or the struct's.It returns
.world()(theworld_geometryfor physics and nav),.terrain(),.height(x, y)and.info().It is a pure function of its params, so the same keys give the scene node's world.
Timing: 0.05 s for a 300 m world, 0.15 s at the 600 m default.
Tests (local: Windows, MSVC 14.44, Jolt on)
test_pycvc_nav_override.py: 17 checks pass.kinematic_steprun in numpy, to 1e-5.set_poseworks.test_pycvc_plant_host.py: 24 checks pass.check().The existing
test_pycvc_gl_ariadne_host.pypasses.