Dynamic Power Shedding
Modern FRC hardware—specifically Krakens and Falcons—can pull more power than a 12V battery can safely provide. MARSLib approaches this ceiling as an opportunity for Innovation. By implementing dynamic Power Shedding, we ensure our robot has the maximum Impact on the field without compromising hardware Safety. This journey of Discovery teaches every programmer how to manage finite electrical resources—a critical skill for professional engineering.
1 The Problem with Static Limits
Section titled “1 The Problem with Static Limits”Most teams solve this by configuring static breaker current limits. This is a compromise. It neuters your robot’s acceleration when the battery is fully charged at 12.8V just to protect it when it drops to 9V.
2 MARSPowerManager: Voltage Scaling
Section titled “2 MARSPowerManager: Voltage Scaling”In MARSLib, we use the MARSPowerManager to implement Voltage Scaling and Power Shedding. Instead of static stator current bounds, our subsystems dynamically cap their output voltage based on the real-time health of the battery.
// Inside an IO implementation's periodic loopdouble currentSystemVoltage = MARSPowerManager.getInstance().getBatteryVoltage();double maxAllowedVoltage = 12.0;
if (currentSystemVoltage < 9.5) { // Battery is sagging heavily, shed power from non-essentials maxAllowedVoltage = 3.0; // Throttle intake to prevent brownout}
motor.setVoltage(MathUtil.clamp(requestedVoltage, -maxAllowedVoltage, maxAllowedVoltage));3 Subsystem Priority Classes
Section titled “3 Subsystem Priority Classes”Not all subsystems are created equal. When the MARSPowerManager detects a critical system voltage sag (e.g., < 9.5V), it initiates a lockdown phase. The framework groups mechanisms into three distinct tiers:
-
TIER 1 (Critical): Drivetrain Swerve Modules. These never scale down. Losing traction or evasiveness is unacceptable.
-
TIER 2 (High): Shooter Flywheels & Pivot. Voltage output is slightly scaled to ensure consistent shots, but not remove.
-
TIER 3 (Sheddable): Intakes, Feeders, and LEDs. If the voltage drops to 9V, these subsystems are aggressively clamped to a maximum output of 2-3 Volts until the battery recovers.
📖 Further Reading & External Resources
Section titled “📖 Further Reading & External Resources”-
WPILib: RoboRIO Brownout Protection - Detailed hardware specifications for voltage thresholds.
-
CTRE: Actuator Limits - Configuring stator and supply current limits on TalonFX.