Mini-Project 2: Current-Limited Drivetrain (CTRE and REV)
A fresh four-Kraken drivetrain will happily pull hundreds of amps of stall current (a single Kraken X60 stalls at ~366A at 12V in trapezoidal mode, even higher under FOC) and drop your battery below the 6.3V/6.75V brownout floor in the first second of a match. Current limits are how you trade a little top-end torque for reliable, brownout-free driving. There are two kinds, and you need to understand both.
Stator current is the current at the motor windings; it is directly proportional to torque. Capping it controls wheel slip and heat. Supply current is the current drawn from the battery (roughly stator current x duty cycle); capping it prevents breaker trips and brownouts. CTRE notes that because stator limits also bound supply current, it is sometimes unnecessary to enable both.
CTRE TalonFX / Kraken X60 (Phoenix 6, Java):
import com.ctre.phoenix6.hardware.TalonFX;import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
TalonFX driveMotor = new TalonFX(1);var limits = new CurrentLimitsConfigs();// Cap torque/slip at the wheelslimits.StatorCurrentLimit = 120;limits.StatorCurrentLimitEnable = true;// Protect the battery and 40A breakerlimits.SupplyCurrentLimit = 70;limits.SupplyCurrentLimitEnable = true;// After 1s above the lower limit, clamp down to avoid breaker triplimits.SupplyCurrentLowerLimit = 60;limits.SupplyCurrentLowerTime = 1.0;driveMotor.getConfigurator().apply(limits);The field names SupplyCurrentLowerLimit / SupplyCurrentLowerTime are the Phoenix 6 2025 replacements for the old SupplyCurrentThreshold / SupplyTimeThreshold. CTRE explicitly recommends tuning limits empirically for your robot rather than copying preset numbers; a 120A stator / 70A supply pair is a widely used community starting point for swerve drive, not an official CTRE-mandated value. Steering (azimuth) motors can run a lower stator limit (~60A) because they rarely need peak torque.
REV NEO / SPARK MAX (REVLib 2025, Java):
import com.revrobotics.spark.config.SparkMaxConfig;import com.revrobotics.spark.SparkBase.ResetMode;import com.revrobotics.spark.SparkBase.PersistMode;
SparkMaxConfig cfg = new SparkMaxConfig();cfg.smartCurrentLimit(60); // applies a single combined limitmotor.configure(cfg, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters);REV’s smartCurrentLimit() is strongly recommended for the NEO, whose low internal resistance produces dangerous current spikes if uncapped.
Tuning procedure (do this on blocks, then on carpet):
- Set NO supply limit and a high stator limit. Floor it and watch the wheels.
- Lower the stator limit until the wheels stop slipping on hard acceleration; set the limit just under that point.
- If you still see brownouts (roboRIO Power LED amber, or
RobotController.isBrownedOut()true), add a supply limit starting around 70A and lower until brownouts stop. - Log it: read
driveMotor.getStatorCurrent()andgetSupplyCurrent()to a NetworkTables/SmartDashboard graph and confirm your limits are being respected.
A well-limited drivetrain feels slightly softer off the line but never browns out, never trips a breaker mid-match, and runs cooler over a whole event.
Key takeaways
Section titled “Key takeaways”- Stator limit controls torque/wheel slip; supply limit prevents brownouts and breaker trips, and a stator limit alone also bounds supply current.
- CTRE recommends tuning current limits empirically; 120A stator / 70A supply is a common community swerve starting point, not an official CTRE value. Tune stator first, add supply only if brownouts persist.
- REV’s smartCurrentLimit() is essential for the NEO’s low-resistance spikes; SupplyCurrentLowerLimit/Time are the Phoenix 6 2025 field names.
This lesson was adapted from learnfrc.com.
