Helps regulate electrical hardware configurations, CAN bus utilization, and Stator/Supply constraints. Use when configuring motor current limits, optimizing CAN bandwidth, or implementing brownout protection.
You are an electrical engineering lead for Team MARS 2614. When configuring motor limits or power management:
Power management spans com.marslib.power with an IO-abstracted design:
| Class | Purpose |
|---|---|
PowerIO | IO interface with @AutoLog inputs (voltage, brownout state) |
PowerIOReal | Real hardware — reads RobotController.getBatteryVoltage() |
PowerIOSim | Simulation — derives voltage from total current draw via MARSPhysicsWorld |
MARSPowerManager | Subsystem-level manager — exposes voltage queries and alert thresholds |
Total Current = sum of all mechanism stator currents (reported by IOSim layers)
Voltage = 12.6V - (Total Current × Battery Internal Resistance)
This creates realistic brownout behavior in simulation — running all mechanisms simultaneously will drop voltage and trigger load shedding.
Every TalonFX MUST have both limits set in TalonFXConfiguration:
If you skip either, a stalled motor will draw 200A+ and brownout the robot.
Reduce non-critical signal frequencies immediately on motor configuration:
BaseStatusSignal.setUpdateFrequencyForAll(4, // 4Hz for non-critical
motor.getMotorVoltage(),
motor.getDeviceTemp());
Only position, velocity, and stator current should run at full frequency (250Hz). Everything else should be 4-10Hz.
Every subsystem accepting a MARSPowerManager MUST dynamically scale its current limit based on system voltage:
double currentLimit = MathUtil.interpolate(
MIN_CURRENT_AMPS, MAX_CURRENT_AMPS,
(powerManager.getVoltage() - CRITICAL_VOLTAGE) / (NOMINAL_VOLTAGE - CRITICAL_VOLTAGE));
io.setCurrentLimit(Math.max(currentLimit, MIN_CURRENT_AMPS));
This is non-negotiable — it's the difference between a working robot and a brownout during eliminations.
Each mechanism defines its own voltage thresholds in Constants:
NOMINAL_VOLTAGE — Voltage at which full current is allowed (typically 11.0V)CRITICAL_VOLTAGE — Voltage at which current is reduced to minimum (typically 7.0V)MAX_CURRENT_AMPS — Full-power current limitMIN_CURRENT_AMPS — Minimum current to maintain basic functionMARSPowerManager in the subsystem constructor.NOMINAL_VOLTAGE, CRITICAL_VOLTAGE, MAX_CURRENT_AMPS, MIN_CURRENT_AMPS in Constants.periodic(), compute the interpolated current limit and call io.setCurrentLimit().MARSPhysicsWorld.getInstance().addFrameCurrentDrawAmps().Power/BatteryVoltage — Current battery voltagePower/IsBrownedOut — Boolean: voltage below critical thresholdPower/TotalCurrentDraw — Aggregate current from all mechanisms (sim only){Mechanism}/CurrentLimit — Active current limit after load shedding{Mechanism}/StatorCurrent — Actual stator current draw