Recently, developers at the Drone Freedom Workshop have been building their own quadcopters, mostly based on open-source flight controllers like PX4, APM, and INAV. Before diving into flight controller development, one common challenge immediately surfaces: the default PID parameters on open-source flight controllers don’t always guarantee stable flight. PID tuning is the core of quadcopter flight control — it directly determines your drone’s stability, responsiveness, and flight feel. For most developers working with newly purchased or freshly assembled drones, the default conservative parameters can make flight feel sluggish, while blindly increasing gains risks dangerous oscillations.
This guide, brought to you by Aomway, walks you step by step through PID tuning from basics to advanced techniques using PX4 and APM official tuning guides, explained in plain, accessible language, so you can get your drone performing at its best.
Official references:
1. Tuning Preparation
1.1 PID Parameter Logic
Proportional Gain (P): Reduces tracking error and speeds up response. Should be set as high as possible without introducing oscillation.
- Too high: High-frequency oscillation — the drone “shakes non-stop”
- Too low: Sluggish response to transmitter inputs, prone to drifting in Acro mode
Derivative Gain (D): Provides rate damping and suppresses overshoot. Should also be set as high as possible.
- Too high: Motors become “jittery,” prone to overheating, and amplify sensor noise
- Too low: Noticeable overshoot after step inputs (e.g., the drone tilts excessively after a stick push)
Integral Gain (I): Eliminates steady-state error, ensuring the drone maintains the commanded attitude.
- Too high: Slow, low-frequency oscillation
- Too low: In Acro mode, the drone will gradually return to level after a 45° tilt instead of holding the angle
1.2 Critical Safety Warning
- All gain adjustments MUST be made after landing — never adjust parameters mid-flight
- Limit each gain adjustment to 20%-30%, and once you find the optimal value, reduce it by 5%-10% to leave a safety margin
- First test flights must be conducted in an open, unoccupied area, maintaining safe distance
1.3 Basic Tuning Principles
PX4 flight controllers use a multi-layer closed-loop control architecture:
- Inner loop (Rate Controller): Controls angular velocity across roll, pitch, and yaw axes — this is the foundation of the entire control system
- Outer loop (Attitude Controller): Controls the drone’s attitude angles, outputting target angular velocity to the inner loop
There are also position and velocity loops for position control, but these have minimal impact on oscillation issues and won’t be covered in detail here. The tuning approach follows the same principles.
Tuning must follow the inner-loop-first, outer-loop-second sequence. If the inner loop isn’t tuned properly, no amount of outer-loop tuning will help.
1.4 Flight Mode Selection
- Stabilize / AltHold mode: Recommended for attitude tuning
- Acro mode: Use for rate controller tuning — it isolates the influence of the attitude loop, letting you focus on evaluating rate control performance
Be careful to distinguish whether a problem originates from the rate controller or the attitude controller.
1.5 Basic Tuning Logic
If your drone has a symmetric frame, you can quickly tune the roll and pitch axes simultaneously. If the frame is asymmetric, tune each axis independently.
If the drone oscillates or shakes during flight, do NOT make large, aggressive stick movements. Smoothly reduce throttle to land, while using very small, slow roll and pitch inputs to control attitude and position. For single-axis tuning:
- If the axis already shows oscillation, first reduce P, D, and I parameters by 50% increments until the drone stabilizes, then begin manual tuning
- Increase D (derivative) gain by 50% increments until oscillation appears
- Decrease D gain by 10% increments until oscillation fully disappears
- Reduce D gain by an additional 25%
- Increase P (proportional) gain by 50% increments until oscillation appears
- Decrease P gain by 10% increments until oscillation fully disappears
- Reduce P gain by an additional 25%
- After each P adjustment, set the I (integral) gain to the same value as P
It’s recommended to modify parameters on the ground with the drone disarmed and powered off. Experienced pilots may also adjust parameters in-flight via the ground station or transmitter tuning knobs.
2. Tuning Methodology
Flight controllers like PX4 use Proportional-Integral-Derivative (PID) controllers, the most widely adopted flight control algorithm today.
The QGroundControl PID tuning interface displays real-time target command curves alongside attitude response curves. The core tuning objective: optimize P/I/D parameters so the drone’s actual response curve tracks the target curve as closely as possible — achieving fast response, zero overshoot, and no oscillation.
QGC Rate Controller Tuning UI
The flight controller uses a layered architecture: upper-layer controllers output commands that are passed to lower-layer controllers for execution. From top to bottom: Rate Controller → Attitude Controller → Velocity & Position Controller. PID tuning must strictly follow this order, starting with the rate controller, whose parameters directly affect all higher-level control logic.
The tuning method is the same across all controllers (rate, attitude, velocity/position) and all flight axes (yaw, roll, pitch): make quick, large-amplitude stick movements to create step-input command changes, observe the drone’s attitude response curve, and drag parameter sliders to optimize tracking performance.
Rate controller tuning is the most critical step. Once it meets standards, the remaining controllers typically require no adjustment or only minor fine-tuning.
For rate controller tuning, use Acro / Stabilize / AltHold modes. For velocity and position controller tuning, use Position mode with Simple Position Control enabled for easier step-input commands.
Let’s now walk through an actual rate controller tuning case study. Attitude tuning follows similar principles.
2.1 Rate Controller (Inner Loop) Tuning
The rate controller is the innermost control loop, and its quality directly affects performance across all flight modes. A poorly tuned drone will show “twitching” or persistent oscillation even in Position mode.
Step 1: Adjust Proportional Gain (P)
- Slowly take off and hover
- Quickly push the roll/pitch stick then snap it back to center, observing the drone’s response
- Increase
MC_ROLLRATE_KandMC_PITCHRATE_Kby 20% each iteration - Stop when mild high-frequency oscillation appears, then back off by 10%-20%
Step 2: Adjust Derivative Gain (D)
- Typical values (Standard mode): 0.01 (4-inch racer) to 0.04 (500mm wheelbase drone)
- Increase D until you see jittery motor behavior, then back off
Step 3: Adjust Integral Gain (I)
- Typical values (Standard mode): 1 (500mm wheelbase drone) to 8 (4-inch racer)
- Pitch gain is usually slightly higher than roll gain
- Increase I until slow oscillation appears, then back off
3. Log Analysis: Making Tuning Scientific
Visual observation alone can’t precisely evaluate tuning results. PX4’s log analysis capabilities help you assess control performance more scientifically.
After tuning, download the flight log and examine these curves:
Angular velocity curves: The desired angular velocity and actual angular velocity should overlap as closely as possible, with minimal overshoot and no sustained oscillation.
A well-tuned log, under quick step inputs, will show only very minor overshoot in actual angular velocity, which then rapidly tracks the desired value.
Examples of well-tuned logs:
4. Summary
The Tuning Mnemonic
Inner loop first, then outer loop. P first, then D, then I.
Small adjustments each time; if oscillation appears, back it off.
Common Issue Troubleshooting
| Symptom | Likely Cause |
|---|---|
| High-frequency jitter | Rate controller P or D gain too high |
| Slow oscillation | Rate controller I gain too high |
| Position mode drift | First check if rate controller is stable, then adjust attitude controller gain |
To all Drone Freedom Workshop developers: PID tuning is a process that requires patience and experience. There are no absolutely perfect parameters — only the ones best suited to your aircraft and flying style. Fly more, tune more, analyze logs more — you’ll quickly master this skill and make your drone stable as a rock in the air. Keep flying!
Frequently Asked Questions
Q: What is PID tuning and why is it important for quadcopters?
PID tuning adjusts the Proportional, Integral, and Derivative gains in a drone’s flight controller to achieve stable, responsive flight. Without proper tuning, a quadcopter may oscillate, drift, or respond sluggishly to control inputs. At Aomway, we emphasize that well-tuned PID parameters are the difference between a drone that fights you and one that feels like an extension of your hands.
Q: Should I tune the inner rate loop or outer attitude loop first?
Always tune the inner rate controller loop first. The rate controller is the foundation — its parameters directly affect all higher-level control loops. If the rate controller isn’t stable, no amount of attitude tuning will fix the underlying oscillation issues. Follow the sequence: rate controller → attitude controller → velocity & position controller.
Q: What percentage should I adjust PID gains by during tuning?
Start with 50% increments when searching for the oscillation threshold, then fine-tune with 10% decrements once oscillation appears. After finding the stable point, reduce gains by an additional 25% as a safety margin. Never adjust more than 20-30% at a time, and always make changes while landed — never in-flight.
Q: How do I use flight logs to evaluate my PID tune?
Download flight logs after tuning and examine the angular velocity curves. The desired and actual angular velocity should overlap closely with minimal overshoot and no sustained oscillation. A well-tuned log shows minor overshoot after step inputs with rapid tracking convergence. Tools like PlotJuggler or QGroundControl’s built-in log viewer make this analysis straightforward.
Q: What flight modes should I use for PID tuning?
Use Acro mode for rate controller tuning — it isolates the rate loop from attitude influence. Use Stabilize or AltHold modes for attitude-level tuning. Position mode with Simple Position Control enabled is best for velocity and position controller tuning. At Aomway, we recommend starting in Acro mode for the rate controller before moving to other modes.
Originally published by 无人机自由开发坊 on WeChat. Translated and adapted for Aomway readers.
