How To: Replay Watch
Some use cases of log replay benefit from rapid iteration, such as tuning pose estimation algorithms. Replay watch addresses this use case by automatically updating replayed outputs when code is modified. An example is shown below, where the replayed output in AdvantageScope updates in real time as the code is modified:
Check the replay example on rapid iteration for a more detailed example of this feature in the context of tuning a pose estimation algorithm.
Usage
Replay watch requires a custom Gradle task defined in build.gradle
. This task is included in the AdvantageKit example projects and documented in the installation instructions for existing projects.
-
Configure the project for log replay as normal, such as setting
simMode
inConstants.java
toREPLAY
in the AdvantageKit example projects. TheWPILOGWriter
used during replay should be configured using the default,AUTO
, orALWAYS
AdvantageScope open behavior (check the API docs for details). We also recommend callingsetUseTiming(false)
during setup, as described here. -
Open the original log file in AdvantageScope or add the path to the
AKIT_LOG_PATH
environment variable. -
Run
./gradlew replayWatch
(macOS/Linux) orgradle.bat replayWatch
(Windows) from the command line. -
Log replay will run once, and the resulting log file will open automatically in AdvantageScope.
-
When the contents of the
src
directory are modified, log replay will run again automatically and the new log will be opened in AdvantageScope. The time range and visualizations in AdvantageScope will be preserved when loading new data. Note that each iteration of log replay will overwrite the previous replayed log file, but will not modify the original log.
Replay watch is limited by the speed at which the robot program can be replayed, which makes it most useful on short log files and devices with fast single-core CPU performance.