Skip to content

Record reproducible physics replays and compare ball measurements - #6

Merged
fred-huang122 merged 3 commits into
masterfrom
test/physics-replay
Nov 2, 2026
Merged

fred-huang122 merged 3 commits into
masterfrom
test/physics-replay

Conversation

@fred-huang122

@fred-huang122 fred-huang122 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Add a developer tool for reproducible fixed-step physics comparisons, using the same decoded protocol handlers as the live worker. It captures a fresh headless world's full settings and initial body states, seed, build/architecture/math-backend metadata, and the simulation tick at which each command or watchdog-expiry event is applied. Offline replay uses those ticks with explicit serial or helper modes, without wall-clock scheduling or rendering.

  • grSim_replay --record FILE --fixture spaced|pushing --ticks N records bounded six-a-side fixtures. --duration-ms N instead captures loopback UDP robot/simulator commands, returns feedback and records expiry explicitly. --settings FILE selects the recording configuration; replay uses the saved values.
  • Checkpoints include all 73 dynamic bodies in stable construction order, plus robot state/wheel commands. Recordings reject incompatible schemas/ODE versions, invalid physical settings, malformed payloads and unordered timelines. Initial states are checked numerically. Arbitrary mid-match checkpoints, GUI edits, world configuration changes and vision publication are outside this fresh-session capture format.
  • tools/compare_ball_measurements.py compares actual experiment trajectories with strictly ordered SI-unit CSV measurements, reports interpolation errors, and rejects missing/nonfinite/duplicate/out-of-range data. It does not silently fit or extrapolate. A source-attributed ER-Force 2016 fixture contains reported fitted coefficients, explicitly distinguished from raw shot samples and calibration of another field.

The reference comparison identifies an outstanding calibration gap:

Ball quantity Current measured simulation Published ER-Force field
Sliding acceleration -9.81 m/s² -2.5 m/s²
Rolling acceleration -0.35 m/s² -0.30 m/s²
Sliding-to-rolling speed ratio 0.704 0.600

The published numbers are from section 5.2, with a 3.3 m/s simulated shot. The comparison reports disagreement and --require-agreement exits nonzero. Its diagnostic tolerances are declared separately from experimental uncertainty; no raw uncertainty estimates are invented. Physics defaults are not fitted to another team's field. Team-specific acceleration/braking/dribbling calibration still needs measured data from that setup.

Validation: all 23 local regressions pass (86.96 s). New tests record and replay both 6 v 6 fixtures, repeat serial runs, compare helper mode numerically, detect shifted command ticks, reject malformed recordings, exercise live UDP feedback/expiry, and independently verify the measurement comparator with known errors and negative controls. A detailed helper comparison shows at most 3.4e-11 m body-position difference and 1.6e-9 rad/s angular-velocity difference over the tested pushing replay; numerical equality is not promised across CPU architectures. The pushing replay retains 0.711 mm peak shell penetration, below the unchanged 2 mm guard, with no ODE warnings/errors. The direct solver, geometry/materials, timestep and five substeps are unchanged.

Builds on the ODE changes merged in #3; replay and measurement changes are reviewed separately from rendering PR #5. Raw recordings, measurements, reports and probes remain outside Git. Only reusable tools, regressions, source-attributed reference coefficients and usage guidance are committed. Calibration against team-specific logs remains pending measured input.

A separate local experiment sets the existing rolling-deceleration option to 0.30 m/s² and observes -0.300 m/s² in the actual trajectory, matching the published rolling coefficient. Sliding acceleration and transition ratio still disagree; this does not establish a full calibration and does not change defaults.

Pre-merge review fixed three defects: Docker now stages the tools directory; unsupported safe/rolling teleport fields are rejected across the whole command batch before state mutation; explicitly requested settings must be readable regular files. Regressions cover both false/true unsupported flags with sibling robot teleports, capture/replay equality, and missing/non-file settings. The Docker build-stage source inventory now configures successfully after reproducing the original missing-source failure.

The combined reviewed rendering/replay tree passes all 27 local regressions (100.82 s) and the actual RTX 4060 application smoke check. Updated CI passes Ubuntu 22.04/24.04; native arm64 jobs are still awaiting hosted runners. The integrated tree is also being validated in PR #5 CI.

@fred-huang122
fred-huang122 changed the base branch from perf/ode-0.16.6-integration to master November 2, 2026 17:20
@fred-huang122
fred-huang122 merged commit 02be11c into master Nov 2, 2026
2 of 4 checks passed
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