How do I view my DataLog in AdvantageScope?
Record what your robot did to a DataLog file, then open that file in AdvantageScope to replay the run on a graph, a field and a swerve view. This page does it for the swerve drive from the Swerve Drive tutorial. Any YAMS mechanism works the same way.
You need:
AdvantageScope installed on your computer.
A robot project with YAMS telemetry, on the robot or in simulation.
Start the DataLog
WPILib's DataLogManager owns the file; YAMS writes into it. Start it once, at the top of the Robot constructor:
import org.wpilib.driverstation.DriverStation;
import org.wpilib.system.DataLogManager;
public Robot() {
DataLogManager.start();
// Optional: also log the Driver Station and joysticks.
DriverStation.startDataLog(DataLogManager.getLog());
}Without this call, the log starts the first time YAMS writes to it. Calling it yourself starts the log at power on, and lets you add the Driver Station data.
Where the file goes:
On the robot: a USB drive, if one is plugged in. Otherwise
/home/systemcore/logson the SystemCore.In simulation: the
logs/folder next tobuild.gradle.
The file starts as WPILIB_TBD_<random>.wpilog. Once the Driver Station connects and the time is known, it is renamed to a timestamp, such as WPILIB_20260817_010558.wpilog, and the console prints DataLog: Renamed log file from '...' to '...'.
Check it: run the code in simulation. A .wpilog file appears in the logs/ folder.
Turn on the DataLog for the swerve drive
A DataLog name turns logging on, and it is set on each telemetry config. The drive, each module and each motor have their own config, and setting one does not set the others. In the swerve tutorial, change three withTelemetry(...) calls:

In createModule(), the azimuth motor's config (from The module motors), in place of .withTelemetry("angleMotor", TelemetryVerbosity.HIGH):
In createModule(), the module's config (from The modules and the drive), in place of .withTelemetry(moduleName, TelemetryVerbosity.HIGH):
In the constructor, the drive's config:
The *TelemetryConfig classes are in yams.core.telemetry, and TelemetryVerbosity is in yams.core.telemetry.enums.
The same three changes, with WithDataLogName. From the C++ swerve example:
The azimuth motor takes a yams::telemetry::SmartMotorControllerTelemetryConfig with .WithDataLogName(...), as on the Telemetry page.
Starting each name with Swerve/ puts everything in one Swerve group in AdvantageScope. The drive motors are left out here; give them a DataLog name the same way if you want them.
Check it: the code builds.
Open the file in AdvantageScope
Copy the
.wpilogfrom the USB drive or/home/systemcore/logs, or find it in your project'slogs/folder after a simulation.In AdvantageScope, choose File > Open File..., or drag the file onto the window. Don't use Connect to Robot or Connect to Simulator: those show live values, not the recording.

.wpilog in the logs/ folder.The sidebar shows everything in the file, grouped by the DataLog names. Under Swerve:
Swerve/pose
The robot's pose
Swerve/chassis/current, Swerve/chassis/desired
The robot's measured and requested velocity
Swerve/states/current, Swerve/states/desired
The four module states
Swerve/degrees/gyro
The gyro angle
Swerve/frontleft/degrees/encoder
A module's absolute encoder angle (one per module)
Swerve/frontleft/state
A module's own state
Swerve/frontleft/angleMotor/rotations/mechanism/position
One of the azimuth motor's values (one group per module)
Numbers are filed under a folder named after their unit, such as degrees or rotations, so you always know what you are looking at. Poses and states have no unit folder.
Check it: the sidebar has a Swerve group.
Explore the run
Swerve tab: drag
Swerve/states/currentinto Sources to watch the wheels turn and spin as they did.2D Field tab: drag
Swerve/posein to see the path the robot drove.Line Graph tab: drag in any number, such as
Swerve/degrees/gyroor a motor's current. To show it in other units, right-click it in the legend and choose Convert Units... (more on units).

Drag the timeline at the top to move through the run, or press play to watch it at normal speed. The file needs nothing else running, so you can open two matches side by side, or send the file to a teammate.
Check it: dragging the timeline moves the wheels in the Swerve tab.
Check it
The sidebar has a Swerve group with the entries in the table above, and dragging Swerve/pose into a 2D Field tab draws the path you drove.
If it did not work
There is no
.wpilogfile. The DataLog never started. CallDataLogManager.start()in theRobotconstructor, as in Start the DataLog.The
Swervegroup is missing, but NetworkTables shows the values. That telemetry config has nowithDataLogName(...). The drive, each module and each motor need their own.A number you can see live isn't in the file. Values you can edit under
NT:/Tuning, such as gains, are not written to the DataLog.Something else. See Troubleshooting.
Last updated
Was this helpful?

