Hey everyone, I created something that I believe will be helpful for many teams, particularly on competition day autonomous coding. It allows for the coding of an accurate, reliable autonomous in minutes.
The issue it is solving: Properly writing autonomous code takes hours. There are record and replay systems in place, but most of them are open loop, meaning that they replay motor velocities, which drift badly due to wheel slip and battery drop.
What this does differently: It records the pose (x, y, heading) of the robot at each snapshot, as given by LemLib’s odometry. In autonomous, it uses LemLib’s motion functions to move back to those poses while using full PID and odometry correction. This means that it is possible to reproduce accurately, regardless of field conditions.
Workflow:
Use d-pad to take a snapshot of each location while driving on driver control.
Run autonomous — the robot follows the same path you drove.
The token file is a simple UTF-8 file, so you can hand edit the coordinates without changing the code.
It also properly checks that the VexOS 8-fopen-per-cycle limit is not reached, by opening the file at the start of the match and using fflush() after each write, which is the silent failure mode that causes USD WRITE FAILED after a few button presses in naive implementations.
Requires: PROS 4.x + LemLib 0.5.6
GitHub: https://github.com/AdyanshSahai/snapshot-replay_V5RC
Currently configured for a specific drivetrain, changing the port numbers, track width, and wheel diameter to match your robot is a 2 minute edit at the top of main.cpp; working on making it more plug and play.
I would appreciate feedback, PRs welcome, happy to answer questions.
PS.
The README explains everything — how to install the code, how to map the buttons, what the tokens are, what the known quirks of PROS and V5RC integration are, etc. — shouldn’t take long to get running. The code is also well commented so it’s easy to edit.
A star on GitHub is well appreciated if it’s useful
and forks and PRs are also welcome, particularly if you want to extend it to other drivetrains or other mechanism configs — I won’t be competing next season (26-27), so would love people to keep building on it.
GitHub: https://github.com/AdyanshSahai/snapshot-replay_V5RC