0
0
Pcb-designHow-ToIntermediate · 4 min read

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:

  1. Connect your drone to Mission Planner.
  2. Go to the Full Parameter List.
  3. Find ATC_RAT_RLL_P, ATC_RAT_RLL_I, and ATC_RAT_RLL_D.
  4. Start by increasing P slowly until you see oscillations in roll during flight.
  5. Reduce P slightly to stop oscillations.
  6. Increase I to reduce drift or steady errors.
  7. Adjust D to 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 P too high: Causes continuous oscillations and unstable flight.
  • Ignoring I term: Leads to drift and poor position hold.
  • Overusing D term: 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

ParameterDescriptionTypical Starting Value
ATC_RAT_RLL_PRoll axis proportional gain0.15 - 0.25
ATC_RAT_RLL_IRoll axis integral gain0.10 - 0.15
ATC_RAT_RLL_DRoll axis derivative gain0.002 - 0.005
ATC_RAT_PIT_PPitch axis proportional gain0.15 - 0.25
ATC_RAT_PIT_IPitch axis integral gain0.10 - 0.15
ATC_RAT_PIT_DPitch axis derivative gain0.002 - 0.005
ATC_RAT_YAW_PYaw axis proportional gain0.08 - 0.12
ATC_RAT_YAW_IYaw axis integral gain0.04 - 0.06
ATC_RAT_YAW_DYaw axis derivative gain0.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.