Elevator Gain Tuning

Tuning UAV Autopilots

One of the most challenging aspects of autopilot setup is tuning the gains for a particular airframe. When the gains are tuned poorly, the aircraft my oscillate excessively, it may lag way behind the target pitch angle or roll angle or velocity, it may never reach the target values. Poorly tuned gains could destroy an airframe in a worst case scenario, but often people just live with non-optimal gains that aren’t great but work well enough to get the aircraft around the sky. It’s hard to know what gains to tune and why and a person could play with the numbers all day and only manage to make things worse. It’s easy to spot a problem; often the aircraft will look like it is fighting itself even though it does make it’s way to where it should be, or it just may not do what you ask it to do.

Real World Experimentation

Today I did some test flying with one goal to improve the elevator / pitch gain. Previously my gains were set too low.  The result was smooth pitch control, but the actual pitch lagged far behind the goal pitch and tended to oscillate slowly above and below the desired pitch angle. To fix this, I increased the proportional gain until the pitch became unstable, then reduced the gain by 50%. This doesn’t ensure optimal results, but works pretty well in practice.

Here is a short before and after movie

The first half of the movie shows a flight where the elevator gain has been increased until we have just crossed the threshold into an fast oscillating system.  You will see it stabilizes from time to time, but any little gust or even a turn can excite the system and lead to oscillations.  In the second half of the video the gains have been reduced by 1/2 and you can see the pitch is much more stable.  One point to note is that both flights were flown in very windy/turbulent conditions.  During the second flight I was seeing sustained winds at 20 kts, gusting to 25 kts.  The aircraft was set to cruise at 28 kts for a portion of the flight and on one up wind leg, it just stopped in the sky.  (28 kts = 32.2 mph)

Want to learn more?

If you are interested in more information on PID controllers and gain tuning, I wrote a tutorial several years ago explaining much of the basic theory that goes into a simple PID controller. I then discuss some specifics about the autopilot implementation used in the FlightGear flight simulator. This is interesting because my UAV autopilot uses the same basic FlightGear approach. In fact, it’s possible to develop an autopilot xml configuration file in the FightGear flight simulator, and then copy the config file over to the real UAV and run it with only a few small changes.

At the end of the tutorial I include several tips and strategies for tuning PID controllers.

http://www.flightgear.org/Docs/XMLAutopilot/

My standard disclaimer is that my educational background is computer science; I do not present myself as a control theory expert; instead I’d just like to share what I have learned in a way that makes sense to me.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.