How Can We Help?
NAV PID
NAV PID Controller
What you have to know about INAV PID/PIFF/PIDCD controllers:
- INAV PID uses floating-point math
- Rate/Angular Velocity controllers work in dps [degrees per second]
- P, I, D and Multirotor CD gains are scaled like Betafligfht equivalents, but actual mechanics are different, and PID response might be different
- Depending on platform type, different controllers are used
- Fixed-wing uses PIFF:
- Error is computed with a formula
const float rateError = pidState->rateTarget - pidState->gyroRate;
- P-term with a formula
rateError * pidState->kP
- 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;
- No D-term
- 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!
- Error is computed with a formula
- Multirotor uses PIDCD:
- Error is computed with a formula
const float rateError = pidState->rateTarget - pidState->gyroRate;
- P-term with a formula
rateError * pidState->kP
- I-term
- Iterm Relax is used to dynamically attenuate I-term during fast stick movements
- I-term formula
pidState->errorGyroIf += (itermErrorRate * pidState->kI * antiWindupScaler * dT) + ((newOutputLimited - newOutput) * pidState->kT * antiWindupScaler * dT);
- I-term can be limited when motor output is saturated
- D-term is computed only from gyro measurement
- There are 2 LPF filters on D-term
- D-term can by boosted during fast maneuvers using D-Boost. D-Boost is an equivalent of Betaflight D_min
- 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
- Error is computed with a formula
- Fixed-wing uses PIFF: