This page provides some tips and guidelines for tuning a new aircraft. Be sure to familiarize yourself with the theory of PID Controllers before you begin. Use of the real time plotter may help to visualize and understand the behavior of the control loops.
- Put the aircraft in a styrofoam container or completely seal the IR sensors with styrofoam or similar blocks and get a reading of the neutrals for each axis. Also take the gyro neutrals at this time. Update your airframe file, flash the AP and re-check the neutrals.
Using the roll gyro as a worked example: Run up your GCS and ensure it is communicating with your airframe. Make sure your airframe is roughly level and that it cannot move. Now run the Messages Tool and the real time plotter tool. The messages tool will have lots of flashing lights indicating when it receives various telemetry packets. In the Messages tool, Click on Gyro Rates and you should see a list of variables. Click on Roll_ADC and drag and drop in onto the main window of the Real Time plotter. Now give it a while to build a stable graph.
Once things have been running this way for a while, in the Real Time Plotter, click on Curves in the menu and select the 1:telemetry:GYRO_RATES:Roll_ADC entry. As you select it, you should see the average and standard deviation values. We need the average value. Jot down the number you have. I have -24.536.
Now go edit your airframe file and look for the ADC_ROLL_NEUTRAL value. In my airframe file the value is 520. As my average value from the Plotter is a negative figure, it indicates that the roll Neutral is too high, subtract the average value from the present setting. So I edited my airframe file to be 495.464 (520-24.536).
Recompile and reflash (Don't worry about restarting the GCS, The messages program or the other running processes - they will catch up just fine after flashing). Once the Board is back up and the plotter continues, reset it from the menu to get rid of the average. Watch it for a while and check that the line and acculmulated average is on or around 0. You are done. Use the same process for the IR sensors!
- Reverse any servos and make sure no mechanical binding occurs at the limits of travel in Manual mode.
- Take the plane outside and engage AUTO1. Bank and pitch the plane and verify that the controls respond in the correct direction. Note that your body will have a tremendous impact on the measured angles.
- Verify that AUTO1 stick movements respond in the correct direction - important!
- Move the plane rapidly to ensure the gyro response resists motion - increase the gain if needed for better visualization.
R/C, Modem, and GPS
Make sure the GPS signal is strong (outdoors) - you should have a 3-D fix in less than 1 minute and at least some satellite signals above 40dB. The plane should not drift on the map by more than 10 meters. Perform a range test of R/C and modem signals.
Important: You must never keep any trim, mixers, or rates in your R/C transmitter. R/C trim can be applied in flight but must be corrected and removed on the ground before attempting autonomous flight. Exponential can be useful and will not adversely affect AUTO1 flight but if "low rates" are needed they should be programmed on the same transmitter switch with AUTO1 so that you always have full travel in AUTO1.
- Fly the plane at what you feel is a suitable "cruise" throttle setting and set the trims. Note that setting in the GCS and try to return to that exact setting in subsequent tests. Enter that throttle setting in your airframe file.
- Check maximum pitch and roll response and adjust the mixer parameters or mechanical linkages after landing.
- Land and adjust the linkages. If necessary, the PPM values can be read from the GCS and servo neutrals adjusted electronically, but manual adjustment will produce far better results.
- Fly again to verify trim and control response. If satisfactory, check for any significant throttle-dependent roll. Again, this is best to correct mechanically but can be addressed with the AILERON_OF_THROTTLE mixer in the autopilot. Check also for any odd behavior at full throttle.
- Make sure that GPS and modem data is reliable during these test flights. Note particularly any tendency for the aircraft to appear to fly sideways on the map - this is an indication of weak GPS signals.
- Engage Auto1 and immediately make sure you can turn both left and right!
- Fly at your "cruise" throttle and adjust the ROLL_PGAIN until the plane doesn't quite oscillate
- Adjust the IR roll neutral as needed
- Verify adequate pitch response and adjust PITCH_PGAIN as needed
- Experiment with different throttle settings and tune P and D gains as needed
- Engage Auto2 and you're done!
Alternate Tuning Procedure
Danstah wrote up a tuning procedure on this website http://www.engr.usu.edu/wiki/index.php/OSAMtuning