The hardest FRC bugs are the ones you can't reproduce: a vision glitch in match 47, an auto that failed once. AdvantageKit (by Team 6328, Mechanical Advantage) solves this with deterministic log replay -- a software-engineering technique borrowed from distributed systems.
The core idea: IO at the boundary#
AdvantageKit records every input your code reads -- joystick values, every sensor and motor signal, gyro, vision, timestamps -- to a log on the robot. The trick is architectural: all hardware access is isolated behind IO interfaces. Your subsystem logic reads from an Inputs object, never directly from a motor.
public interface DriveIO {
class DriveIOInputs { double leftPositionRad; double leftVelocityRadPerSec; /* ... */ }
void updateInputs(DriveIOInputs inputs);
void setVoltage(double left, double right);
}
At runtime a DriveIOTalonFX (or DriveIOSparkMax) reads real hardware. The subsystem only sees the recorded inputs.
Replay: re-run the exact match offline#
Because the code is deterministic in its inputs, AdvantageKit can later feed the recorded log back through the same code on your laptop -- no robot needed. Every calculated value (odometry pose, command state, vision result) is recomputed identically. You can add new logged outputs to old code, replay last week's match, and see internal values you never thought to log at the time. That is the superpower: debug the past with new instrumentation.
Why it changes debugging#
- A flaky auto becomes reproducible: replay it as many times as you want.
- You can fix a bug, replay the failing match, and prove the fix works against the real data -- before ever touching the robot.
- Combined with AdvantageScope, you scrub through the match timeline and watch every internal value.
Cost and fit#
The IO-interface discipline is real work and adds boilerplate; it suits teams ready for serious software engineering, not first-year programmers. Vendor swerve templates exist that already follow the pattern (e.g. the AdvantageKit TalonFX swerve template, which supports high-frequency odometry and deterministic replay), so you can adopt the architecture without writing it from scratch.
Case study mindset#
Top-tier teams treat their robot code like production software: every match is a recorded test case. When something goes wrong at an event, they pull the log, replay it in the pit, and diagnose deterministically instead of guessing and re-queuing. That feedback loop -- record, replay, fix, prove -- is a big part of why elite programming teams iterate so fast.
the part worth keeping
Key takeaways
- AdvantageKit records all robot inputs and replays them deterministically offline -- debug a real match with no robot.
- The enabling pattern is IO interfaces: subsystem logic reads an Inputs object, hardware lives behind a swappable IO class.
- Replay re-runs identical logic, so you can add new logged outputs to old code and inspect values you never originally logged.
- It adds boilerplate and suits software-mature teams; vendor swerve templates provide the architecture pre-built.
Programming, Controls & SensorsAdvanced Techniques and Case Studieslesson 2 of 5
Keep going
Take the quiz+10 XP with an accountMore in Advanced Techniques and Case Studies
where this came from
Sources and corrections
This lesson is AI-assisted: drafted from primary sources, then reviewed and edited by hand. Errors still get through. When one is reported we fix it and write down what changed, in public, in the corrections log.
sources and further reading
- docs.advantagekit.orgAdvantageKit: TalonFX Swerve Template
- docs.wpilib.orgWPILib: AdvantageScope
- docs.wpilib.orgWPILib: Telemetry / Data Logging
clipped to this lesson
Articles that go further on this
The lesson gets you through the topic. These go wider on it, and they read in one sitting.
- 13 min readFRC Code Structure Best Practices: Command-Based Project ArchitectureHow to structure an FRC command-based robot project the right way — subsystems, commands, RobotContainer, and Constants — verified against official WPILib docs./blogread it
- 19 min readAdvantageScope: Logging and Reviewing FRC Robot DataLearn AdvantageScope, the free FRC tool for logging and reviewing robot data: connect live NetworkTables, open WPILOG and DS logs, and debug with every tab./blogread it
- 8 min readThe FRC Software Toolbox: Driver Station, Dashboards, AdvantageScope & SysIdA beginner-friendly tour of the FRC software ecosystem beyond robot code: Driver Station, dashboards (Glass, Elastic, AdvantageScope), SysId, and vendor tools./blogread it
answer sheet
Lesson quiz
All 3 right completes the lesson. Miss one and only that question comes back, anything you already answered correctly stays banked.
0 of 3 answered
01In an AdvantageKit-based robot, how is hardware interaction structured to enable log replay?
02During AdvantageKit log replay, how does the framework reproduce the robot's exact behavior?
03What does AdvantageKit's deterministic replay let you do to a match that was already recorded?
Answer every question to submit.
All 51 lessons in Programming, Controls & Sensorsopenclose
01 / prerequisites
02 / foundations-tools-and-first-program
03 / robot-program-and-command-based
04 / motors-and-control
05 / autonomous-trajectories-simulation
06 / sensing-fundamentals
07 / encoders
08 / gyros-imus-orientation
09 / closed-loop-control
10 / vision-pose-estimation
11 / worked-examples-mini-projects
- Not read yet:Mini-Project: A Closed-Loop Elevator with Motion Magic
- Not read yet:Mini-Project: A Velocity-Controlled Shooter on REVLib
- Not read yet:Mini-Project: A Teleop Swerve Drive Subsystem
- Not read yet:Mini-Project: An Autonomous Routine with PathPlanner
- Not read yet:Mini-Project: Vision-Aligned Scoring with Limelight
12 / common-mistakes-troubleshooting
13 / advanced-techniques-case-studies
- Not read yet:State-Space Control and Kalman Filtering
- Not read yet:Log Replay Architecture with AdvantageKit
- Not read yet:Advanced Pose Estimation: Multi-Tag Fusion and Standard Deviations
- Not read yet:Robot Coordination, Alerts, and Operator Feedback
- Not read yet:Case Study: Hardening Software Before an Event