AdvantageKit is a log replay and simulation framework developed by Team 6328. Its core objective is to enable all code logic to be replayed in simulation based on a log file, so you can debug complex issues, log new fields that were never recorded in the first place, and even retune compatible systems without needing a real robot. For more details, check out the What is AdvantageKit? page or my conference from the 2023 Championship:
AdvantageKit has grown significantly since its introduction in 2021 and is now used by dozens of teams on the world stage. AdvantageKit split from its sister project AdvantageScope for the 2023 season, so AdvantageKit is not required to use AdvantageScope. AdvantageScope is included in the WPILib installer for 2024, but AdvantageKit remains a fully independent project which will not be integrated with WPILib.
What’s New?
AdvantageKit now supports WPILib 2024.1.1-beta-2! Remember that AdvantageKit should only be used with the WPILib version specified in each set of release notes. For a full 2024 changelog, check the GitHub release.
Structured Data Logging
AdvantageKit now supports struct & protobuf encoding for supported objects like Pose3d
, Trajectory
, and SwerveModuleState
. These objects can be logged as outputs or inputs, and many can also be stored as arrays. Expect compatibility to improve over time as more classes are supported natively by WPILib.
The syntax for logging a supported object as an output is the same as previous versions of AdvantageKit (see the example below). However, these types are now identifiable in AdvantageScope; you can examine individual components with human-friendly names, and it’s impossible to mix up 2D and 3D objects. Support for structured data was added in AdvantageScope 2024 beta 3.
Logger.recordOutput(“MyPose”, new Pose2d());
Logger.recordOutput(“MyPoses”, new Pose2d(), new Pose2d());
These objects can also be used as input types. Need to log a robot pose from a vision subsystem or a swerve module rotation from your drive? You can now use objects like Pose3d
or Rotation2d
with AutoLog, including arrays:
@AutoLog
public class MyInputs {
public Rotation2d myRotation = new Rotation2d();
public Pose3d[] myPoses = new Pose3d[] {};
}
Internally, AdvantageKit supports both simple structs (with WPILib’s encoding system) and protobufs. Structs are more efficient but less flexible for complex data types. Many classes in WPILib support both systems, but the default logging calls in AdvantageKit will select the most efficient encoding automatically.
Swerve Template Project
In addition to the skeleton and differential drive templates, AdvantageKit now includes a swerve drive template! This template supports odometry, physics simulation, simple field-oriented drive, and autos with PathPlanner. As swerve becomes more common, we hope this serves as a useful resource and starting point for teams looking to adopt AdvantageKit.
You can download the swerve template project as a zip file from the latest release. All of the example projects have also been updated to use Phoenix 6 for the CTRE IO implementations.
Simplified Syntax
Several classes including Logger
now have static interfaces rather than using singletons. This makes all of your logging calls more concise and readable:
Logger.recordOutput(“MyField”, 3.14); // 2024 interface
Logger.getInstance().recordOutput(“MyField”, 3.14); // 2023 interface
Calls to getInstance()
are still supported for backwards compatibility, but are marked with a deprecation warning.
What’s Next?
AdvantageKit 2024 beta 1 is now released! You can see the full changelog on the GitHub releases page. Updated documentation is available here. To get started, check out the installation guide. We would welcome feedback and bug reports on this thread or the issues page.
We’re grateful to everyone who has adopted AdvantageKit and provided valuable feedback over the past two years. We hope you enjoy running it in your 2024 robot projects at last!