karoo-ride-replay — replay a recorded ride's data to test your extension (no ride needed)
Hi!
Sharing this for anyone developing for the Karoo who wants to test an extension end-to-end without going out for a ride every iteration.
karoo-ride-replay is a Karoo extension that loads any FIT file — one of your own recorded rides from FitFiles/, or a sideloaded one — and plays it back as if it were a live ride. Other extensions consume it normally: they see standard sensor + location streams and behave the same way they would on the bike, no code change needed. And since the location comes from a real ride, adding the matching route lights up the route-based features like Climber too.
What it does:
- Reads FIT files from the Karoo's
FitFiles/folder (or a sideloaded one) - Publishes Power / HR / Cadence / Speed through a single virtual sensor via
karoo-ext, so consumer extensions pair to it just like real BLE/ANT+ hardware. Recorded distance drives Karoo's ride distance through the same hook real speed sensors use — so you can run a replay even without mocking GPS. - Injects GPS via Android's mock-location framework, so Karoo OS sees position move along the recorded route
- Variable playback speed (1× / 2× / 5× / 10×) for fast iteration on a specific segment
New in v0.9.0-beta:
- A Karoo-native UI: pick a ride, then scrub a draggable timeline, drop bookmarks, and loop between two of them to re-run a segment
- Mock GPS is now scoped to an active replay — it only takes over while a replay is playing and releases when you exit, so you can leave the app selected as the mock-location app and still ride normally with real GPS
- Star favourites to pin the rides you test against
Built on karoo-ext. The single-sensor lifecycle follows the Karoo-KPower pattern (credit lockevod), and Tim Klemmer (awesome-karoo maintainer) pointed out several cleaner approaches along the way — thanks!
Repo: https://github.com/lgangitano/karoo-ride-replay
APK + Karoo 2 / Karoo 3 sideload instructions: https://github.com/lgangitano/karoo-ride-replay/releases/latest
Apache 2.0. v0.9.0-beta — feedback and bug reports welcome.
-
Thank you, Lockevod! Glad it's useful, and thanks again for the KPower pattern it's built on.
v1.1.0 is out, with three changes for testing extensions:
- Sensor dropouts: Power, HR, Cadence and Speed are now four separate virtual sensors (the post above still says one). Tap one in the Replay screen's sensor strip to cycle it through streaming, searching and missing, and the Karoo shows that sensor's status while the others keep streaming.
- Replay data field: add Replay to a ride page to control playback from the ride screen. At full width it's a control bar with ‹10s, play/pause, 10s›, the time and the speed; at half width a tap plays or pauses.
- Scripting over adb: load a FIT file, play, pause, seek, change speed and read the state from a laptop with adb shell am broadcast. Every command answers with the replay state, so tests can be scripted and repeated. Commands are in the README.
The dropouts are Johannes Weytjens's work (jpweytjens on GitHub), and the field and the adb commands were his ideas. Thanks!
Upgrading from v0.9.0-beta: remove the old Karoo Ride Replay sensor and pair Replay Power, Replay HR, Replay Cadence and Replay Speed.
Release and APK: https://github.com/lgangitano/karoo-ride-replay/releases/latest
README: https://github.com/lgangitano/karoo-ride-replay#readmeTested on a Karoo 3. Reports from Karoo 2 users are welcome.
-
Karoo Ride Replay v1.2.0 publishes the replayed ride's grade for other extensions. During a desk replay the Karoo's own grade stays near 0, because it comes from the barometer, and extensions can't publish it. Ride Replay now publishes the replayed grade as its own data type, so your extension can opt in to it during a replay:
- Data type: TYPE_EXT::ride-replay::grade, in percent, positive uphill, under DataType.Field.SINGLE
- One value per replayed record while a replay is open, and NotAvailable otherwise, so you can fall back to the Karoo's grade on a real ride
- Source: the grade recorded in the FIT file, or computed from altitude and distance when the file has none
There's also a Replay grade field you can add to a ride page.
Thanks to lockevod (https://github.com/lockevod), author of KPower and KGhost, for the proposal and the review.
Download: https://github.com/lgangitano/karoo-ride-replay/releases/latest
Contract and consumer snippet: https://github.com/lgangitano/karoo-ride-replay#grade-for-other-extensions
Please sign in to leave a comment.
Comments
3 comments