Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "Autopilot configuration reference"

From FlightGear wiki
Jump to: navigation, search
(include and alias attributes, top level elements)
(pid-controller and pi-simple-controller)
Line 2: Line 2:
  
 
This page serves as a reference for the elements of FlightGear xml autopilot configuration files. It describes all elements available within the autopilot configuration file supported in the bleeding edge CVS sources. Some of the elements may not be available in the current release version of FlightGear.
 
This page serves as a reference for the elements of FlightGear xml autopilot configuration files. It describes all elements available within the autopilot configuration file supported in the bleeding edge CVS sources. Some of the elements may not be available in the current release version of FlightGear.
Refer to [[Howto:_Design_an_autopilot]] as a guide how to use these elements.
+
Refer to [[Howto: Design an autopilot]] as a guide how to use these elements.
  
 
== Structure Of a Configuration File ==
 
== Structure Of a Configuration File ==
Line 49: Line 49:
 
* <predict-simple>
 
* <predict-simple>
  
== Input Values ==
+
== Common Elements Used By All Filters ==
  
== Output Values ==
+
=== Input Values ===
  
=== filter ===
+
=== Output Values ===
 +
 
 +
== filter ==
  
 
==== gain ====
 
==== gain ====
Line 63: Line 65:
  
 
=== pid-controller ===
 
=== pid-controller ===
 +
The [[http://en.wikipedia.org/wiki/PID_controller PID controller]] is the swiss army knife of automation and this implementation is suitable for most situations. It has a builtin anti-windup logic, usage of <max> and <min> elements for output clamp is mandatory. Most important thing to know is that this controller does not compute absolute output values but an offset from the current value of the output property. This can lead to unexpected behavior if the current value of the output property is unknown when the controller is enabled. This behavior is different to that of the pi-simple-controller.
 +
The xml element creating a pid controller is '''<pid-controller>'''.
 +
Legal elements are (FIXME: this should appear as a table)
 +
Kp - the overall gain for the proportional, integral and derivative part
 +
Ti - integrator time
 +
Td - derivator time
 +
Ts - sampling interval (default: sample at frame rate)
 +
alpha - scaling factor for Td (defaults to 0.1)
 +
beta - reference weighing factor for the proportional component (defaults to 1.0)
 +
gamma - reference weighing factor for the derivate component (defaults to 0.0)
  
 
=== pi-simple-controller ===
 
=== pi-simple-controller ===
 +
This controller implements a PI controller. Other than the PID controller, it computes absolute output values, regardless of the value of the output property. It can by configured as an I-only, P-only or PI-controller. It has anti windup logic if <min> and <max> elements are present.
 +
The xml element creating a PI controller is '''<pi-simple-controller>'''
 +
Legal elements are (FIXME: this should appear as a table)
 +
Kp - gain of the proportional compoment
 +
Ki - gain of the integrator component
  
 
=== predict-simple ===
 
=== predict-simple ===
 +
 +
=== logic ===

Revision as of 16:34, 4 May 2010

WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.

This page serves as a reference for the elements of FlightGear xml autopilot configuration files. It describes all elements available within the autopilot configuration file supported in the bleeding edge CVS sources. Some of the elements may not be available in the current release version of FlightGear. Refer to Howto: Design an autopilot as a guide how to use these elements.

Structure Of a Configuration File

Autopilot configurations live in a separate file, formatted using the well known XML syntax like so many other FlightGear files with a PropertyList node as a root element. A basic skeleton file looks like this:

<?xml version="1.0" encoding="utf8"?>
<PropertyList>
  <params>
    <controls>
      <aileron>controls/flight/aileron</aileron>
      <rudder>controls/flight/rudder</rudder>
      <elevator>controls/flight/elevator</elevator>
    </controls>
  </params>
  
</PropertyList>

Note: Using aliased property names is good style and makes the configuration file more readable. For complex autopilot systems spread over multiple autopilot configuration files, the params section may be included from an extern file using <params include="my-params.xml"/> to avoid duplication of code.


The location and the name of the configuration file is up to the developer. A descriptive name like 'autopilot.xml' might be a good choice. Most developer put these files into the Systems folder of the aircraft.

Adding a Autopilot Configuration to Aircraft

Autopilot configuration files are added to the aircraft by adding

 <autopilot>
   <path>Aircraft/MyAircraft/Systems/my-autopilot.xml</path>
 </autopilot>

to the

<sim>
  <systems>
    <!- - many other elements live here - ->
    <autopilot>
      <path>Aircraft/MyAircraft/Systems/my-autopilot.xml</path>
    </autopilot>
  </systems>
 </sim>

node of your aircraft-set.xml file. Note, that more than one <autopilot> node may be present, each will create a new instance of the autopilot subsystem when running FlightGear. They run in the order of appearance under <systems>.

Available Elements

All elements may contain the attributes "include" and "alias". The "include" property takes a file name as a parameter. This can be used to read the document tree of an external XML file into the node containing the "include" attribute. The included file must have a PropertyList node as the root node. All nodes under this PropertyList node will be added to the node containing the "include" attribute. The "alias" attribute refers to an element defined elsewhere in this XMl document. Alias references are in a path-style syntax, either as a relative or absolute path. Absolute paths start with a slash, like <foo alias="/params/bar/baz"/>. Use the colon to move through the document tree, similar to file system paths like <foo alias="../../bar/baz"/>.

There is no restriction regarding the top level nodes under the PropertyList root node. Nodes, that create instances of filters and controllers are

  • <pid-controller>
  • <pi-simple-controller>
  • <filter>
  • <predict-simple>

Common Elements Used By All Filters

Input Values

Output Values

filter

gain

exponential

double-exponential

moving-average

noise-spike

reciprocal

pid-controller

The [PID controller] is the swiss army knife of automation and this implementation is suitable for most situations. It has a builtin anti-windup logic, usage of <max> and <min> elements for output clamp is mandatory. Most important thing to know is that this controller does not compute absolute output values but an offset from the current value of the output property. This can lead to unexpected behavior if the current value of the output property is unknown when the controller is enabled. This behavior is different to that of the pi-simple-controller. The xml element creating a pid controller is <pid-controller>. Legal elements are (FIXME: this should appear as a table) Kp - the overall gain for the proportional, integral and derivative part Ti - integrator time Td - derivator time Ts - sampling interval (default: sample at frame rate) alpha - scaling factor for Td (defaults to 0.1) beta - reference weighing factor for the proportional component (defaults to 1.0) gamma - reference weighing factor for the derivate component (defaults to 0.0)

pi-simple-controller

This controller implements a PI controller. Other than the PID controller, it computes absolute output values, regardless of the value of the output property. It can by configured as an I-only, P-only or PI-controller. It has anti windup logic if <min> and <max> elements are present. The xml element creating a PI controller is <pi-simple-controller> Legal elements are (FIXME: this should appear as a table) Kp - gain of the proportional compoment Ki - gain of the integrator component

predict-simple

logic