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:

  • It is quite time consuming if a large number of trials are required in order to find the ultimate gain and the integral and derivative times that result in continuous cycling.
  • The method is not applicable to processes that are open-loop unstable because such processes are typically unstable at both high and low gain values and are stable for intermediate gain values.
  • Some simple processes do not have an ultimate gain.

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.

  • The algorithm is written in ``velocity form''. This means that for the proportional component, the change in error from the previous iteration is used, rather than the absolute error. For the integral and differential components, the absolute error is used.
  • If the initial change in error is outside the range of the min/max values, the anti-integrator windup will chop this to zero. The next iteration the error probably won't have changed much so you can get a system that doesn't track the target very well. In this case you simply need to increase the integral component to get the change in error (i.e. velocity) moving a bit.
  • You can set <debug>true</debug> to get console debugging output for a particular PID module. This will show you things like the target value, the input value, some of the internal error terms calculated and finally the output value. This can be a very useful sanity check.
  • If the system starts with an sane initial output value, but then drops the output to a small value way too soon and hovers at a stable, but wrong value, you likely do not have enough integral component.
  • The proportional gain, $ K_{P}$, is multiplied by against all the error terms so it is really a ``global'' gain rather than just a proportional gain. If you change $ K_{P}$ substantially, you may also need to change $ T_{i}$ and $ T_{d}$. Note that in the tuning procedure described previously, you are instructed to initially set $ T_{i}$ to $ inf$ and $ T_{d}$ to nearly zero, then tune $ K_{P}$ first.

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

  • Edit the autopilot configuration file with your favorite text or xml editor. Save your changes.
  • Select Reload Autopilot from the Debug menu. FG will immediately reload your autopilot configuration file.
  • It is a good idea to only change one parameter at a time.
Curtis L. Olson 2004-02-04

Google Advertisements - Click to support FlightGear

Latest Version

v2.0.0 - 18 Feb 2010

A new major update of the FligtGear simulator. Please check the readme

Notam

Notam image file

Would all pilots try and avoid mpserver02 as its often overloaded.