Using log replay on AdvantageScope

Hi, me and my team are having trouble figuring out how to operate log replay.
If anyone does know how to do that please write an explanation.

Thanks.

You use AdvantageKit, right? AdvantageScope is only a log viewer, AdvantageKit is the library that lets you record logs and replay them

We’re talking about the third level of logging. Taking inputs from a log file and putting them in simulation and watching the outputs.
Yes we’re talking about AdvantageKit.

Ok great. To start replay in AdvantageKit, you need to call Logger.getInstance().setReplaySource(). If you use the WPILOGWriter as your data receiver (which logs to wpilog files), then you should use the WPILOGReader as the replay source, and pass it the log file path. To find the log file path, you can use the LogFileUtil.findReplayLog(), which will return the current log file that is opened on AdvantageScope (or if no log is open, will ask you to enter the path). Also, don’t forget to only enable replay in simulation.

You can see example of this is the official docs here: AdvantageKit/docs/INSTALLATION.md at main · Mechanical-Advantage/AdvantageKit (github.com)

Keep in mind that in this example, replay will always be enabled in simulation. If you want to still use simulation without replay, you can just change the if condition (and for example make it only run replay some constant is true).

1 Like

Oh forgot to add something important: you can only set the replay source before starting the logger.

Thank you, I think this works (though it’s hard to know since we have a different problem with our code).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.