Skip to content

demos: pace the sim off the world clock; gate the lab demo on vrhost - #79

Merged
transfix merged 1 commit into
mainfrom
fix/nav-standalone-worldclock
Sep 16, 2026
Merged

transfix merged 1 commit into
mainfrom
fix/nav-standalone-worldclock

Conversation

@transfix

Copy link
Copy Markdown
Contributor

Two live-demo fixes

1. Sim runs off the world clock, not the frame rate

austin-freedrive and austin-learned stepped the navigator a fixed 3 times per drawn frame, so the drive advanced with the display rate — roughly 10× real time at 60 fps, and faster the quicker the window drew. The native cvc::nav demos avoid this with a fixed-timestep accumulator (SimPacer in libcvc/.../nav_common.h).

This adds the Python twin, SimPacer, to demos/_common.py: accumulate wall seconds and run a whole number of fixed sim_dt ticks per frame. One nav.step() (freedrive) / _nav_step() (learned) advances meta["dt"] seconds of sim time, so ticking at that wall rate is real time on any display rate. A stall is capped (8 ticks) so a hitch drops time instead of fast-forwarding.

  • SIM_SPEED (default 1.0 = real time) tunes the pace without ever re-coupling to the frame rate.
  • Unit-tested (tests/test_sim_pacer.py): 30/60/144/1000 fps all yield the same ticks/sec ≈ real time; speed scales the rate; a stall caps.

austin-patrol/austin-planner don't have this loop (planner's range(9000) is one-time planning), so they're untouched.

2. grl-snam demo lab explains it needs VolRover3

The lab demo's setup()/step() build the scene through VolRover3's live host (vrhost) — there's no standalone window path for the animated job — so grl-snam demo lab (standalone by default) died with an opaque ImportError deep in setup. Now the module is flagged REQUIRES_VOLROVER3 and grl-snam demo stops with:

Error: the 'lab' demo runs only inside VolRover3: it needs `vrhost` (VolRover3's
host module and entry point into the running app), which isn't importable here.
Launch it in VolRover3 instead:
    grl-snam demo lab --volrover3

The static grl-snam lab-demo command still runs standalone unchanged.

Verified

  • SimPacer math + stall cap (unit tests, 4/4).
  • grl-snam demo lab → the message above (vrhost absent); grl-snam demo austin-freedrive is not gated.
  • tests/test_cli.py still green.

The austin-freedrive and austin-learned live demos stepped the navigator a
fixed 3 times per drawn frame, so the drive advanced with the frame rate —
~10x real time at 60 fps and faster on a quicker display. Add a SimPacer (the
Python twin of the native cvc::nav demos' fixed-timestep accumulator in
nav_common.h): accumulate wall time and run a whole number of fixed sim ticks
per frame, so one nav.step()/nav-substep == meta["dt"] of sim time and the drive
runs in real time on any display rate. SIM_SPEED (default 1.0) tunes the pace
without re-coupling to the frame rate.

The lab demo builds its scene through VolRover3's live host (vrhost) and has no
standalone path, so 'grl-snam demo lab' (standalone by default) died with an
opaque ImportError. Flag it REQUIRES_VOLROVER3 and have 'grl-snam demo' stop
with a clear message pointing at --volrover3 when vrhost isn't importable.
@transfix
transfix merged commit 93e6f49 into main Sep 16, 2026
3 checks passed
@transfix
transfix deleted the fix/nav-standalone-worldclock branch September 16, 2026 17:38
transfix added a commit that referenced this pull request Sep 16, 2026
Republish the per-interpreter columns so cvcpkg users pick up GRL-SNAM #79:
the austin_freedrive/austin_learned live demos now pace the sim off the world
clock (SimPacer) instead of the frame rate, and 'grl-snam demo lab' shows a
clear --volrover3 message when vrhost is absent. source.type is vendored, so a
repack from this tree ships the new code; the publish workflow's next-revision
computes cvc.5 (cvc.4 is the highest published).
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