Repository navigation
nav_stats: the whole plant ledger on every plant, with vehicle contact and what does not apply - #876
Merged
Merged
Conversation
…t and what does not apply plant_sample gains vehicle_contact (the agent whose vehicle it touched over the tick, the deepest contact's) and measured, the fields the plant's model has. The Jolt plant fills vehicle_contact from vehicle_contact_step. The dynamic plants count their chassis boxes' contacts apart (dyn_chassis: the other box touched deepest, the contacts begun with static geometry), report them as static_contacts_step, vehicle_contact_step and the sample's contacts and vehicle_contact, and sample their attitude: dyn_bike_plant the ground's under it, dyn_4w_plant its body's, roll rate, load transfer and wheels on the ground. The single track leaves out what it has not got, and both leave out the contacts without a world. nav_stats reduces vehicle_contact to vehicle_hits and vehicle_hit_s (episode total_vehicle_hits, scorecard mean_vehicle_hits) and keeps plant_measured. cvc/nav/plant_ledger.h lists every item of the ledger with its key, unit, meaning and the fields it needs; plant_ledger_applies says whether it has a value. An item that does not apply stays at its default, is null in the JSON, and the scorecard's plant means are over the runs that measured them. cvcGL's publish_nav_stats writes every item, n/a (kNavStatsNotApplicable) where it does not apply, and with emit_plant_ledger the whole ledger on the kinematic plant too. It wrote 6 of the 15 sample items a vehicle had (besides the energy ones) and none of the new ones.
transfix
added a commit
that referenced
this pull request
Oct 29, 2026
The project version and the cvcpkg recipe family move to 3.7.4. Every recipe is at cvc_revision 1 already, so none restarts. 3.7.4 carries the whole plant ledger on every plant (#876): plant_sample's vehicle contact and what each plant measures, the dynamic plants' building and vehicle contacts and attitude, nav_stats' vehicle_hits, cvc/nav/plant_ledger.h, and publish_nav_stats writing every item, n/a where a plant does not measure it. demo3's Ledger screen (CVC-DBG/cvcdbg#256) reads it. It also carries SDL3 owning cvcGL's onscreen window (#829), state_exec's state-incr, state-cas and state-swap (#860), and Ariadne's window fitting (#828) and room relay test counting (#867).
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.
Joe asked for demo3's UI to show the whole ledger of whichever vehicle plant runs, hiding nothing because of which plant was chosen. Today the plant ledger can't support that, for three reasons:
publish_nav_statswrote 6 of the 15 sample items a vehicle had.roll_max_deg,pitch_max_deg,tilt_s,lift_s,wheels_up_s,steer_cmd_abs_mean,accel_cmd_mean,brake_shareandplant_stepswere reduced but never published.veh_contactsis a distance proxy (ticks withinmin_gap).plant_sampleat its defaults: an upright body, no load transfer, every wheel down and no contacts. The ledger reported those defaults as measured zeros. On a single trackltr_max0 is not a measurement.This PR adds the CVC-side half; the demo's half is a cvcdbg PR built against this branch.
The change
plant_sample(plant_types.h) gains:vehicle_contact: the agent whose vehicle it touched over the tick (the deepest contact's; -1 none), named and meant as plant_log: record vehicle contact; the power fit is judged on runs that hit no other vehicle #875'splanar_sample::vehicle_contact;measured: bits for the fields the plant's model has (has_attitude,has_roll_rate,has_ltr,has_wheels_down,has_contacts,has_vehicle_contact). The default is all of them, so a plant that sets nothing reads as before.The plants
nav_plant(Jolt) fillsvehicle_contactfromvehicle_contact_step, and measures everything.dyn_chassisnow tells contacts apart: the other chassis box a box touched deepest, and the contacts it began with static geometry (a body without mass that is not the ground, asnav_plantcounts them).dyn_bike_plantanddyn_4w_plantgainstatic_contacts_step(sobuilding_contactsis no longer always 0 on them),vehicle_contact_step, and the sample'scontactsandvehicle_contact.dyn_4w_plantsamples its body's attitude and roll rate, the load transfer of its four wheels' loads, and a wheel off the ground while its spring is unloaded. It measures everything.dyn_bike_plantsamples the ground's attitude under it. It has no load transfer, roll rate or wheels off the ground, and says so inmeasured.nav_statsvehicle_contacttovehicle_hits(contacts begun: a tick touching a vehicle it was not touching the tick before) andvehicle_hit_s. The episode getstotal_vehicle_hitsand the scorecardmean_vehicle_hits.plant_measured, the AND of the samples' bits.nullin the JSON.cvc/nav/plant_ledger.h(new) lists every item of the ledger: 20 per vehicle (the three energy items and 17 sample items) and 5 per episode. Each entry has its key, unit, meaning, the bits it needs and a getter.plant_ledger_applies(item, record)says whether the item has a value. The JSON, the publisher, the tests and the demo all read this one table.cvcGL
publish_nav_statskNavStatsNotApplicable("n/a") where it does not apply.nav_stats_publish_params::emit_plant_ledgerwrites them on the kinematic plant too (all n/a). It is off by default, so kinematic-only scenes are unchanged.The kinematic record and its JSON are byte-unchanged. A plant's record gains
vehicle_hitsandvehicle_hit_s, and its episode gainstotal_vehicle_hits.What each plant measures
Tests
Built with MSVC 19.44 against
.deps/libcvc, with Jolt and cvcGL:cvcgl_nav_stats_publish: OK. A new block puts three agents on each plant throughplant_host(kinematic, humvee, dynamic, dynamic4w), runs 30 ticks ofsim_world's own nav_stats, publishes withemit_plant_ledger, and checks that every item ofplant_ledger_vehicle()for each vehicle and every item ofplant_ledger_episode()is published, as n/a exactly where the table above says. Without Jolt the expectation adds the contact items on the dynamic plants, and humvee falls back to the bicycle. It also checks n/a leaves on a hand-built record.nav_stats_test: 17/17. New:PlantLedgerNotApplicable,PlantLedgerVehicleHitsandPlantLedgerItemsAreAllInTheJson. The existing byte-unchanged test still passes.physics_dyn_bike_plant_test8/8 andphysics_dyn_4w_plant_test7/7. NewTellsTheBuildingsFromTheOtherVehiclesin each: agent 0 drives into a wall and agents 1 and 2 head on into each other away from it. Agent 0 begins one static contact and touches no vehicle; agents 1 and 2 each touch only the other (144 ticks) and no wall. The 4w turning left at 9.2 m/s gives ltr -0.356, with the load on its right wheels.physics_plant_host_test5/5,physics_plant_log_test13/13,nav_test62/62.clang-format 18 (cvcpkg) on the changed files.