May 2024 — Aug 2024RoboMaster field deployment · Open source

Swerve Chassis & Power Control

Algorithm & Embedded Development · Independently Built and Open-Sourced

Built regression features from motor speed and torque, used measured total power from the supercapacitor or conditionally trusted referee data as the label, and integrated online identification, allocation, and energy constraints into a 1000 Hz control task.

Identification
1000 Hz task; RLS updates only when label and dead-zone conditions hold
Hardware dependency
Existing motor feedback and system-level power data; no additional bus sensor
Reuse
Mecanum / omni / swerve / wheel-legged
Season result
Zero over-power health deductions
The module was reused on mecanum, omni, swerve, and wheel-legged chassis, with public code and documentation. The 2024 team incurred no referee health deductions from chassis over-power.

Background

Built regression features from motor speed and torque, used measured total power from the supercapacitor or conditionally trusted referee data as the label, and integrated online identification, allocation, and energy constraints into a 1000 Hz control task.

The module was reused on mecanum, omni, swerve, and wheel-legged chassis, with public code and documentation. The 2024 team incurred no referee health deductions from chassis over-power.

1000 Hz is the 1 ms FreeRTOS power-task period, not a claim that RLS updates on every cycle; updates also depend on label trust, dead zones, energy state, and disconnect conditions.

My contribution

  • Built regression features from motor speed and torque, with valid measured total power as the RLS label.
  • Implemented RLS estimation, power-budget allocation, allowable-torque inversion, and the energy loop.
  • Defined degradation paths for referee, supercapacitor, and individual-motor disconnects.
  • Adapted the module to multiple chassis, validated it on hardware, and published code and documentation.
Technical environment
STM32 · FreeRTOS · 1 kHz Power-Control Task · Online Power Model · Energy Loop · Swerve Kinematics · Fault Degradation

Implementation

Feedback validity

Motor feedback forms the features; supercapacitor chassis power, or conditionally trusted referee power during degradation, supplies the measured label.

Online model

The power-control task runs every 1 ms; RLS updates model parameters only when label trust, dead-zone, and connection conditions hold.

Power allocation

Speed error and predicted power determine each motor's budget before allowable torque is solved.

Energy and degradation

Referee buffer or supercapacitor energy adjusts the total limit; label availability, energy state, and disconnect combinations determine whether identification continues.

How information enters the system
Motor speed + torqueRegression features
Measured total chassis powerCapacitor; referee data only under trusted conditions
RLS · 1 ms taskUpdates when label, dead-zone, and connection conditions hold
Per-motor predicted powerDemand weighting and total-budget allocation
Allowable torqueReferee / capacitor energy path constrains total limit

Disconnect conditions and actual behavior

Input stateModel updatePower / energy limitOutput behavior
Referee, supercapacitor, and motor feedback validMotor speed / torque form features; capacitor chassis power is the label, and RLS updates when dead-zone conditions holdReferee limit and capacitor energy loop jointly constrain powerBudgets are allocated from demand and predicted power
Referee offline; capacitor and motors validThe capacitor still supplies a measured total-power label, so eligible RLS updates may continueA conservative local referee limit is combined with capacitor energy feedbackAllocation continues within the calculated conservative limit
Capacitor offline; referee and motors validReferee total power becomes the label only when capacitor energy is judged depleted and the message is valid; otherwise updates stopFalls back to referee power and buffer-energy pathsUses a more conservative limit while awaiting capacitor recovery
One motor-feedback link offlineThe older implementation retained recent speed / torque for up to about 1 s before exclusion instead of assuming zero power immediatelyThe total limit still follows the current referee / capacitor stateThe disconnected motor does not continue normal drive; remaining motors operate within the budget
Referee and capacitor both offlineNo trusted total-power label; online updates stop and model estimation is usedThe energy loop is disabled and a conservative limit is derived from the last known levelTotal output is constrained until either measurement path recovers

Technical decisions

No extra bus sensing

Context
Dedicated current/voltage sensing would add hardware, calibration, and deployment complexity across chassis.
Choice
Constructed features from existing motor feedback and reused total chassis-power measurements already available from the capacitor or referee system.
Delivered result
The software remained portable with no new sensing dependency.

Explicit update conditions over one validity flag

Context
Disconnected, CRC-failed, or stale samples can rapidly corrupt parameters and affect allocation for every motor.
Choice
Made measured-label trust, energy state, and disconnect combinations explicit. A newly disconnected motor briefly retains its latest feedback for conservative power estimation before exclusion.
Delivered result
RLS updates and power limits no longer share one ambiguous online state; each input combination has an inspectable behavior.

Debugging process

From implicit stale data to an explicit fault matrix

Identification converged on normal data, but disconnected hardware could leave stale values looking like fresh samples.

Symptoms

  • Immediately treating a newly disconnected motor as zero power could underestimate decaying mechanical and electrical power.
  • The total power limit had no consistent meaning when referee or capacitor data disappeared.

Investigation

  • Disconnected referee, capacitor, and motors one at a time while recording model inputs and torque limits.
  • Wrote the state combinations as a failure matrix and checked every path for stale data.

Root cause

Regression features, total-power labels, and energy limits come from different devices. One online/offline flag cannot represent cases where capacitor measurement remains valid, referee data disappears, or motor feedback has only just timed out.

Fixes

  • Used supercapacitor total power as the primary label; with the capacitor offline, referee total power is used only when capacitor energy is judged depleted and the referee message is valid.
  • Allowed measured updates to continue when referee data is absent but capacitor measurement remains valid; disabled online updates when neither source is trustworthy.
  • Retained recent speed/torque feedback briefly after a motor disconnect, then excluded it to avoid an immediate underestimate.
  • Separated abnormal state handling from normal allocation instead of relying on implicit fallbacks.

Validation & evidence

  • Ran disconnect, recovery, charging, and supplementary-power hardware tests while observing parameters and output continuity.
  • Reused the module across chassis and completed the season without over-power health deductions.
Lesson

Online algorithms depend first on input semantics: define what is trustworthy before optimizing convergence or performance.

Validation & evidence

  1. Verified the model and energy paths with RLS, charging, supplementary-power, and swerve hardware footage.
  2. Reused the module on mecanum, omni, swerve, and wheel-legged chassis.
  3. The 2024 fleet incurred no referee health deductions from chassis over-power. This is a season result of the complete electrical system, tuning, and operation—not a standalone accuracy metric for the model.

1000 Hz is the 1 ms FreeRTOS power-task period, not a claim that RLS updates on every cycle; updates also depend on label trust, dead zones, energy state, and disconnect conditions.

Development & field media

Public references