Skip to content

GRL-SNAM on libcvc 4.0.3+: the trace clock at libcvc's 1/120 s quantum, and the replay's play head to the microsecond - #204

Merged
transfix merged 1 commit into
mainfrom
fix/sim-tick-120hz
Nov 23, 2026
Merged

transfix merged 1 commit into
mainfrom
fix/sim-tick-120hz

Conversation

@transfix

Copy link
Copy Markdown
Contributor

Fixes main's ci, red since aba8ecc (run 45002106676, 2026-11-22). It is the first run on libcvc 4.0.4 from the cvcpkg catalog. Six tests failed on cp311, cp312 and cp313.

Cause

libcvc 4.0.3 changed the simulation tick from 0.06 s to 7 quanta of 1/120 s, which is 7/120 s or about 0.0583 s (transfix/libcvc#1378, cvc/core/sim_tick.h). Two places in GRL-SNAM still assumed the old tick:

  • live --record-trace stepped its own world_clock at a 0.01 s quantum (_trace.QUANTUM). 7/120 s is not a whole number of 0.01 s quanta, so clock_follower.for_step threw: ticks_per_step: the step is not a whole number of clock quanta. Every session exited with code 2, which failed the five test_6_* tests in tests/test_lab_acceptance.py.
  • The replay wrote play.t to 4 decimals. So 2 s plus one tick read back as 2.0583 instead of 2.058333, which failed test_ariadne_live_arms.py::test_the_replay_steps_seeks_and_restarts.

Changes

  • _trace.QUANTUM is now pycvc.SIM_QUANTUM, the quantum libcvc's own tick is a whole number of:
    • 1/120 s since 4.0.3;
    • 0.01 s in 4.0.2, when the tick was 0.06 s;
    • 0.01 s on older pycvc builds, which have no SIM_QUANTUM (the tick was 0.05 s).
  • Player.fixed_dt is the trace's own quantum, the header's fixed_dt. live's replay paces itself by that instead of the module constant, so a trace recorded at 0.01 s still plays at its own speed.
  • PlayHead writes play.t to 6 decimals.
  • The scrub --ticks help and two test comments said the tick has been 0.06 s since 4.0.2. They now give the tick for each release.

Verification

  • Against a local libcvc 4.0.5-dev build with the 7/120 s tick (Windows):
    • A 0.01 s world_clock with clock_follower.for_step(clock, pycvc.SIM_TICK) raises the same error as CI. At _trace.QUANTUM (1/120 s) it runs 17 steps in 1 s.
    • PlayHead at 2 s plus one step writes play.t 2.058333, which is within the test's tolerance.
  • Not run locally: the GL-hosted tests themselves. Neither local build's bindings match its rebuilt libcvc DLLs, so the host crashes on load. This PR's CI runs them on 4.0.4.
  • black --check is clean on the changed files.

Not changed

These are left as they are, since nothing fails because of them:

  • fleet.py's plant_host(fixed_dt=0.01). libcvc's own pycvc_gl.cars now uses SIM_QUANTUM.
  • SimPacer.SUITE_QUANTUM. It already falls back to the tick itself when 0.01 s does not divide it.
  • coph_cars.py's 0.06 s fallback and help text. That file is the CoPH work's.

…m, and the replay's play head to the microsecond

libcvc 4.0.3 moved the simulation tick to 7 quanta of 1/120 s (7/120 s,
transfix/libcvc#1378), and CI picked up 4.0.4 on 2026-11-22. Two things here
assumed the old 0.06 s tick:

- live --record-trace stepped its own world_clock at 0.01 s, which 7/120 s is
  not a whole number of, so clock_follower.for_step threw ("ticks_per_step:
  the step is not a whole number of clock quanta") and every session exited 2.
  _trace.QUANTUM is now pycvc.SIM_QUANTUM (1/120 s since 4.0.3, 0.01 s in
  4.0.2), with 0.01 s when pycvc has none. A replay paces itself at its
  trace's own quantum (the header's fixed_dt, Player.fixed_dt), so a trace
  recorded at 0.01 s still plays at its speed.
- The replay wrote play.t to 4 decimals, so 2 s plus one tick read 2.0583,
  not 2.058333. It is written to 6 now.

The docstrings and help that said the tick is 0.06 s since 4.0.2 say what
each release has.
@transfix
transfix merged commit 92d9ada into main Nov 23, 2026
5 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