Skip to main content

Non-Deterministic Data Sources

AdvantageKit replay relies on all data sources being deterministic and synchronized. IO interfaces ensure this is the case for subsystems, and AdvantageKit automatically handles replay for core WPILib classes (DriverStation, RobotController, and PowerDistribution). However, it's easy to accidentally use data from sources that are not properly logged. We recommend regularly testing out log replay during development to confirm that the replay outputs match the real outputs. Spotting mistakes like this early is the key to fixing them before it becomes a critical issue at an event.

Some common non-deterministic data sources to watch out for include:

  • NetworkTables data as inputs, including from driver dashboards. See here.
  • Large hardware libraries like YAGSL or Phoenix 6 swerve, which interact with hardware directly instead of through an IO layer. Try using the AdvantageKit swerve template project instead.
  • Interactions with the RIO filesystem. Files can be saved and read by the robot code, but incoming data still needs to be treated as an input.
  • Random number generation, which cannot be recreated in a simulator.
  • Iteration over unordered collections (such as unordered maps).