![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Vertical control: height -> climb rate -> collective thrust. More...
Go to the source code of this file.
Data Structures | |
| struct | alt_ctrl_t |
Functions | |
| void | alt_ctrl_init (alt_ctrl_t *c, float hover) |
| void | alt_ctrl_reset (alt_ctrl_t *c, float integ) |
| float | alt_ctrl_vz_sp (const alt_ctrl_t *c, float h_sp, float h, float vz_up, float vz_dn) |
| float | alt_ctrl_step (alt_ctrl_t *c, float vz_sp, float vz, float cos_tilt, float dt) |
Vertical control: height -> climb rate -> collective thrust.
vz_sp = clamp(kp_h * (h_sp - h), -vz_dn, +vz_up) (or from the stick) thrust = (hover + kp_v * (vz_sp - vz) + I) / cos(tilt), I += ki_v * e * dt
The integrator learns the hover thrust. Output 0..1 (collective), clamped. Host-testable.
Definition in file alt_ctrl.h.
| void alt_ctrl_init | ( | alt_ctrl_t * | c, |
| float | hover | ||
| ) |
Definition at line 8 of file alt_ctrl.c.
References alt_ctrl_t::hover, alt_ctrl_t::i_lim, alt_ctrl_t::integ, alt_ctrl_t::ki_v, alt_ctrl_t::kp_h, alt_ctrl_t::kp_v, alt_ctrl_t::thr_max, and alt_ctrl_t::thr_min.
Referenced by fc_init().
| void alt_ctrl_reset | ( | alt_ctrl_t * | c, |
| float | integ | ||
| ) |
Definition at line 17 of file alt_ctrl.c.
References clampf(), alt_ctrl_t::i_lim, and alt_ctrl_t::integ.
Referenced by exec().
| float alt_ctrl_vz_sp | ( | const alt_ctrl_t * | c, |
| float | h_sp, | ||
| float | h, | ||
| float | vz_up, | ||
| float | vz_dn | ||
| ) |
Definition at line 19 of file alt_ctrl.c.
References clampf(), and alt_ctrl_t::kp_h.
Referenced by setpoints().
| float alt_ctrl_step | ( | alt_ctrl_t * | c, |
| float | vz_sp, | ||
| float | vz, | ||
| float | cos_tilt, | ||
| float | dt | ||
| ) |
Definition at line 24 of file alt_ctrl.c.
References clampf(), alt_ctrl_t::hover, alt_ctrl_t::i_lim, alt_ctrl_t::integ, alt_ctrl_t::ki_v, alt_ctrl_t::kp_v, alt_ctrl_t::thr_max, and alt_ctrl_t::thr_min.
Referenced by setpoints().