Good logging is the foundation of fast debugging. Spectrum’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/spectrum3847/2026-Spectrum/llms.txt
Use this file to discover all available pages before exploring further.
Telemetry class extends DogLog to give every part of the codebase a consistent, structured way to record sensor values, command lifecycle events, and fault conditions. That data flows into AdvantageScope for post-match replay and Elastic Dashboard for real-time monitoring during practice and competition.
Telemetry.java
Telemetry extends DogLog and registers itself as a WPILib subsystem so it runs a periodic() loop that polls NetworkTables alerts each cycle. It provides three main logging primitives:
Telemetry.log(key, value)
Inherited from DogLog, log writes a key-value pair to the structured log file. Use hierarchical slash-separated keys to organize data in AdvantageScope:
Telemetry.log(Command)
Wraps a command with start and end log entries so every command execution is captured in the log automatically:
log(...) when you want to trace which commands ran and when they ended.
Telemetry.print(message, priority)
Writes to the DriverStation console and to the structured log under "Prints". The timestamp is prepended automatically:
PrintPriority.HIGH for messages that must always appear (mode transitions, critical faults). Use PrintPriority.NORMAL for verbose debug output that you may want to suppress during competition.
Starting Telemetry
CallTelemetry.start(...) once during robot initialization to configure DogLog options:
Fault tracking
Telemetry defines a Fault enum for named fault conditions that appear as alerts in the DriverStation and log:
SmartDashboard/Alerts are polled every cycle in logAlerts() and written to the log under the "Alerts" key so fault timing is always captured even if a human misses the DriverStation message.
Log key conventions
Organize log entries with hierarchical keys so AdvantageScope can display them as a tree:| Pattern | Example | Use |
|---|---|---|
Subsystem/ValueName | Swerve/RobotPoseX | Sensor readings and outputs |
Commands | Commands | Command init and end events (via Telemetry.log(cmd)) |
Alerts | Alerts | Error/warning/info alerts from NetworkTables |
Prints | Prints | Console messages with timestamps |
SimShot/... | SimShot/FuelProjectileSuccessfulShot | Simulation-specific data |
DogLog
DogLog is the underlying structured logging library. It writes a.wpilog file to the RoboRIO’s filesystem during each robot session. Spectrum extends it rather than using it directly so that all code goes through Telemetry and picks up the console-routing and alert-polling behavior automatically.
AdvantageScope
AdvantageScope opens.wpilog files for post-match analysis. Key use cases:
- Replay pose data — plot
Swerve/RobotPoseXandRobotPoseYon a field map to visualize actual vs. expected paths. - Correlate commands with sensor state — the
Commandslog key shows exactly when each command started and ended, making it easy to trace why a mechanism behaved unexpectedly. - Visualize mechanisms —
Mechanism2ddata published to SmartDashboard during simulation renders in AdvantageScope’s mechanism view. - Inspect simulation trajectories —
SimShot/FuelProjectileSuccessfulShotandSimShot/FuelProjectileUnsuccessfulShotlog 3D pose arrays that AdvantageScope can render on the field.
Elastic Dashboard
Elastic Dashboard connects to the robot’s NetworkTables during practice and competition for real-time monitoring. BecauseTelemetry.start() sets ntPublish: true, all log entries are also available as NetworkTables topics. Common panels to configure:
- CommandScheduler —
SmartDashboard/Schedulershows running commands (auto-populated byTelemetry.start()). - Auto Chooser —
SmartDashboard/Auto Chooserexposes theSendableChooserfor routine selection. - Mechanism2d —
SmartDashboard/Sim/LeftViewshows the side-view mechanism canvas during simulation.
What to log
Commands
Commands
Wrap significant commands with
Telemetry.log(cmd) in Auton.java and Coordinator.java so command lifecycle is always captured. The Commands key in AdvantageScope will show a timeline of init and end events.Sensor values
Sensor values
Log frequently-changing sensor readings in
periodic(). Use consistent hierarchical keys (Subsystem/SensorName) and include both raw and processed values when troubleshooting calibration.State transitions
State transitions
Log entries at every state transition in the coordinator. Knowing when the robot entered a state and from what previous state is the fastest way to debug unexpected behavior.
Initialization and faults
Initialization and faults
Use
Telemetry.print(message, PrintPriority.HIGH) at the start and end of every init method and whenever a fault is detected. These messages appear in the DriverStation console and the structured log simultaneously.Simulation
How simulation shot trajectories are captured with Telemetry.log and visualized in AdvantageScope.
Architecture overview
Where Telemetry fits in the three-layer codebase architecture.
