INAV PID Parameter Tuning
I. PID Tuning Explanation
In INAV, every aspect of flight dynamics is controlled by the selected PID controller. PID is an algorithm that uses real-time adjustments based on gyro and/or accelerometer data (depending on flight mode) according to RC transmitter stick inputs to ensure the aircraft maintains stable flight.
What are PIDs?
PIDs are a set of parameters used to adjust the behavior of the PID controller. The optimal PID settings for each aircraft are different, so if you can't find shared settings that exactly match your configuration, you typically need to achieve the best flight performance through repeated test flights and tuning.
How PID Works:
The goal of the PID controller is to make the aircraft's rotation rates on the roll, pitch, and yaw axes follow the target rates set by your stick inputs as precisely as possible.
The system calculates the "error" (the difference between the target rate and the actual rate), and then the controller makes adjustments based on this error, striving to reduce it to zero to achieve stable control.
For fixed-wing aircraft, INAV uses a PIFF controller, which differs logically from multirotor PID controllers.
II. Meaning of PID Parameters
P (Proportional)
Controls the immediate correction force when the aircraft deviates from the target angle or rotation rate.
- P too low: The aircraft responds sluggishly, making the controls feel "soft" and unstable.
- P too high: The aircraft will exhibit rapid shaking or oscillation (high-frequency oscillation).
I (Integral)
Used to correct small errors that accumulate over time, such as drift caused by wind. - I too low: The aircraft will slowly deviate from its attitude during flight, exhibiting "drift".
- I too high: The aircraft will exhibit low-frequency oscillation, with slower and "muted" response.
D (Derivative)
By analyzing the trend of error changes, it prevents overshoot in advance, improving the overall stability of the system. - When the error rapidly approaches zero, the D term reduces the control output, thereby avoiding back-and-forth oscillation caused by excessive reaction.
- When properly tuned, the D term can effectively reduce oscillations caused by high P values, but setting it too high will introduce noise and delay.
III. TPA Related Information
TPA (Throttle PID Attenuation) is a mechanism that gradually reduces PID values as throttle increases, commonly used to suppress high-throttle oscillations in "aggressively tuned" multirotors.
When throttle approaches maximum, the aircraft is prone to high-speed oscillations due to increased airflow disturbance and excessive response. At this point, automatically reducing P and D terms through TPA can improve stability.
Key Parameter Descriptions:
TPA: Represents the percentage by which P/D terms should be reduced at full throttle (maximum throttle value). For example: TPA = 0.5 (i.e., 50%), meaning P/D terms will be reduced by 50% at full throttle.- tpa_breakpoint: Specifies the throttle value at which to start attenuation, usually in PWM units (range 1000-2000). For example: tpa_breakpoint = 1500 means PID values start being gradually attenuated when throttle exceeds 1500.
For example:
Assuming TPA = 50 (or 0.5 in the graphical interface), tpa_breakpoint = 1500 (assuming throttle range is 1000-2000): - When the throttle channel is at 1500, PID parameters start being reduced.
- When throttle reaches 3/4 (1750), PID parameters are reduced by approximately 25% (at the midpoint between 1500 and 2000, so the reduction is half of the set TPA value, i.e., half of 50% = 25%).
- When throttle is full (2000), the full TPA reduction value is applied (50% reduction in this example).
Note: TPA (Throttle PID Attenuation) may cause rotation rates to increase as throttle is raised.
Important Notes: - Not all PID controllers support TPA (some special INAV PID modes may ignore it).
- Setting TPA too high may cause overly sluggish response at high throttle, affecting flight controller performance.
- TPA primarily affects P and D terms, with typically no effect on the I term.
- TPA settings are configured in the GUI PID tuning interface or via CLI commands (parameter names: tpa and tpa_breakpoint).
Why Use TPA?
When your aircraft experiences oscillations/vibrations at high throttle (such as 3/4 throttle or higher), it indicates that the PID controller is overreacting to disturbances under high load, causing system instability. Using TPA at this point can effectively suppress oscillations and improve flight stability.
————This article is referenced from the INAV official website: https://github.com/iNavFlight/inav/blob/master/docs/PID%20tuning.md