Expand description
Reference-free racing MPPI with a motor-lag and battery-sag powertrain.
This deepens crate::racing_mppi_motor one more level: between the
commanded rotor thrusts and the rigid-body physics it inserts a powertrain
with two unmodeled-by-the-planner effects that every real racing quad has.
- First-order motor lag. A rotor cannot change thrust instantly; the
actual thrust tracks the command through a first-order spin-up lag with
time constant
motor_tau. Aggressive attitude flicks are therefore smeared in time — the torque the body actually feels lags the command. - Battery sag. The available per-rotor thrust ceiling is not constant. It droops instantaneously with electrical load (internal resistance) and permanently as the pack’s state of charge falls over the run. A drone that flies hard early has less authority late in the race.
The powertrain is built by composition: it reuses
MotorQuadParams::step verbatim for the translational and rotational
physics and only adds the actuator front-end (lagged rotor thrusts plus a
battery state). With the PowertrainParams::ideal constructor — zero lag,
no discharge, no sag — it reduces exactly to the motor-level model, which is
the baseline the benchmark compares against.
PowertrainStatewraps aMotorQuadStatewith the actual (lagged) rotor thrusts and the battery state of charge.PowertrainParamsholds the baseMotorQuadParamsplus the lag, discharge, and sag coefficients, and exposesPowertrainParams::step.simulate_powertrain_racedrives the powertrain-unawareMotorMppiController(which plans assuming ideal actuators) through the real powertrain and reportsPowertrainLapReport, adding battery and ceiling-saturation metrics. The honest result is how much an idealized plan costs when it meets a laggy, sagging powertrain.PowertrainMppiControlleris the powertrain-aware answer: it rolls candidates out throughPowertrainParams::step, so it plans within the deliverable authority and conserves charge for later gates.simulate_powertrain_race_awareruns it through the same closed loop.ChargeBudgetadds an explicit energy term to the aware controller, penalizing below-reserve current draw so it can trade lap progress for charge held back;simulate_powertrain_race_budgetedruns it.PowertrainParams::with_recoveryadds a relaxation overpotential so the terminal voltage (and thus the thrust ceiling) recovers when the load eases, even as the state of charge only ever falls.
Structs§
- Charge
Budget - Powertrain-aware MPPI controller.
- Powertrain
LapReport - Lap-progress, attitude, and powertrain (lag + battery) metrics.
- Powertrain
Mppi Controller - Powertrain
Params - Powertrain parameters layered on top of the base motor model.
- Powertrain
State - State of the powertrain-level quadrotor.
Functions§
- simulate_
powertrain_ race - Drive the powertrain-unaware MPPI controller through the real powertrain.
- simulate_
powertrain_ race_ aware - Drive the powertrain-aware MPPI controller through the real powertrain.
- simulate_
powertrain_ race_ budgeted - Drive a charge-budgeted powertrain-aware controller through the powertrain.