Legacy Format Deprecation
WPILib supports the type-safe and unit-safe struct format for publishing complex data types such as geometry objects, swerve states, and more! Starting in 2025, AdvantageScope takes advantage of the struct format to streamline the process of configuring fields for visualization. For example, 2D and 3D poses can now be used side-by-side on the ๐บ Odometry and ๐ 3D Field tabs with no manual configuration and no unit errors.
In 2024, AdvantageScope supported both structs and the legacy "number array" format for geometry types. The legacy format packed structured data into a format like double[]
(e.g. a pose would be represented by the array [x, y, rotation]
).
For more information on the design of structs and their advantages, check out this post.
What's Changing?โ
In 2025, AdvantageScope continues to support both the modern struct format and the legacy number array format. However, the legacy number array format is now deprecated and will be removed in 2026. AdvantageScope will present a warning when the legacy format is used, and additional information must be manually provided to specify the packing format and units.
Modern Struct Format | Legacy Number Array Format | |
---|---|---|
2024 (v3.x) | โ Recommended | โ Supported |
2025 (v4.x) | โ Recommended | โ ๏ธ Deprecated |
2026 (v5.x) | โ Recommended | โ Removed |
While the legacy format can still be used in 2025, additional information must be provided about the packing format and units of each field. After adding an array field to a tab, the format can be configured by clicking the icon to the left of the field name.
How Do I Update?โ
Most major tools and libraries used in FRC already support the modern struct format (check the documentation of each library for details). Below, you can see how to upgrade to the modern format for several common libraries. The struct format supports both single objects and object arrays (such as Pose2d[]
).
If you rely on a library that hasn't upgraded to the new format, reach out the developers for details.
NetworkTables
To publish struct data to NetworkTables, create a StructPublisher
with the desired type and call set()
as shown below.
StructPublisher<Pose2d> publisher = NetworkTableInstance.getDefault()
.getStructTopic("MyPose", Pose2d.struct).publish();
publisher.set(new Pose2d());
WPILib does not yet have a struct alternative to the SmartDashboard
style put
methods. Consider using another logging library such as Monologue that supports an imperative API.
Field2d
WPILib's Field2d
class does not yet support the modern struct format. Stay tuned for updates!
In the meantime, users who wish to try the modern format can publish pose data using the NetworkTables API shown above.
Monologue
To publish struct data using Monologue, simply return a supported object type from a method tagged with @Log
:
@Log
public Pose2d getPose() {
return new Pose2d();
}
Objects can also be logged imperatively:
log("MyPose", new Pose2d());
Epilogue
To publish struct data using Epilogue, simply return a supported object type from a logged method:
@Logged
public class MyClass {
public Pose2d getPose() {
return new Pose2d();
}
}
AdvantageKit
To log and replay struct data using AdvantageKit, simply pass a supported object type to the recordOutput
method, return it from a method/field tagged with @AutoLogOutput
, or include it in an inputs class tagged with @AutoLog
.
// Standard output logging
Logger.recordOutput("MyPose", new Pose2d());
// Annotation output logging
public class MyClass {
@AutoLogOutput
public Pose2d getPose() {
return new Pose2d();
}
@AutoLogOutput
public Pose2d myPose = new Pose2d();
}
// Inputs class
@AutoLog
public class Inputs {
public Pose2d myPose = new Pose2d();
}
DataLog
To append struct data to a raw DataLog
, create a StructLogEntry
with the desired type and call set()
as shown below.
StructLogEntry<Pose2d> logEntry =
StructLogEntry.create(DataLogManager.getLog(), "MyPose", Pose2d.struct);
logEntry.append(new Pose2d());
Phoenix Signal Logger
The Phoenix signal logger does not currently support the modern struct format. Consider publishing geometry data using one of the logging libraries shown above instead of using custom signals in Phoenix.
AdvantageScope can automatically merge log files from multiple sources, such as Hoot and WPILOG files. See here for details.