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 link for some background information:
http://en.wikipedia.org/wiki/PID_controller
In the context of the AeroQuad, the P value scales the gyro sensor data to motor commands. The I value is not used (I = 0) and the D 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 fast enough to keep itself stable (it looks like it flies "floppy").
Although the user can set the I value in the Configurator, it is generally not needed for stable flight (I = 0). 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 stable flight. Using a negative D value is only needed based on user preference.
In the Configurator there are PID values for Acrobatic Mode Roll and Pitch, Stable Mode Roll and Pitch, Yaw and Heading Hold. Stable Mode is still an experimental feature, do not enable this when first setting up the AeroQuad. After stable flight is achieved, the user is encouraged to try Stable Mode. Since it is still experimental, any feedback is much appreciated for improvement. Heading Hold is also considered experimental, but has shown itself to be pretty reliable with the v1.6+ versions of the AeroQuad Shield and v1.7+ of the Flight Software.
What's the difference between Acrobatic Mode and Stable Mode? Acrobatic 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. Stable Mode uses both gyro data and accelerometer data to maintain a level position.
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 Acrobatic Mode Roll and Pitch P = 5, I = 0, D = -10 and Yaw P = 10 to 12, I = 0, D = 0.
How can I tune my PID values for my AeroQuad? First make sure that the AeroQuad is properly setup by following the
Pre-Flight Checkout. 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 buidling your own Shield) 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.
- Connect the Configurator to the AeroQuad with a USB cable or wirelessly using XBee modems.
- Set all PID values to the default values by clicking the Initialize EEPROM button in the Configurator. Perform all other calibrations (transmitter/ESC's/sensors) before starting this tuning procedure. Insure the Pre-Flight Checkout has already been performed.
- Connect the Lipo battery to the AeroQuad to power up the motors.
- Arm the AeroQuad motors by moving the transmitter throttle stick to the lower right hand corner.
- Hold the AeroQuad securely in your hand, making sure to keep the props away from your eyes and arms.
- Move the throttle to about 1/3 power.
- Tilt the AeroQuad by hand along the roll axis and pitch axis. The AeroQuad should resist movement as you move it along each axis.
- Slowly increase the P value in 0.5 increments, until it feels very "stiff" or is difficult to tilt it on the roll axis and pitch axis.
- Shake the AeroQuad, be sure to maintain a good hold of the multicopter. Does it oscillate? If it does, reduce the P value 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).
- 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.
- You may observe that the default values are good enough to fly with.
- 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. Start with the rear of the AeroQuad facing towards you and the front of the AeroQuad away from you.
- 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 stable flight of the AeroQuad.
- 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.
- 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 stable.
- 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 (try decreasing it by decrements of -5) 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.). To smooth this noise out, adjust the Gyro Smooth Factor to a lower number. Be careful setting this value too low will cause a slower response from the gyro, making the AeroQuad fly "floppy", or not as "stiff" in the air.
When Acrobatic Mode is setup well for your AeroQuad, consider experimenting with Heading Hold first. Heading Hold performs a numerical integration of the gyro data to calculate the AeroQuad's heading. Adjust the PID values for this to maintain a steady heading during flight (start with the default values). Once you are satisfied with Heading Hold, try enabling Stable Mode. You will notice that the transmitter trim values will need to be adjusted (they will be very different from Acrobatic Mode). If you see jittery behavior in Stable Mode, lower the Acc Smooth Factor to help. Be careful, using too low of a value will cause a slower response from the accelerometers.
Have fun flying your AeroQuad! If there is any questions or any steps are unclear, please post a question
here to help us improve the documentation!