Hello and welcome to our community! Is this your first visit?

PID Tuning

This page is a chapter in 'AeroQuad Manual'

When first setting up your AeroQuad for flight, it is critical to make sure your PID values are setup correctly for your multicopter. What is PID? Check out this and this link for some background information.

To help describe what each PID value does, let's first discuss this in the context of the Rate Mode of the AeroQuad. The Rate Mode only uses gyro sensors (which measure angular rate) for stabilization. The Proportional value scales the gyro sensor data to motor commands. The Integral value takes into account how long the difference between desired and actual angular movement is present and the Derivative value returns the AeroQuad from forward flight to a level hover quicker. The higher the P value, stronger motor commands are generated based on the gyro's angular rate measurements. If it is set too high, then the user will see oscillations as the AeroQuad tries to stabilize itself. If P is set too low, then the AeroQuad will not respond strongly enough to keep itself at a constant attitude (it looks like it flies "floppy").

In attitude mode, a negative D value is used to help the AeroQuad change faster to a level position after forward flight. It is possible to leave D = 0 and still see attitude flight. Using a negative D value is only needed based on user preference.

What's the difference between Rate Mode and Attitude Mode?

In the Configurator there are PID values for Rate Mode Roll and Pitch, Attitude Mode Roll and Pitch, Yaw and Heading Hold. Before trying to fly in Attitude Mode, the user must tune the Rate Mode well first. Rate Mode uses only the gyro data to stabilize the AeroQuad. Basically, it detects changes in angular rates on a single axis and adjust the motors such that it resists the angular change from a level position. Attitude Mode uses both gyro data and accelerometer data to maintain a level position and has the ability to "auto level" itself when the pilot let's go of the transmitter sticks.

Since every frame has different characteristics (weight, size, stiffness) it is not possible to use a single set of PID values for all multicopters. The defaults (setup when the user hits the Initialize EEPROM button in the Configurator) are good for basic configurations (~50-60cm motor to motor distance, 1.4kg all up flight weight) using Rate Mode Roll and Pitch P = 100.0, I = 150.0, D = -350.0 and Attitude Mode Accel Roll/Pitch P = 3.5, I = 0.0 and D = 0.0.

You may notice that the default PID values are suitable for your AeroQuad and no further tuning is necessary. Otherwise, you may proceed with this tuning guide.

How can I tune my Rate Mode PID values for my AeroQuad?

First make sure that the AeroQuad is properly setup by following the Pre-Flight Checkout List. If the multicopter is tilted along an axis and quickly flips on that axis, this is an indication that either the sensors are setup backwards (if you are building your own shield confirm your sensor orientation here) or the motors are setup backwards. If you move a transmitter stick along a particular axis and the AeroQuad immediately flips, most likely that transmitter channel is setup backwards (use the transmitter channel reversing function to fix). The following are simple steps to tuning the AeroQuad. Setting up a test stand is the safest way to tune your PID values, otherwise it is very easy to do it by touch. You will first need to tune your multicopter in Rate Mode, adjust your transmitter Mode switch to begin in this mode (typically the Gear transmitter channel).
  1. Connect the Configurator to the AeroQuad with a USB cable or wirelessly using XBee modems. Use the Configurator to verify you are configured for Rate Mode.
  2. Set all PID values (including Rate Mode PIDs) to the default values by clicking the Initialize EEPROM button in the Configurator. Perform all other calibrations (transmitter/ESCs/sensors) before starting this tuning procedure. Ensure that the Pre-Flight Checkout has already been performed.
  3. Connect the LiPo battery to the AeroQuad to power up the motors.
  4. Arm the AeroQuad motors by moving the transmitter stick(s) to the correct position.
  5. Hold the AeroQuad securely in your hand, making sure to keep the props away from your eyes and arms.
  6. Move the throttle to about 1/3 power.
  7. Tilt the AeroQuad by hand along the roll axis and pitch axis. The AeroQuad should resist movement as you move it along each axis.
  8. Slowly increase the P value in increments of 5 or 10, until it feels very "stiff" or is difficult to tilt it on the roll axis and pitch axis.
  9. Shake the AeroQuad, be sure to maintain a good hold of the multicopter. Does it oscillate? If it does, reduce the P value in small increments until it stops oscillating. What you want is a stiff resistance to forced movement along the roll axis and pitch axis, but with no oscillations (no overcompensation from the AeroQuad).
  10. Do the same adjustment for the yaw axis. Shake the AeroQuad again to make sure there are no oscillations. Reduce the P value if there are.
  11. You may observe that the default values are good enough to fly with.
  12. When satisfied with hand tuning, disconnect the USB cable (If a cable is used. If using XBee, leave it connected, it's easiest to tune the AeroQuad using a wireless connection.) and place it on the ground for a first flight. If you are a beginner make sure to start with the rear of the AeroQuad facing towards you and the front of the AeroQuad away from you.
  13. Arm the motors, and slowly get it to about knee height. If you fly too low, you will experience ground effects where the air swash from the propellers will interfere with attitude flight of the AeroQuad.
  14. If the AeroQuad starts to tilt away from a level hover, use the transmitter trims to adjust it until it hovers in place with minimal transmitter adjustments from the pilot.
  15. Do you still observe oscillations? Land immediately, lower the P values and test fly again. Does the AeroQuad seem "floppy" or does not fly very "stiff" in the air? Try raising the P values to make it more attitude.
  16. Once you are happy with hovering performance, try moving the AeroQuad into forward flight, then stop to a hover. Does the AeroQuad dip too much when transitioning from forward flight to a hover? If it does, the P gain may be overcompensating (too much motor power) when transitioning to a hover. To reduce this, apply a negative D value (suggested value is by 100 each time, e.g. 0 --> -100) to reduce this effect.

You will probably repeat steps 12-16 until you are happy with the AeroQuad's flight performance. Also consider adjusting the Transmitter Factor. A higher number will cause a change in a transmitter stick position to have a stronger effect on the AeroQuad. A lower number will soften transmitter commands.

If you find that the AeroQuad acts "jittery" even when holding it in your hand with some throttle applied, the gyros may be seeing some noise (may be vibration detected through the frame, etc.). So, make sure to isolate the flight control board from these vibrations before proceeding.

Tuning your AeroQuad for Attitude Mode

You should have a well-tuned set of parameters in Rate Mode before starting to tune for Attitude Mode. Also, be sure to perform the accelerometer calibration via the Configurator and power-up the quad on a level surface. When flying in Rate Mode, adjust the transmitter trims to achieve a level hover with as little pilot input as possible. When starting tuning for Attitude Mode, use the P and D values from Rate Mode as the starting pitch and roll gyro values in Attitude Mode to begin with. For the Attitude Mode Roll/Pitch Accel, use P = 1.0, I = 0.0 and D = 0.0 as starting values.

Now CAREFULLY hold the quad in your hand and slowly increase throttle around 30-50%. Increase the P Accel Roll/Pitch value (suggested increasing value by 0.3 to 0.5 each time) until the quad returns to level on its own. If your AeroQuad is starting to oscillate decrease the P Accel Roll/Pitch value (suggested decreasing value by 0.3 to 0.5 each time) until oscillation stops.

In the next step we will tune the Accel Roll/Pitch I value. This will "auto trim" your multicopter further during flight. Change the value for I until recovery from deviations is unacceptable, then increase slightly (suggested de-/increasing value by 0.3 to 0.5 each time).

Lastly, it may be necessary to tune the Accel Roll/Pitch D value. Sometimes there will be oscillation when the P Accel value is increased. To reduce this fast oscillation, decrease the value of the D (suggested value is by 30 to 50 each time, e.g. 0 --> -30) until recovery from dramatic control changes becomes too slow. Then increase D slightly (suggested value is by 30 to 50 each time, e.g. -90 --> -50).

Now it's time for flight testing. First start in Rate Mode, fly in a attitude hover, using transmitter trims to keep it as level as possible. Land, then switch to Attitude Mode. As you fly, if you see that the multicopter is not responsive enough, repeat the procedure above. Tuning is always a difficult process, so expect many interactions to increase/decrease values to suit your quad's capabilities. It helps to have a wireless system during this process (link to wireless tutorial here).

When you are satisfied with this stage, you can add manual transmitter trim to fix level flight, as the sensors, motors and frame may not be exactly square with one another. When you have some reasonable level flight, try to flick the transmitter stick along the roll or pitch axis. What you should see is the multicopter should self-correct itself without oscillation. Adjust values again to your satisfaction.

That's it! You'll need a lot of patience to get your settings just right, so please expect a lot of trial and error. These instructions are general guidelines, if you have any feedback on improvements on any of these steps, please post them in our forum or edit this article! The next chapter will give you some basic flight tips which are especially useful for beginners.

Tags: pid, tuning

This page has been seen 75,702 times.

    • Created by on
      Last updated by on