Logging

Network Tables Logging

ThriftyNova controllers automatically support integration with NetworkTables, making it easy to view motor data in real-time using tools like Shuffleboard or Glass.

 * Enables or disables NetworkTables logging for this motor controller.
 * 
 * <p>When enabled, motor data will be automatically published to NetworkTables
 * for viewing in Shuffleboard or other dashboard applications.</p>
 * 
 * @param enabled True to enable logging, false to disable.
 */
public void setNTLogging(boolean enabled) { ... }

Example Usage:

// Enable logging for a specific motor
motor.setNTLogging(true);

// Disable logging to reduce network traffic during competition
motor.setNTLogging(false);

Default Logged Values

When NetworkTables logging is enabled, the following values are automatically published:

// Values published to NetworkTables when setNTLogging(true) is called
// and updateStatusNT() is called either manually or through periodic updates

"position"         // Current position from the selected encoder
"velocity"         // Current velocity from the selected encoder
"voltage"          // Output voltage
"stator_current"   // Stator current in amps
"supply_current"   // Supply current in amps
"temperature"      // Controller temperature in °C
"io"               // IO state as integer (can be decoded with getIOState())
"closed_loop_error" // Error between setpoint and actual position/velocity

Global Status Updates

The ThriftyNova API provides a static method to update all motor controllers' NetworkTables values at once:

/**
 * Updates the network tables for all ThriftyNova motors.
 * This is a convenient way to update all motors at the same time,
 * typically called from robotPeriodic().
 */
public static void updateStatusNTGlobal() { ... }

Example Usage in Robot Code:

@Override
public void robotPeriodic() {
    // Update all ThriftyNova motors' telemetry data
    ThriftyNova.updateStatusNTGlobal();
    
    // Other periodic robot code
    CommandScheduler.getInstance().run();
}

Individual Status Updates

You can also update NetworkTables values for individual motor controllers:

/**
 * Updates NetworkTables entries for this motor controller.
 * This calls all status getters and publishes their values to NetworkTables.
 */
public void updateStatusNT() { ... }

Example Usage:

// In a subsystem's periodic method
@Override
public void periodic() {
    // Update just this motor's telemetry
    shooterMotor.updateStatusNT();
    
    // Other subsystem code
}

Last updated

Was this helpful?