Subsections

Autopilot Tuning

The first two theory and algorithm sections are there for people who want a bit of a deeper understanding of control theory and our particular PID implementation. The xml and tuning sections are for people that just want to make the autopilot work. The good news is that you can make workable autopilots without needing to understand the theory.

I would recommend that aircraft designers start by copying the autopilot configuration file from an existing similar aircraft. In many cases you are done. However, if there is no existing similar aircraft, or something doesn't work stably for you, you will most likely need to tune your autopilot modules.

Trial and Error Tuning

The most basic method of tuning is the trial and error method. This method involves adjusting the proportional gain, the integral time and the derivative time until the performance is satisfactory. The three settings are often adjusted separately in order to see the effects of the different settings. This process can be time consuming.

It can be difficult to get started using the trial end error method. What kind of gains and times should one start out with? A typical approach for tuning a PID controller can be summarized as follows:

  1. Eliminate integral and derivative action by setting the derivative time, $ T_{d}$, to its minimum value (zero) and the integral time, $ T_{i}$ to its maximum value.

  2. Set the proportional gain, $ K_{P}$ to a low value (0.5) and enable the controller.

  3. Increase the proportional gain by small increments until continuous cycling occurs after a small set-point or load change. The term "continuous cycling" refers to a sustained oscillation with constant amplitude. At first it might be useful to increment $ K_{P}$ by an order of magnitude (i.e. multiply or divide by 10) just to get yourself in the right ball park. Then you might consider doubling or dividing by two to get closer.

  4. Reduce the gain by a factor of two.

  5. Decrease the integral time until continuous cycling occurs again. Set integral time, $ T_{i}$ to three times this value. Note that because of the way the formulas are constructed, a smaller integral time means a larger integral component.

  6. Increase derivative time, $ T_{d}$ until continuous cycling occurs. Set derivative time to one-third of this value. Note that because of the way the formulas are constructed, a larger derivative time means a larger derivative component (which is opposite from the effect of changing $ T_{i}$.

The proportional gain that results in continuous cycling in Step 3 is called the ultimate gain. In performing the experimental test to find the ultimate gain, it is important that the output does not saturate. If saturation occurs it is possible to get continuous cycling even though the gain is higher than the ultimate gain. This would then result in a too high gain in Step 4.

Disadvantages of the trial and error method include:

Ziegler-Nichols Method

The Ziegler-Nichols methods of controller tuning are the "closed loop" and the "open loop" method. The closed loop method is quite similar to the trial and error method:

Steps 1-3 are the same as in the trial and error method.

Step 4. Take note of the ultimate gain $ K_{Pu}$, and the ultimate period $ T_{u}$. The ultimate period is the period of the oscillations.

Step 5. Calculate controller settings according to this table:

Controller $ K_{P}$ $ T_{i}$ $ T_{d}$
P $ 0.5 \cdot K_{Pu}$ inf. 0
PI $ 0.45 \cdot K_{Pu}$ $ T_{u}/1.2$ 0
PID $ 0.6 \cdot K_{Pu}$ $ T_{u}/2$ $ T_{u}/8$

For more info on tuning and PID control systems follow this link:
http://www.jashaw.com/pid

Other Tuning Tips

I will include a few more tuning tips here as I learn more about how the algorithm works. Here are a few things to consider.

Tweaking Parameters Inside of FlightGear

You do not need to restart FlightGear each time you tweak an autopilot parameter. You can edit the configuration file and then have FG reload the config file on the fly. The general procedure is as follows

Curtis L. Olson 2004-02-04