Skip to main content

Current Limits and Ramps

Disclaimer: WIP and untested on 2026 hardware; tune values to your drivetrain and wiring. Custom code built on WPILib APIs (not official WPILib sample).

Purpose: Apply sane current limits and ramp rates to reduce brownouts and motor stress.

TalonFX examples (Java)

public class CurrentConfigs {
public static void configDrive(TalonFX fx) {
SupplyCurrentLimitConfiguration limit = new SupplyCurrentLimitConfiguration(true, 40, 60, 0.2);
fx.configSupplyCurrentLimit(limit);
fx.configOpenloopRamp(0.2);
}

public static void configIntake(TalonFX fx) {
SupplyCurrentLimitConfiguration limit = new SupplyCurrentLimitConfiguration(true, 30, 40, 0.1);
fx.configSupplyCurrentLimit(limit);
fx.configOpenloopRamp(0.1);
}

public static void configShooter(TalonFX fx) {
SupplyCurrentLimitConfiguration limit = new SupplyCurrentLimitConfiguration(true, 50, 60, 0.1);
fx.configSupplyCurrentLimit(limit);
fx.configOpenloopRamp(0.0); // shooter needs fast response
}

public static void configClimb(TalonFX fx) {
SupplyCurrentLimitConfiguration limit = new SupplyCurrentLimitConfiguration(true, 60, 80, 0.1);
fx.configSupplyCurrentLimit(limit);
fx.configOpenloopRamp(0.1);
}
}

SparkMAX examples (Java)

public class SparkConfigs {
public static void configDrive(CANSparkMax spark) {
spark.setSmartCurrentLimit(60);
spark.setOpenLoopRampRate(0.2);
}
public static void configIntake(CANSparkMax spark) {
spark.setSmartCurrentLimit(40);
spark.setOpenLoopRampRate(0.1);
}
public static void configShooter(CANSparkMax spark) {
spark.setSmartCurrentLimit(50);
spark.setOpenLoopRampRate(0.0);
}
public static void configClimb(CANSparkMax spark) {
spark.setSmartCurrentLimit(70);
spark.setOpenLoopRampRate(0.1);
}
}

How to test

  • Check currents in telemetry during burn-in; adjust limits to avoid brownouts while keeping responsiveness.
  • Verify ramps don’t slow critical actions (e.g., shooter spin-up should stay snappy).

Pitfalls

  • Too aggressive limits can starve mechanisms; balance safety with performance.