How to Do PID Tuning in ArduPilot for Stable Flight
To do
PID tuning in ArduPilot, adjust the P, I, and D parameters using the Mission Planner or QGroundControl software to improve flight stability. Start by increasing P until oscillations appear, then adjust I to reduce steady-state error, and finally tweak D to smooth the response.Syntax
In ArduPilot, PID tuning parameters are set using specific parameter names that control the Proportional (P), Integral (I), and Derivative (D) gains for each control axis (Roll, Pitch, Yaw).
- Roll:
ATC_RAT_RLL_P,ATC_RAT_RLL_I,ATC_RAT_RLL_D - Pitch:
ATC_RAT_PIT_P,ATC_RAT_PIT_I,ATC_RAT_PIT_D - Yaw:
ATC_RAT_YAW_P,ATC_RAT_YAW_I,ATC_RAT_YAW_D
You can set these parameters via the Mission Planner's Full Parameter List or QGroundControl's Parameter Editor.
ini
ATC_RAT_RLL_P = 0.15 ATC_RAT_RLL_I = 0.10 ATC_RAT_RLL_D = 0.003 ATC_RAT_PIT_P = 0.15 ATC_RAT_PIT_I = 0.10 ATC_RAT_PIT_D = 0.003 ATC_RAT_YAW_P = 0.10 ATC_RAT_YAW_I = 0.05 ATC_RAT_YAW_D = 0.0005
Example
This example shows how to tune the Roll axis PID values using Mission Planner:
- Connect your drone to Mission Planner.
- Go to the Full Parameter List.
- Find
ATC_RAT_RLL_P,ATC_RAT_RLL_I, andATC_RAT_RLL_D. - Start by increasing
Pslowly until you see oscillations in roll during flight. - Reduce
Pslightly to stop oscillations. - Increase
Ito reduce drift or steady errors. - Adjust
Dto smooth out the response.
Repeat for Pitch and Yaw axes.
ini
ATC_RAT_RLL_P = 0.20 ATC_RAT_RLL_I = 0.12 ATC_RAT_RLL_D = 0.004
Common Pitfalls
Common mistakes during PID tuning in ArduPilot include:
- Setting
Ptoo high: Causes continuous oscillations and unstable flight. - Ignoring
Iterm: Leads to drift and poor position hold. - Overusing
Dterm: Can cause noisy and jittery control. - Changing multiple parameters at once: Makes it hard to identify which change caused an effect.
- Not testing in safe conditions: Always test tuning in a safe, open area to avoid crashes.
ini
Wrong way: ATC_RAT_RLL_P = 0.50 # Too high, causes oscillations Right way: ATC_RAT_RLL_P = 0.20 # Moderate value for stable control
Quick Reference
| Parameter | Description | Typical Starting Value |
|---|---|---|
| ATC_RAT_RLL_P | Roll axis proportional gain | 0.15 - 0.25 |
| ATC_RAT_RLL_I | Roll axis integral gain | 0.10 - 0.15 |
| ATC_RAT_RLL_D | Roll axis derivative gain | 0.002 - 0.005 |
| ATC_RAT_PIT_P | Pitch axis proportional gain | 0.15 - 0.25 |
| ATC_RAT_PIT_I | Pitch axis integral gain | 0.10 - 0.15 |
| ATC_RAT_PIT_D | Pitch axis derivative gain | 0.002 - 0.005 |
| ATC_RAT_YAW_P | Yaw axis proportional gain | 0.08 - 0.12 |
| ATC_RAT_YAW_I | Yaw axis integral gain | 0.04 - 0.06 |
| ATC_RAT_YAW_D | Yaw axis derivative gain | 0.0003 - 0.001 |
Key Takeaways
Tune PID parameters one axis at a time for clear results.
Start by increasing P gain until oscillations appear, then back off slightly.
Use I gain to correct steady-state errors and drift.
Adjust D gain to smooth control without causing jitter.
Always test PID changes in a safe, open environment.