Skip to main content

Documentation 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.

Good logging is the foundation of fast debugging. Spectrum’s 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:
// In a subsystem's periodic() method
@Override
public void periodic() {
    Telemetry.log("Swerve/RobotPoseX", getRobotPose().getX());
    Telemetry.log("Swerve/RobotPoseY", getRobotPose().getY());
}

Telemetry.log(Command)

Wraps a command with start and end log entries so every command execution is captured in the log automatically:
public static Command log(Command cmd) {
    return cmd.deadlineFor(
                    Commands.startEnd(
                            () -> log("Commands", "Init: " + cmd.getName()),
                            () -> log("Commands", "End: " + cmd.getName())))
            .ignoringDisable(cmd.runsWhenDisabled())
            .withName(cmd.getName());
}
In auton and coordinator code, wrap commands with 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:
public static void print(String output, PrintPriority priority) {
    String out = "TIME: " + String.format("%.3f", Timer.getFPGATimestamp()) + " || " + output;
    if (priority == PrintPriority.HIGH || Telemetry.priority == PrintPriority.NORMAL) {
        System.out.println(out);
    }
    log("Prints", out);
}
Use 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

Call Telemetry.start(...) once during robot initialization to configure DogLog options:
Telemetry.start(
    /* ntPublish      */ true,   // publish log entries to NetworkTables
    /* captureDs      */ true,   // capture DriverStation messages
    /* captureNt      */ false,  // capture all NT entries (expensive)
    /* captureConsole */ true,   // capture System.out to log
    /* logExtras      */ true,   // log PDH currents, CAN usage, radio
    /* tunableOnFMS   */ false,  // disable NT tunables on FMS
    PrintPriority.HIGH           // minimum console priority
);

Fault tracking

Telemetry defines a Fault enum for named fault conditions that appear as alerts in the DriverStation and log:
public enum Fault {
    CAMERA_OFFLINE,
    AUTO_SHOT_TIMEOUT_TRIGGERED,
    BROWNOUT,
}
Alerts from 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:
PatternExampleUse
Subsystem/ValueNameSwerve/RobotPoseXSensor readings and outputs
CommandsCommandsCommand init and end events (via Telemetry.log(cmd))
AlertsAlertsError/warning/info alerts from NetworkTables
PrintsPrintsConsole messages with timestamps
SimShot/...SimShot/FuelProjectileSuccessfulShotSimulation-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/RobotPoseX and RobotPoseY on a field map to visualize actual vs. expected paths.
  • Correlate commands with sensor state — the Commands log key shows exactly when each command started and ended, making it easy to trace why a mechanism behaved unexpectedly.
  • Visualize mechanismsMechanism2d data published to SmartDashboard during simulation renders in AdvantageScope’s mechanism view.
  • Inspect simulation trajectoriesSimShot/FuelProjectileSuccessfulShot and SimShot/FuelProjectileUnsuccessfulShot log 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. Because Telemetry.start() sets ntPublish: true, all log entries are also available as NetworkTables topics. Common panels to configure:
  • CommandSchedulerSmartDashboard/Scheduler shows running commands (auto-populated by Telemetry.start()).
  • Auto ChooserSmartDashboard/Auto Chooser exposes the SendableChooser for routine selection.
  • Mechanism2dSmartDashboard/Sim/LeftView shows the side-view mechanism canvas during simulation.

What to log

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.
Log frequently-changing sensor readings in periodic(). Use consistent hierarchical keys (Subsystem/SensorName) and include both raw and processed values when troubleshooting calibration.
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.
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.

Build docs developers (and LLMs) love