Class DeviceDebug

java.lang.Object
frc.robot.util.DeviceDebug

public final class DeviceDebug extends Object
Runtime debugging utility for exposing low-level device controls via NetworkTables.

This class allows selected CAN devices to be interactively inspected and reconfigured at runtime through NetworkTables (e.g. from Glass, Shuffleboard, or AdvantageScope). It is intended strictly for debugging and tuning and should not be relied upon for normal robot operation.

Design overview

  • Devices are explicitly registered by name before debugging is enabled.
  • No NetworkTables listeners or control hooks are installed until debugging is explicitly enabled via /Debug/Enable.
  • Once enabled, this class publishes per-device debug topics and installs listeners to apply configuration changes live.

Safety model

Debug functionality is gated behind an explicit NetworkTables boolean (/Debug/Enable) to prevent accidental configuration changes during normal operation. Once enabled, the enable listener is removed and debugging remains active for the lifetime of the program.

This class is not thread-safe and is expected to be initialized and used during robot startup before devices are actively commanded.

Support for additional device types and parameters (e.g. CANcoders, current limits, inversion, soft limits) may be added in the future.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Initializes the debug system and installs the global enable listener.
    static void
    register(String name, com.ctre.phoenix6.hardware.CANcoder cancoder)
    Registers a CANcoder for future runtime debugging.
    static void
    register(String name, com.ctre.phoenix6.hardware.TalonFX talon)
    Registers a TalonFX for runtime debugging.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • initialize

      public static void initialize()
      Initializes the debug system and installs the global enable listener.

      This method publishes /Debug/Enable (default false) and waits for it to be set true. When enabled, all registered devices will have their debug topics created and listeners installed.

      This method should be called exactly once during robot initialization.

    • register

      public static void register(String name, com.ctre.phoenix6.hardware.TalonFX talon)
      Registers a TalonFX for runtime debugging.

      The provided name is used as part of the NetworkTables path: /Debug/TalonFX/<name>.

      Registration must occur before debugging is enabled.

      Parameters:
      name - human-readable identifier for the device
      talon - TalonFX instance to expose for debugging
    • register

      public static void register(String name, com.ctre.phoenix6.hardware.CANcoder cancoder)
      Registers a CANcoder for future runtime debugging.

      This method currently records the device but does not yet expose any debug controls. It exists to allow future expansion without changing registration semantics.

      Registration must occur before debugging is enabled.

      Parameters:
      name - human-readable identifier for the device
      cancoder - CANcoder instance to register