Current Limiting
Why Limit Current?
Current limiting protects motors from burning out and prevents the main breaker from tripping. It is the single most important safety configuration.
Types of Limits
Stator (Smart) Limit: Limits current inside the motor. Protects the motor from overheating. Use this for mechanism safety.
Supply (Secondary) Limit: Limits current drawn from the battery. Protects the main breaker/battery. Use this to prevent brownouts.
Supply (Secondary) Limit: Limits current drawn from the battery. Protects the main breaker/battery. Use this to prevent brownouts.
Recommended Values
Starting points:
- Drivetrain: 40A - 60A
- Intake/Roller: 20A - 30A
- Elevator/Arm: 40A - 50A
- NEO 550: NEVER exceed 20A - 25A.
Code Examples
Setting limits:
package frc.robot.subsystems;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.configs.TalonFXConfiguration;
public class Drivetrain extends SubsystemBase {
private TalonFX motor = new TalonFX(1);
// ... (other fields and methods)
public void configureCurrentLimits() {
TalonFXConfiguration config = new TalonFXConfiguration();
// Stator current limit: protects the motor from overheating
config.CurrentLimits.StatorCurrentLimitEnable = true;
config.CurrentLimits.StatorCurrentLimit = 40.0; // Amps
// Supply current limit: protects battery and prevents brownouts
config.CurrentLimits.SupplyCurrentLimitEnable = true;
config.CurrentLimits.SupplyCurrentLimit = 50.0; // Limit in amps
config.CurrentLimits.SupplyCurrentThreshold = 60.0; // Threshold to trigger
config.CurrentLimits.SupplyTimeThreshold = 0.1; // Time above threshold before limiting
motor.getConfigurator().apply(config);
}
// ... (rest of class)