Skip to content

plant_log: record vehicle contact; the power fit is judged on runs that hit no other vehicle - #875

Merged
transfix merged 1 commit into
masterfrom
fix/plant-log-vehicle-contact
Oct 29, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/plant-log-vehicle-contact

Conversation

@transfix

@transfix transfix commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

PlantLogPowerConvergence.FitsTheLedgerAndPredictsHeldOutSeeds is the only failing test on master's push runs (e.g. 40814344105, 40807834022), on package-linux / libcvc-release, -release-grpc and -release-grpc-static. PR runs skip it (it is in STRESS_REGEX).

Not a regression

Linux has failed it since #782 added it (41673b3, 10-24), with the same numbers every time. The RoboRacer's held-out tick r² is 0.598 against > 0.8, and its fit (k_pos 1.470, k_neg -0.651, total -1.34%) is identical in:

It was calibrated on Windows, where r² is 0.91. No commit since has moved the Linux result.

Root cause

The runs that pull r² down are city runs in which the vehicle hit another one.

  • Windows, with each tick's vehicle contact recorded (nav_plant::vehicle_contact_step): the RoboRacer's two worst held-out runs, -34.9% and -7.8%, are the only two that touched another vehicle. Each had two contact ticks and two impact ticks, then a long stall with the wheels spinning (vx 0.16 m/s, 6.4 J of tire loss in one tick). Every other run is within 8%. Static contacts don't separate the runs: nearly every city run touches the walls 2-20 times and still fits.
  • Linux (the per-run diagnostic in 40615210987, job 122575979226): four city runs miss.
    • run 11 -51.6% and run 12 -15.6%: stalls at 0.27 and 0.72 m/s, with 6.3 and 5.3 J of tire loss in one tick;
    • runs 16 and 21, +31.8% and +31.2%: each loses a sixth of its speed in one tick (5.8 to 4.7 m/s).
      The plant log didn't record vehicle contact then, so whether these four are collisions is not yet shown. The push run below will show it.

docs/NAV_TRAINING.md already says the planar power model has no collisions or wheel spin, "so no term of its state can price them". Which runs collide depends on the platform's floating point.

Fix

  • planar_sample::vehicle_contact: the other agent the vehicle touched that tick (-1 none), from nav_plant::vehicle_contact_step, which existed but wasn't logged.
  • The test judges the held-out prediction on the runs that hit no other vehicle: no vehicle_contact and no impact past kImpactG. It requires those to be at least three quarters of the held-out runs. The others are printed with their errors.
  • fit_power is unchanged and still fits every run and tick, as its comment says.
  • docs/NAV_TRAINING.md: the measured table on that basis, and the excluded runs.

Tested

Locally (Windows, MSVC 14.44 Release, master 8380876 + this): all 13 physics_plant_log_test tests pass, and clang-format is clean.

Vehicle Held-out r², contact-free runs (was: all 24) Total Runs judged Excluded runs' errors
Humvee 0.899 (0.828) +1.25% 22 of 24 -0.4%, +0.3%
RoboRacer 0.966 (0.910) +1.88% 22 of 24 -34.9%, -7.8%

CI: PR runs skip this test, so the same commit is pushed to ci/full/plant-log-vehicle-contact for a push run with the heavy suites: run 40905620841. That run's Linux release lanes will show the Linux runs judged, the excluded ones and their errors (results to follow).

…at hit no other vehicle

PlantLogPowerConvergence.FitsTheLedgerAndPredictsHeldOutSeeds has failed on every package-linux
release lane since #782 added it (41673b3): the RoboRacer's held-out tick r2 is 0.598 against
> 0.8, the same on every push run since. It was calibrated on Windows, where it is 0.91, and the
Linux fit has not moved since.

The runs that drag it down are city runs in which the vehicle hit another one. On Windows the
RoboRacer's two worst held-out runs (-35%, -8%) are the only two that touched another vehicle:
two contact ticks and two impact ticks each, then a long stall with the wheels spinning. Every
other run is within 8%, though nearly every city run touches the scene's walls. On Linux, four of
its city runs miss, by -52% to +31%. The planar power model has no collisions and no wheel spin
(docs/NAV_TRAINING.md), so no term of its state sees that energy. Which runs collide depends on
the platform's floating point.

- planar_sample gains vehicle_contact: the other agent the vehicle touched that tick, from
  nav_plant::vehicle_contact_step (-1 none).
- The test judges the held-out prediction on the runs that hit no other vehicle (no
  vehicle_contact and no impact past kImpactG), and requires them to be at least three quarters
  of the held-out runs. The others are printed with their errors. The fit itself is unchanged and
  still uses every run and tick.
- docs/NAV_TRAINING.md: the measured table on that basis (Windows: Humvee r2 0.90, RoboRacer
  0.97, 22 of 24 runs each), and the excluded runs.
@transfix
transfix merged commit 4bd513a into master Oct 29, 2026
46 of 47 checks passed
@transfix
transfix deleted the fix/plant-log-vehicle-contact branch October 29, 2026 23:55
transfix added a commit that referenced this pull request Nov 11, 2026
…rary (#1121)

plant_log_scene.cpp's three seeded picks were std::uniform_int_distribution<std::size_t>: the
city's and the bundle's scatter, the bundle's route goals in the 5-15% ring, and the city's new
goal at each arrival. They are nav::detail::pick_below now (#1118's), as cvc::nav's own are.

Checked by running one program built by MSVC 19.44, g++ 13.2 (libstdc++) and em++ 21 (libc++,
under node):
- With a 32-bit mt19937, uniform_int_distribution<std::size_t> on 64-bit libstdc++ and MSVC still
  takes the 32-bit Lemire path while the range is below 2^32 (libstdc++'s urngrange == UINT32_MAX
  branch; MSVC's _Rng_from_urng_v2 with one 32-bit draw and a 128-bit product): 0 of 260000
  picks differ from pick_below, n from 1 to 2^32 - 1, the streams in step. The same with a
  mersenne_twister_engine<uint64_t, 32, ...>, which is glibc's std::mt19937 (uint_fast32_t is 64
  bits there). libc++ masks and rejects: 237086 of 260000 differ.
- So Linux and Windows draw what they drew. On Windows the drives are bit for bit the same before
  and after (every sample of the Humvee's and the RoboRacer's swerve and city, seeds 7, 100 and
  101, 20 s), and so is physics_plant_log_test's output, the power fits included.
- The speeds and the swerve's gates stay std::uniform_real_distribution<double>: libstdc++ and
  libc++ agree bit for bit, and MSVC's P0952R2 generate_canonical truncates where they round, at
  most 2^-53 of the canonical apart. It is two draws each on all three, and none of 160000 floats
  of the kind plant_log keeps from them differ.

Tests:
- PlantLogScene.CityStartsAreTheSameOnEveryStandardLibrary pins seed 7's eight Humvee starts as
  city cells, read back from the rear axles after the settle (each within 0.02 of a cell's
  centre). It passes against the library before this change too: these are the cells Windows
  drew. libc++'s draw began (5, 55), (57, 5), (20, 75).
- No gate was loosened for macOS's plant-log draws. PlantLogPowerConvergence's collision filter
  (#875) is for Linux's and Windows' floating point, and stays.

The bundle scene's ring pick is not driven by a test: it needs a city bundle.
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