Class DeviceDebug
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 TypeMethodDescriptionstatic voidInitializes the debug system and installs the global enable listener.static voidRegisters a CANcoder for future runtime debugging.static voidRegisters a TalonFX for runtime debugging.
-
Method Details
-
initialize
public static void initialize()Initializes the debug system and installs the global enable listener.This method publishes
/Debug/Enable(defaultfalse) and waits for it to be settrue. 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
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 devicetalon- TalonFX instance to expose for debugging
-
register
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 devicecancoder- CANcoder instance to register
-