libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::autotune::FirmwarePidConfig Struct Reference

Configuration for the FirmwarePidTuner. More...

#include <types.hpp>

Public Attributes

int raw_pwm_percent {70}
double step_fraction {0.5}
double step_duration_s {5.0}
double decel_duration_s {1.0}
 Extra samples after raw PWM is set to zero.
int sample_hz {200}
double chr_kp_scale {0.6}
double chr_ki_scale {0.6}
double chr_kd_scale {0.3}
double min_response_frac {0.10}
int identification_trials {3}
int validation_trials {3}
double accept_improvement_frac {0.02}
std::string csv_dir {}
bool use_control_theory {true}
int de_plant_steps {80}
double de_plant_min {0.0001}
double de_plant_max {5000.0}
int de_pid_steps {60}
double de_gain_max {10.0}
double de_sim_horizon_s {5.0}
double de_max_overshoot {50.0}
double de_weight_ctrl {0.0}
double de_weight_overshoot {1.0}
double de_output_max {399.0}
std::uint32_t de_seed {0xC0FFEEu}

Detailed Description

Configuration for the FirmwarePidTuner.

Per-motor analogue of VelocityTuneConfig — the tuner runs a BEMF step response, identifies a FOPDT plant, derives CHR gains, and pushes them to the STM32 firmware MAV-mode PID.

Definition at line 215 of file types.hpp.

Member Data Documentation

◆ accept_improvement_frac

double libstp::autotune::FirmwarePidConfig::accept_improvement_frac {0.02}

Definition at line 241 of file types.hpp.

◆ chr_kd_scale

double libstp::autotune::FirmwarePidConfig::chr_kd_scale {0.3}

Definition at line 232 of file types.hpp.

◆ chr_ki_scale

double libstp::autotune::FirmwarePidConfig::chr_ki_scale {0.6}

Definition at line 231 of file types.hpp.

◆ chr_kp_scale

double libstp::autotune::FirmwarePidConfig::chr_kp_scale {0.6}

CHR PID coefficients from the ControlTheory step-response tuner: Kp = 0.6*Tg/(Ks*Tu), Ki = 0.6/(Ks*Tu), Kd = 0.3*Tg/Ks.

Definition at line 230 of file types.hpp.

◆ csv_dir

std::string libstp::autotune::FirmwarePidConfig::csv_dir {}

When non-empty, dump every sample of every step response to CSV under this directory. One CSV per (motor_port, phase) plus one summary CSV with plant fits and accept/reject decisions. Lets you replay the raw data offline to iterate on the identification algorithm without re-running on hardware.

Definition at line 247 of file types.hpp.

◆ de_gain_max

double libstp::autotune::FirmwarePidConfig::de_gain_max {10.0}

Definition at line 274 of file types.hpp.

◆ de_max_overshoot

double libstp::autotune::FirmwarePidConfig::de_max_overshoot {50.0}

Definition at line 276 of file types.hpp.

◆ de_output_max

double libstp::autotune::FirmwarePidConfig::de_output_max {399.0}

Definition at line 283 of file types.hpp.

◆ de_pid_steps

int libstp::autotune::FirmwarePidConfig::de_pid_steps {60}

Definition at line 273 of file types.hpp.

◆ de_plant_max

double libstp::autotune::FirmwarePidConfig::de_plant_max {5000.0}

Definition at line 272 of file types.hpp.

◆ de_plant_min

double libstp::autotune::FirmwarePidConfig::de_plant_min {0.0001}

Definition at line 271 of file types.hpp.

◆ de_plant_steps

int libstp::autotune::FirmwarePidConfig::de_plant_steps {80}

Definition at line 270 of file types.hpp.

◆ de_seed

std::uint32_t libstp::autotune::FirmwarePidConfig::de_seed {0xC0FFEEu}

Definition at line 284 of file types.hpp.

◆ de_sim_horizon_s

double libstp::autotune::FirmwarePidConfig::de_sim_horizon_s {5.0}

Definition at line 275 of file types.hpp.

◆ de_weight_ctrl

double libstp::autotune::FirmwarePidConfig::de_weight_ctrl {0.0}

Definition at line 277 of file types.hpp.

◆ de_weight_overshoot

double libstp::autotune::FirmwarePidConfig::de_weight_overshoot {1.0}

Definition at line 278 of file types.hpp.

◆ decel_duration_s

double libstp::autotune::FirmwarePidConfig::decel_duration_s {1.0}

Extra samples after raw PWM is set to zero.

Definition at line 226 of file types.hpp.

◆ identification_trials

int libstp::autotune::FirmwarePidConfig::identification_trials {3}

Number of full parallel baseline responses used to identify the plant and establish the baseline ISE. Multiple passes reduce BEMF jitter and random floor/contact effects.

Definition at line 237 of file types.hpp.

◆ min_response_frac

double libstp::autotune::FirmwarePidConfig::min_response_frac {0.10}

Tail/|command| threshold — skip if smaller.

Definition at line 233 of file types.hpp.

◆ raw_pwm_percent

int libstp::autotune::FirmwarePidConfig::raw_pwm_percent {70}

Raw PWM percent used to identify the motor plant. All drive motors run at this power simultaneously so BEMF captures real DC-bus and chassis loading.

Definition at line 220 of file types.hpp.

◆ sample_hz

int libstp::autotune::FirmwarePidConfig::sample_hz {200}

Step-response sampling rate (Hz).

Definition at line 227 of file types.hpp.

◆ step_duration_s

double libstp::autotune::FirmwarePidConfig::step_duration_s {5.0}

Duration of the raw PWM step-response recording (s). This is the "Sprungantwort": raw power on all motors, no IMU straightening, no velocity PID.

Definition at line 225 of file types.hpp.

◆ step_fraction

double libstp::autotune::FirmwarePidConfig::step_fraction {0.5}

Fraction of measured max BEMF used for MAV validation.

Definition at line 221 of file types.hpp.

◆ use_control_theory

bool libstp::autotune::FirmwarePidConfig::use_control_theory {true}

Definition at line 269 of file types.hpp.

◆ validation_trials

int libstp::autotune::FirmwarePidConfig::validation_trials {3}

Number of full parallel validation responses after candidate gains are applied. Gains must improve the mean ISE by accept_improvement_frac.

Definition at line 240 of file types.hpp.


The documentation for this struct was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-autotune/include/autotune/types.hpp