Repository navigation
Ariadne gym: what a differentiable twin of the world reads (fields, plants) - #1263
Merged
Merged
Conversation
…:fields, WorldGym::plants)
This was referenced Nov 15, 2026
…it replays bit for bit
…in-exports # Conflicts: # src/cvc/physics/dyn_4w_plant.cpp # src/cvc/physics/dyn_bike_plant.cpp # src/cvc/tests/ariadne_scene_world_test.cpp
This was referenced Nov 15, 2026
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 #1170 (base
feat/world-gym), as #1202 was.The gym's world isn't differentiated: Jolt isn't, and neither is the physics world the dynamic plants' chassis collide in. So a trainer has to step a model of the gym and let the gym judge the result. libcvc's P8 did this for the Jolt vehicle. This PR exports what such a twin of the gym's world reads. The torch twin built on it is GRL-SNAM's
grl_snam.gym_twin(separate PR).WorldGym::fields()The world as the agents drive in it now (
gym_fields):occupancy), itsheight, and the ground's gripmu;muis double, as the plants sample it, so a twin's ground matches theirs to the last bit;sdf(WorldVehicles::sdf,cvc::nav::signed_distance), and its gradientsdf_dx,sdf_dy(central differences);navigator_params): nav's scale, its tick, the arrival radius, and its vehicle in normalized units.WorldGym::plants()andWorldVehicles::plants()Each agent's plant as a
cvc::nav::diffmodel in SI (entity_plant), in the observation's order:dynamic4w: the plant's owndyn4_plant, with its parameters, step limits, substeps, ground reference, state and grip.applied_accel).dynamic: the single-track model the same way, with each step's grade (applied_grade).jolt: the four-wheel model with the vehicle's own numbers (nav_plant::dyn4_si_of), its pose and twist read back from the chassis asdyn_4w_plantreads a collision back (exactfalse).kinematic: nav's bicycle, with its rear axle, heading and speed, and its limits in metres.To support the replay,
dyn_4w_plantanddyn_bike_plantgainsteer_command(i),accel_command(i)andapplied_accel(i)(andapplied_grade(i)on the single-track plant). They record what the model took each step. Nothing else in either plant changes.pycvc
WorldGym.fields()returns a dict of numpy arrays: occupancy uint8; height, sdf and gradient float32; mu float64.WorldGym.plants()returns a list of dicts: the parameters by their C++ field names, which are also GRL-SNAM's torch twins' names; the state as a numpy array; the limits, the commands and the applied accelerations.Tests
ariadne_scene_world_test:AriadneWorldGym.TheFieldsAreTheNavigatorsGrid: the fields are the navigator's grid, and its signed distance bit for bit; the sign of the SDF and the direction of its gradient at the walls; the navigator's settings.AriadneWorldGym.ThePlantsAreModelsATwinReplays: four agents on four plants. The models and their order are checked. A Jolt state's heading and speed match the observation. Ondynamic4wa tick is replayed withdiff::dyn4_plant_booksfrom the exported state and command, and equals the plant's next state in all 14 entries (EXPECT_EQ).pycvc_gym: 15 new checks (63 in all) onfields()andplants().deps-jolt-ph):AriadneWorldGymtests pass;ctest -R "PhysicsDyn4wPlant|PhysicsDynBikePlant|DynContact|PlantHost|NavSimWorldAgents|NavPlant|AriadneWorldGym|AriadneSceneWorld|SceneWorld|pycvc_gym$|pycvc_plant_host|pycvc_world_entities": 98 of 98 pass (5 opt-inNavPlantConvergencebenches skip).recipe / macos-latest / ReleasefailedThePlantsAreModelsATwinReplaysin the last bits: arm64 AppleClang contracts the test's inline copy of the model into FMAs.ariadne_scene_world_test.cppis now built with-ffp-contract=off(/fp:preciseon MSVC), as the plant is (b85777d). Checked with clang 18's IR for this file: 387fmuladdwithout the flag, 0 with it.Docs
dyn_driver);grade_force;