Make sure docs are updated / settings_md (push) Canceled after 0s
Build firmware / test (push) Canceled after 0s
Build firmware / build-SITL-Windows (push) Canceled after 0s
Build firmware / build-SITL-Mac (push) Canceled after 0s
Build firmware / build-SITL-Linux (push) Canceled after 0s
Build firmware / build-SITL-Linux-arm64 (push) Canceled after 0s
Build firmware / upload-artifacts (push) Canceled after 0s
Build firmware / build-single-target (push) Canceled after 0s
Build firmware / build (9) (push) Canceled after 0s
Build firmware / build (8) (push) Canceled after 0s
Build firmware / build (7) (push) Canceled after 0s
Build firmware / build (6) (push) Canceled after 0s
Build firmware / build (5) (push) Canceled after 0s
Build firmware / build (4) (push) Canceled after 0s
Build firmware / build (3) (push) Canceled after 0s
Build firmware / build (2) (push) Canceled after 0s
Build firmware / build (14) (push) Canceled after 0s
Build firmware / build (13) (push) Canceled after 0s
Build firmware / build (12) (push) Canceled after 0s
Build firmware / build (11) (push) Canceled after 0s
Build firmware / build (10) (push) Canceled after 0s
Build firmware / build (1) (push) Canceled after 0s
Build firmware / build (0) (push) Canceled after 0s
Build firmware / detect (push) Canceled after 0s
Build pre-release / build (push) Canceled after 0s
Build pre-release / Release (push) Canceled after 0s
25 lines
2.1 KiB
Markdown
25 lines
2.1 KiB
Markdown
# INAV PID Controller
|
|
|
|
What you have to know about INAV PID/PIFF/PIDCD controllers:
|
|
|
|
1. INAV PID uses floating-point math
|
|
1. Rate/Angular Velocity controllers work in dps [degrees per second]
|
|
1. P, I, D and Multirotor CD gains are scaled like Betafligfht equivalents, but actual mechanics are different, and PID response might be different
|
|
1. Depending on platform type, different controllers are used
|
|
1. Fixed-wing uses **PIFF**:
|
|
1. Error is computed with a formula `const float rateError = pidState->rateTarget - pidState->gyroRate;`
|
|
1. P-term with a formula `rateError * pidState->kP`
|
|
1. Simple I-term without Iterm Relax. I-term limit based on stick position is used instead. I-term is no allowed to grow if stick (roll/pitch/yaw) is deflected above threshold defined in `fw_iterm_limit_stick_position`. `pidState->errorGyroIf += rateError * pidState->kI * dT;`
|
|
1. No D-term
|
|
1. FF-term (Feed Forward) is computed from the controller input with a formula `pidState->rateTarget * pidState->kFF`. Bear in mind, this is not a **FeedForward** from Betaflight!
|
|
1. Multirotor uses **PIDCD**:
|
|
1. Error is computed with a formula `const float rateError = pidState->rateTarget - pidState->gyroRate;`
|
|
1. P-term with a formula `rateError * pidState->kP`
|
|
1. I-term
|
|
1. Iterm Relax is used to dynamically attenuate I-term during fast stick movements
|
|
1. I-term formula `pidState->errorGyroIf += (itermErrorRate * pidState->kI * antiWindupScaler * dT) + ((newOutputLimited - newOutput) * pidState->kT * antiWindupScaler * dT);`
|
|
1. I-term can be limited when motor output is saturated
|
|
1. D-term is computed only from gyro measurement
|
|
1. There are 2 LPF filters on D-term
|
|
1. D-term can by boosted during fast maneuvers using D-Boost. D-Boost is an equivalent of Betaflight D_min
|
|
1. **Control Derivative**, CD, or CD-term is a derivative computed from the setpoint that helps to boost PIDCD controller during fast stick movements. `newCDTerm = rateTargetDeltaFiltered * (pidState->kCD / dT);` It is an equivalent of Betaflight Feed Forward |