|
libstp
Robotics library for Botball
|
Tunes the per-motor firmware-side velocity PID (STM32 MAV mode). More...
#include <firmware_pid_tune.hpp>
Public Member Functions | |
| FirmwarePidTuner (const std::vector< hal::motor::IMotor * > &motors, hal::imu::IIMU *imu=nullptr) | |
| FirmwarePidResult | tuneMotor (hal::motor::IMotor *motor, int max_bemf_speed, const FirmwarePidConfig &cfg) const |
| Tune a single motor. | |
| std::map< int, FirmwarePidResult > | tune (const std::map< int, int > &max_bemf_speeds, const FirmwarePidConfig &cfg) const |
| Tune every motor passed at construction. | |
Tunes the per-motor firmware-side velocity PID (STM32 MAV mode).
For each motor the tuner records a baseline step response in BEMF units, fits a FOPDT plant model, derives CHR PID gains, pushes them to the firmware via IMotor::setFirmwarePidGains() and re-runs the step response. Gains are accepted only if the tuned ISE is strictly smaller than the baseline ISE.
Definition at line 25 of file firmware_pid_tune.hpp.
|
explicit |
| motors | Non-owning list of motors to tune. |
| imu | Optional IMU pointer — when non-null, every CSV dump includes the gyro/accel/heading readings sampled in the same tight loop as the motors. |
|
nodiscard |
Tune every motor passed at construction.
Motors without an entry in max_bemf_speeds are skipped with a warning.
| max_bemf_speeds | Map from port -> max BEMF speed. |
| cfg | Shared tuning configuration. |
|
nodiscard |
Tune a single motor.
| motor | Motor to tune. |
| max_bemf_speed | Steady-state BEMF (firmware velocity units) at full power for this motor — typically derived from a DriveCharacterizer-style sweep. |
| cfg | Tuning configuration. |