Autopilot configuration reference: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (Syntaxhightlighting, no longer a WIP)
Line 1: Line 1:
{{WIP}}
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 [[Git]] 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 Git 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 ==
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:
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:
<syntaxhighlight lang="xml">
  <?xml version="1.0" encoding="utf8"?>
  <?xml version="1.0" encoding="utf8"?>
  <PropertyList>
  <PropertyList>
Line 15: Line 15:
     </controls>
     </controls>
   </params>
   </params>
   &lt;!-- Place your components here --&gt;
   <!-- Place your components here -->
   &lt;!--
   <!--
   <filter>
   <filter>
     <name>Myfilter</name>
     <name>Myfilter</name>
Line 22: Line 22:
     <output>/bar</output>
     <output>/bar</output>
   </filter>
   </filter>
   --&gt;
   -->
  </PropertyList>
  </PropertyList>
</syntaxhighlight>
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 external file using <tt><params include="my-params.xml"/></tt> to avoid duplication of code.
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 external file using <tt><params include="my-params.xml"/></tt> to avoid duplication of code.


Line 30: Line 32:
== Adding a Autopilot Configuration to Aircraft ==
== Adding a Autopilot Configuration to Aircraft ==
Autopilot configuration files are added to the aircraft by adding  
Autopilot configuration files are added to the aircraft by adding  
<syntaxhighlight lang="xml">
   <autopilot>
   <autopilot>
     <path>Aircraft/MyAircraft/Systems/my-autopilot.xml</path>
     <path>Aircraft/MyAircraft/Systems/my-autopilot.xml</path>
   </autopilot>
   </autopilot>
</syntaxhighlight>
to the  
to the  
<syntaxhighlight lang="xml">
  <sim>
  <sim>
   <systems>
   <systems>
     &lt;!-- many other elements live here --&gt;
     <!-- many other elements live here -->
     <autopilot>
     <autopilot>
       <path>Aircraft/MyAircraft/Systems/my-autopilot.xml</path>
       <path>Aircraft/MyAircraft/Systems/my-autopilot.xml</path>
Line 42: Line 48:
   </systems>
   </systems>
   </sim>
   </sim>
</syntaxhighlight>
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>. For example, lateral and vertical autopilot modes could live in separate files, as could a yaw-damper system.
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>. For example, lateral and vertical autopilot modes could live in separate files, as could a yaw-damper system.


Line 60: Line 68:


=== Name ===
=== Name ===
The &lt;name&gt; element is optional, but should be added to give the controller a distinct name. It is only used in debug output.
The <name> element is optional, but should be added to give the controller a distinct name. It is only used in debug output.
  <name>NAV hold</name>
  <name>NAV hold</name>


=== Feedback if disabled ===
=== Feedback if disabled ===
The &lt;feedback-if-disabled&gt; element advises the controller to feed back the output property value to the active input property if the
The <feedback-if-disabled> element advises the controller to feed back the output property value to the active input property if the
condition defined in the &lt;enable&gt; tag evaluates to false. This is usually required for controllers like servo drivers behind a PID-controller to give that PID-controller a valid starting value when it becomes enabled. The absence of this element or anything but the word ''true'' within this element results in feedback disabled.
condition defined in the <enable> tag evaluates to false. This is usually required for controllers like servo drivers behind a PID-controller to give that PID-controller a valid starting value when it becomes enabled. The absence of this element or anything but the word ''true'' within this element results in feedback disabled.
  <feedback-if-disabled>true</feedback-if-disabled>
  <feedback-if-disabled>true</feedback-if-disabled>


=== Debug ===
=== Debug ===
If the &lt;debug&gt; element is present and if it contains the word ''true'', the containing controller prints out some diagnostic information on the console for each processing loop.
If the <debug> element is present and if it contains the word ''true'', the containing controller prints out some diagnostic information on the console for each processing loop.
  <debug>true</debug>
  <debug>true</debug>


=== Input and Reference ===
=== Input and Reference ===
Each controller has two input "lines", denoted by the tags &lt;input&gt; and &lt;reference&gt;. The arithmetic difference of these two values is used by the respective controller to compute it's output. Unfortunately due to historical reasons, the sign of input and reference is not consistent for all controllers. While the pid-controller and the pi-simple-controller compute "reference-input", the filter controller computes "input-reference". Each element is optional with a default value of zero. These elements are made of so called '''Input Values''' described further down in this document.
Each controller has two input "lines", denoted by the tags <input> and <reference>. The arithmetic difference of these two values is used by the respective controller to compute it's output. Unfortunately due to historical reasons, the sign of input and reference is not consistent for all controllers. While the pid-controller and the pi-simple-controller compute "reference-input", the filter controller computes "input-reference". Each element is optional with a default value of zero. These elements are made of so called '''Input Values''' described further down in this document.
 
Example for a simple differential amplifier, computing output = (input-reference)*2
Example for a simple differential amplifier, computing output = (input-reference)*2
<syntaxhighlight lang="xml">
  <filter>
  <filter>
   <type>gain</type>
   <type>gain</type>
Line 82: Line 92:
   <output>/some/output</output>
   <output>/some/output</output>
  </filter>
  </filter>
</syntaxhighlight>


=== Output ===
=== Output ===
The &lt;outptu&gt; element names the properties, the computed value should be written to. More than one &lt;output&gt; may be present, each named property will be assigned the computed value.
The <outptu> element names the properties, the computed value should be written to. More than one <output> may be present, each named property will be assigned the computed value.
  <output>controls/flight/elevator</output>
  <output>controls/flight/elevator</output>
   
   
=== Enable ===
=== Enable ===
Controllers can be enabled or disabled using property values. This element &lt;enable&gt; may contain a &lt;prop&gt; and a &lt;value&gt; element. The controller is enabled, if the value of the named property equals the given value. This feature is considered deprecated and might go away in future releases. The preferred way of defining the enable-condition is by adding a &lt;condition&gt; element to the &lt;enable&gt; element. This &lt;condition&gt; follows the same syntactical rules as the one used in model animations and can model complex expression trees.
Controllers can be enabled or disabled using property values. This element <enable> may contain a <prop> and a <value> element. The controller is enabled, if the value of the named property equals the given value. This feature is considered deprecated and might go away in future releases. The preferred way of defining the enable-condition is by adding a <condition> element to the <enable> element. This <condition> follows the same syntactical rules as the one used in model animations and can model complex expression trees.
To enable a wing leveler only if the current bank angle does not exceed 30° of bank, use this condition
To enable a wing leveler only if the current bank angle does not exceed 30° of bank, use this condition
<syntaxhighlight lang="xml">
  <enable>
  <enable>
   <condition>
   <condition>
Line 102: Line 114:
   </condition>
   </condition>
  </enable>
  </enable>
</syntaxhighlight>


=== Input Values ===
=== Input Values ===
Line 113: Line 126:
The shortcut syntax is also valid:
The shortcut syntax is also valid:
  <reference>3.5</reference>
  <reference>3.5</reference>
If the text can be parsed by <tt>strtod()</tt> to a double value, it will be used as a constant value, otherwise it will be interpreted as a property value (see next paragraph)
If the text can be parsed by <tt>strtod()</tt> to a double value, it will be used as a constant value, otherwise it will be interpreted as a property value (see next paragraph)


==== A property value ====
==== A property value ====
To evaluate the value of a property, place the name of the property into the text element:
To evaluate the value of a property, place the name of the property into the text element:
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <property>/my/property</property>
   <property>/my/property</property>
  </reference>
  </reference>
</syntaxhighlight>
The shortcut syntax is also valid:
The shortcut syntax is also valid:
  <reference>/my/property</reference>
  <reference>/my/property</reference>
Note: the shortcut syntax is only valid, if neither &lt;property&gt; nor &lt;value&gt; element exists.
 
If both, &lt;property&gt; '''and''' &lt;value&gt; element exist, the property will be initialized with the given value with scale and offset applied correctly.
Note: the shortcut syntax is only valid, if neither <property> nor <value> element exists.
If both, <property> '''and''' <value> element exist, the property will be initialized with the given value with scale and offset applied correctly.
Properties don't have to exist, the will be created as needed.
Properties don't have to exist, the will be created as needed.


'''Note:''' for backward compatibility, the notation &lt;prop&gt; instead of &lt;property&gt; is also valid but considered deprecated and might go away in future releases.
'''Note:''' for backward compatibility, the notation <prop> instead of <property> is also valid but considered deprecated and might go away in future releases.


==== Linear transformation of the input value ====
==== Linear transformation of the input value ====
Input values may be scaled and shifted before they are processed by the controller using the formula <tt>y = value * scale + offset</tt>
Input values may be scaled and shifted before they are processed by the controller using the formula <tt>y = value * scale + offset</tt>
To use a celsius temperature property in a controller which expects the temperature in fahrenheit you might use
To use a celsius temperature property in a controller which expects the temperature in fahrenheit you might use
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <property>/environment/temperature-degc</property>
   <property>/environment/temperature-degc</property>
Line 136: Line 155:
   <offset>32</offset>
   <offset>32</offset>
  </reference>
  </reference>
</syntaxhighlight>


==== Periodical transformation of the input value ====
==== Periodical transformation of the input value ====
Periodical (like angular) input values can be transformed to appear in the correct phase before they are processed by the controller by adding or substracting multiples of the period to the input value until the values is in the requested periods interval.
Periodical (like angular) input values can be transformed to appear in the correct phase before they are processed by the controller by adding or substracting multiples of the period to the input value until the values is in the requested periods interval.
The following example converts the heading which comes in the range of [0..360] into the range of [-180..+180]. This will cause a heading of 270 to be processed as a value of -90.
The following example converts the heading which comes in the range of [0..360] into the range of [-180..+180]. This will cause a heading of 270 to be processed as a value of -90.
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <property>/orientation/heading-deg</property>
   <property>/orientation/heading-deg</property>
Line 147: Line 168:
   </period>
   </period>
  </reference>
  </reference>
</syntaxhighlight>


==== Input clamping ====
==== Input clamping ====
To clamp the input to a minimum value, maximum value or both, the tags <tt>&lt;min&gt;</tt> and <tt>&lt;max&gt;</tt> can be used. Clamping will occur after the linear transformation has been applied. Note the difference of input clamping to output clamping. While input clamping is applied '''before''' the signal reaches the controller, output clamping will be applied to the output signal '''after''' it has been processed.
To clamp the input to a minimum value, maximum value or both, the tags <tt><min></tt> and <tt><max></tt> can be used. Clamping will occur after the linear transformation has been applied. Note the difference of input clamping to output clamping. While input clamping is applied '''before''' the signal reaches the controller, output clamping will be applied to the output signal '''after''' it has been processed.
 
The following code will keep the input to the controller in the range of 60 to 80 degrees Fahrenheit:
The following code will keep the input to the controller in the range of 60 to 80 degrees Fahrenheit:
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <property>/environment/temperature-degc</property>
   <property>/environment/temperature-degc</property>
Line 158: Line 182:
   <max>80</max>
   <max>80</max>
  </reference>
  </reference>
</syntaxhighlight>


==== Absolute values ====
==== Absolute values ====
To use the absolute (unsigned) value of the input, add <tt>&lt;abs type="bool"&gt;true&lt;/abs&gt;</tt>.
To use the absolute (unsigned) value of the input, add <tt><abs type="bool">true</abs></tt>.
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <property>/autopilot/internal/course-error-deg</property>
   <property>/autopilot/internal/course-error-deg</property>
   <abs type="bool">true</abs>
   <abs type="bool">true</abs>
  </reference>
  </reference>
</syntaxhighlight>


==== Recursive definition ====
==== Recursive definition ====
The elements <tt>&lt;scale&gt;</tt>, <tt>&lt;offset&gt;</tt>, <tt>&lt;min&gt;</tt> and <tt>&lt;max&gt;</tt> itself can be defined as input values. This code uses as reference the value of course-error-deg, scaled by two and an offset applied which is calculated as the product of the bank-angle-de and the property some/property which itself is limited within the range of -1.5 .. +1.5.
The elements <tt><scale></tt>, <tt><offset></tt>, <tt><min></tt> and <tt><max></tt> itself can be defined as input values. This code uses as reference the value of course-error-deg, scaled by two and an offset applied which is calculated as the product of the bank-angle-de and the property some/property which itself is limited within the range of -1.5 .. +1.5.
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <property>/autopilot/internal/course-error-deg</property>
   <property>/autopilot/internal/course-error-deg</property>
Line 180: Line 208:
   </offset>
   </offset>
  </reference>
  </reference>
</syntaxhighlight>


==== Conditional input values ====
==== Conditional input values ====
The direct inputs of controller and filter elements support so called input value lists. This is useful, if the input should be connected to one of many separate inputs like autopilots connected to NAV1, NAV2 or the GPS. A standard <tt>&lt;condition&gt;</tt> element is allowed within an input value element. The input value list will be traversed until the first input value with a successful condition is found. The behavior is much like the switch statement in programming languages.
The direct inputs of controller and filter elements support so called input value lists. This is useful, if the input should be connected to one of many separate inputs like autopilots connected to NAV1, NAV2 or the GPS. A standard <tt><condition></tt> element is allowed within an input value element. The input value list will be traversed until the first input value with a successful condition is found. The behavior is much like the switch statement in programming languages.
<syntaxhighlight lang="xml">
  <reference>
  <reference>
   <condition>
   <condition>
Line 196: Line 226:
  </reference>
  </reference>
  <reference>instrumentation/nav[0]/radials/selected-deg</reference>
  <reference>instrumentation/nav[0]/radials/selected-deg</reference>
Note the unconditional last <tt>&lt;reference<&gt;</tt> element which acts as an "if all others fail, use NAV1" anchor. If no input value return with a successful condition, the input value is undefined.<br />
</syntaxhighlight>
The <tt>&lt;scale&gt;</tt>, <tt>&lt;offset&gt;</tt>, <tt>&lt;min&gt;</tt> and <tt>&lt;max&gt;</tt> elements of input values itself currently don't support input value lists.
 
Note the unconditional last <tt><reference<></tt> element which acts as an "if all others fail, use NAV1" anchor. If no input value return with a successful condition, the input value is undefined.<br />
The <tt><scale></tt>, <tt><offset></tt>, <tt><min></tt> and <tt><max></tt> elements of input values itself currently don't support input value lists.


==== Expressions ====
==== Expressions ====
Line 203: Line 235:


=== Output Values ===
=== Output Values ===
After processing of a component, the resulting value passes a transformation stage where it can be clipped or normalized into a given period. Periodic values such as angular properties may be normalized into a given period by adding a &lt;period&gt; element, defining the lower and upper bounds of the period. Additionally, a maximun and a minimum value may be given which will guarantee that the output value will ever exceed a defined value.  
After processing of a component, the resulting value passes a transformation stage where it can be clipped or normalized into a given period. Periodic values such as angular properties may be normalized into a given period by adding a <period> element, defining the lower and upper bounds of the period. Additionally, a maximun and a minimum value may be given which will guarantee that the output value will ever exceed a defined value.  


'''Note:''' Both, periodical normalization and clipping may be defined. If both are given, the value will be normalized first and the clipping will be applied to the normalized value.
'''Note:''' Both, periodical normalization and clipping may be defined. If both are given, the value will be normalized first and the clipping will be applied to the normalized value.
Line 234: Line 266:
| -10
| -10
|}
|}
 
<syntaxhighlight lang="xml">
  <output>/some/property</output>
  <output>/some/property</output>
  <period>
  <period>
Line 242: Line 274:
  <min>-30</min>
  <min>-30</min>
  <max>30</max>
  <max>30</max>
</syntaxhighlight>


== logic ==
== logic ==
The logic controller provides a simple way of creating property values from the result of the condition expression in the &lt;input&gt; element. The condition expression is evaluated once per iteration and the result is written as a boolean value to the named output property or properties. An optional &lt;inverted&gt; element inverts the logic. The default is "not inverted".
The logic controller provides a simple way of creating property values from the result of the condition expression in the <input> element. The condition expression is evaluated once per iteration and the result is written as a boolean value to the named output property or properties. An optional <inverted> element inverts the logic. The default is "not inverted".


Example: output = not( ( a is true ) or ( ( b greater than c ) and ( d is true ) )
Example: output = not( ( a is true ) or ( ( b greater than c ) and ( d is true ) )
<syntaxhighlight lang="xml">
  <logic>
  <logic>
   <inverted>true</inverted>
   <inverted>true</inverted>
Line 261: Line 295:
   <output>output</output>
   <output>output</output>
  </logic>
  </logic>
</syntaxhighlight>


== Flip Flop ==
== Flip Flop ==
A flip flop is a controller that has two stable states so it can be used as a one bit memory. Four types of flip flops are implemented: '''RS''', '''JK''', '''D''' and '''T'''. All use positive logic and operate on the raising edge of the clock signal if a clock is used.
A flip flop is a controller that has two stable states so it can be used as a one bit memory. Four types of flip flops are implemented: '''RS''', '''JK''', '''D''' and '''T'''. All use positive logic and operate on the raising edge of the clock signal if a clock is used.
All input lines, including the clock line, are encoded as condition constructs.
All input lines, including the clock line, are encoded as condition constructs.
If negative logic for the input line is required, wrap the condition into a &lt;not&gt; tag to invert the logic.
If negative logic for the input line is required, wrap the condition into a <not> tag to invert the logic.


=== RS Flip Flop ===
=== RS Flip Flop ===
This flip flop sets its output according to the set (S) or reset (R) input lines. If the set line is set, the output gets set. If the reset line is set, the output gets reset. If no line is set, the output stays unchanged. For the special case where set and reset lines are both set, two types of RS flip flops exist: for the RS flip flop (&lt;type&gt;RS&lt;/type&gt;), the reset line is dominant and the output is reset. Alternatively, a SR flip flop (&lt;type&gt;SR&lt;/type&gt;) has a dominant set line and the output gets set if set and reset line are set.
This flip flop sets its output according to the set (S) or reset (R) input lines. If the set line is set, the output gets set. If the reset line is set, the output gets reset. If no line is set, the output stays unchanged. For the special case where set and reset lines are both set, two types of RS flip flops exist: for the RS flip flop (<type>RS</type>), the reset line is dominant and the output is reset. Alternatively, a SR flip flop (<type>SR</type>) has a dominant set line and the output gets set if set and reset line are set.


Example: simple RS flip flop
Example: simple RS flip flop
<syntaxhighlight lang="xml">
  <flipflop>
  <flipflop>
   <type>RS</type> &lt;!-- or SR --&gt;
   <type>RS</type> <!-- or SR -->
   &lt;S&gt;
   <S>
     <property>/myflipflop/set</property>
     <property>/myflipflop/set</property>
   </S>
   </S>
Line 281: Line 317:
   <output>/myflipflop/output</output>
   <output>/myflipflop/output</output>
  </flipflop>
  </flipflop>
</syntaxhighlight>


=== JK Flip Flop ===
=== JK Flip Flop ===
Line 288: Line 325:


Example: simple JK flip flop with negative edge clock
Example: simple JK flip flop with negative edge clock
<syntaxhighlight lang="xml">
  <flipflop>
  <flipflop>
   <type>JK</type>
   <type>JK</type>
Line 303: Line 341:
   <output>/myflipflop/output</output>
   <output>/myflipflop/output</output>
  </flipflop>
  </flipflop>
</syntaxhighlight>


=== D Flip Flop ===
=== D Flip Flop ===
Line 308: Line 347:


Example: simple D flip flop with inverted output
Example: simple D flip flop with inverted output
<syntaxhighlight lang="xml">
  <flipflop>
  <flipflop>
   <type>D</type>
   <type>D</type>
Line 319: Line 359:
   <inverted type="bool">true</inverted>
   <inverted type="bool">true</inverted>
  </flipflop>
  </flipflop>
</syntaxhighlight>


=== T Flip Flop ===
=== T Flip Flop ===
Line 324: Line 365:


Example: simple T flip flop
Example: simple T flip flop
<syntaxhighlight lang="xml">
  <flipflop>
  <flipflop>
   <type>T</type>
   <type>T</type>
Line 331: Line 373:
   <output>/myflipflop/output</output>
   <output>/myflipflop/output</output>
  </flipflop>
  </flipflop>
</syntaxhighlight>


=== Monostable ===
=== Monostable ===
Line 340: Line 383:
Note: the optional <R> and <K> inputs may be used to reset the output before the internal timer expired. This will also reset the timer to zero, so no additional event will be triggered after the defined timer interval.
Note: the optional <R> and <K> inputs may be used to reset the output before the internal timer expired. This will also reset the timer to zero, so no additional event will be triggered after the defined timer interval.


<syntaxhighlight lang="xml">
  <flipflop>
  <flipflop>
   <name>Test mf</name>
   <name>Test mf</name>
Line 347: Line 391:
     <value>10</value>
     <value>10</value>
   </time>
   </time>
   &lt;S&gt;<property>/myflipflop/s</property>&lt;/S&gt;
   <S><property>/myflipflop/s</property></S>
   <J><property>/myflipflop/j</property></J>
   <J><property>/myflipflop/j</property></J>
   <clock><property>/myflipflop/clock</property></clock>
   <clock><property>/myflipflop/clock</property></clock>
   <output>/myflipflop/output</output>
   <output>/myflipflop/output</output>
   </flipflop>
   </flipflop>
</syntaxhighlight>


== filter ==
== filter ==


=== Pure Gain &lt;gain&gt; ===
=== Pure Gain <gain> ===
A gain filter multiplies the difference between the &lt;input&gt; and &lt;output&gt; values by a given factor. The multiplier or gain is specified by the &lt;gain&gt; element. More than one &lt;gain&gt; element formatted as in [[Autopilot Configuration Reference#Input Values|Input Values]] may be present. The first with a &lt;condition&gt; element evaluating as true will define the used gain.
A gain filter multiplies the difference between the <input> and <output> values by a given factor. The multiplier or gain is specified by the <gain> element. More than one <gain> element formatted as in [[Autopilot Configuration Reference#Input Values|Input Values]] may be present. The first with a <condition> element evaluating as true will define the used gain.


<syntaxhighlight lang="xml">
  <filter>
  <filter>
   <type>gain</type>
   <type>gain</type>
Line 364: Line 410:
   <output>circumfence</output>
   <output>circumfence</output>
  </filter>
  </filter>
</syntaxhighlight>
=== First Order Low Pass Filter <exponential> ===
The exponential filter is a typical [http://en.wikipedia.org/wiki/Low-pass_filter low pass filter]. The magic euler number and the associated mathematical funtion exp() plays a major role here. As the name implies, lower frequencies can pass this filter while higher frequencies are cut. The frequency where only half of the input signal reaches the output is called cutoff frequency. This cutoff frequency is defined by the parameter <filter-time> and resolves as cutoff-frequency = 1/(2*pi*cutoff-frequency).


=== First Order Low Pass Filter &lt;exponential&gt; ===
The exponential filter is a typical [http://en.wikipedia.org/wiki/Low-pass_filter low pass filter]. The magic euler number and the associated mathematical funtion exp() plays a major role here. As the name implies, lower frequencies can pass this filter while higher frequencies are cut. The frequency where only half of the input signal reaches the output is called cutoff frequency. This cutoff frequency is defined by the parameter &lt;filter-time&gt; and resolves as cutoff-frequency = 1/(2*pi*cutoff-frequency).
Example: a 1Hz first order low pass filter  
Example: a 1Hz first order low pass filter  
<syntaxhighlight lang="xml">
  <filter>
  <filter>
   <type>exponential</type>
   <type>exponential</type>
Line 374: Line 424:
   <output>/some/output/<output>
   <output>/some/output/<output>
  </filter>
  </filter>
</syntaxhighlight>


=== Second Order Low Pass Filter &lt;double-exponential&gt; ===
=== Second Order Low Pass Filter <double-exponential> ===
The double exponential filter is a low pass filter like the exponential filter with a steeper slope of the filter diagram. It acts basically like two chained exponential filters and it is some times called second order filter.  
The double exponential filter is a low pass filter like the exponential filter with a steeper slope of the filter diagram. It acts basically like two chained exponential filters and it is some times called second order filter.  


The configuration is the same for exponential and double-exponential filters, just the type entry differs
The configuration is the same for exponential and double-exponential filters, just the type entry differs.
<syntaxhighlight lang="xml">
  <filter>
  <filter>
   <type>double-exponential</type>
   <type>double-exponential</type>
Line 385: Line 437:
   <output>/some/output/<output>
   <output>/some/output/<output>
  </filter>
  </filter>
</syntaxhighlight>


=== &lt;moving-average&gt; ===
=== <moving-average> ===
=== Rate Limit Filter &lt;noise-spike&gt; ===
=== Rate Limit Filter <noise-spike> ===
A better name for a noise spike filter would probably have been "rate limit filter". This is exactly what it does: limit the rate of change of the output value. The relevant configuration element is &lt;max-rate-of-change&gt; setting the maximum rate of change of the output property per second.
A better name for a noise spike filter would probably have been "rate limit filter". This is exactly what it does: limit the rate of change of the output value. The relevant configuration element is <max-rate-of-change> setting the maximum rate of change of the output property per second.


Example: A transition from 0 to 4 at the input property results in a linear increase of the output property over 8 seconds from 0 to 4 at a rate of 0.5/sec.
Example: A transition from 0 to 4 at the input property results in a linear increase of the output property over 8 seconds from 0 to 4 at a rate of 0.5/sec.
  &lt;filter&gt;
<syntaxhighlight lang="xml">
   &lt;type&gt;noise-spike&lt;/type&gt;
  <filter>
   &lt;max-rate-of-change&gt;0.5&lt;/max-rate-of-change&gt;
   <type>noise-spike</type>
   &lt;input&gt;/some/input&lt;/input&gt;
   <max-rate-of-change>0.5</max-rate-of-change>
   &lt;output&gt;/some/output&lt;/output&gt;
   <input>/some/input</input>
  &lt;/filter&gt;
   <output>/some/output</output>
  </filter>
</syntaxhighlight>


=== Reciprocal Filter &lt;reciprocal&gt; ===
=== Reciprocal Filter <reciprocal> ===
Compute the reciprocal (1/x) value of the input property. If x is zero, no computation is performed. The optional &lt;gain&gt; element may be used to scale the value. Output computes as gain divided by input.
Compute the reciprocal (1/x) value of the input property. If x is zero, no computation is performed. The optional <gain> element may be used to scale the value. Output computes as gain divided by input.


Example: compute the flight time per pound of burned fuel from the fuel flow
Example: compute the flight time per pound of burned fuel from the fuel flow
  &lt;filter&gt;
<syntaxhighlight lang="xml">
   &lt;type&gt;reciprocal&lt;/type&gt;
  <filter>
   &lt;gain&gt;1.0&lt;/gain&gt;
   <type>reciprocal</type>
   &lt;input&gt;/engines/engine[0]/fuel-flow-pph&lt;/input&gt;
   <gain>1.0</gain>
   &lt;output&gt;/engines/engine[0]/fuel-flow-hpp&lt;/output&gt;
   <input>/engines/engine[0]/fuel-flow-pph</input>
  &lt;/filter&gt;
   <output>/engines/engine[0]/fuel-flow-hpp</output>
  </filter>
</syntaxhighlight>


== PID Controller &lt;pid-controller&gt; ==
== 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, and usage of <max> and <min> elements for clamping the output is mandatory. The 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 [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, and usage of <max> and <min> elements for clamping the output is mandatory. The 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 <tt><pid-controller></tt>.
The xml element creating a pid controller is <tt><pid-controller></tt>.
Line 438: Line 495:
|}
|}


== PI Controller &lt;pi-simple-controller&gt; ==
== PI 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.
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 <tt><pi-simple-controller></tt>
The xml element creating a PI controller is <tt><pi-simple-controller></tt>
Line 451: Line 508:
|}
|}


== Predictor &lt;predict-simple&gt; ==
== Predictor <predict-simple> ==
Estimates the future value for a given property based on its current (or averaged) rate of change.
Estimates the future value for a given property based on its current (or averaged) rate of change.


Line 465: Line 522:


Example: compute estimated speed 5 seconds ahead
Example: compute estimated speed 5 seconds ahead
  &lt;predict-simple&gt;
<syntaxhighlight lang="xml">
   &lt;name&gt;predicted air speed 5 seconds ahead&lt;/name&gt;
  <predict-simple>
   &lt;debug&gt;false&lt;/debug&gt;
   <name>predicted air speed 5 seconds ahead</name>
   &lt;input&gt;velocities/airspeed-kt&lt;/input&gt;
   <debug>false</debug>
   &lt;output&gt;autopilot/internal/airspeed-5-sec-ahead&lt;/output&gt;
   <input>velocities/airspeed-kt</input>
   &lt;seconds&gt;5.0&lt;/seconds&gt;
   <output>autopilot/internal/airspeed-5-sec-ahead</output>
   &lt;filter-gain&gt;0.1&lt;/filter-gain&gt;
   <seconds>5.0</seconds>
  &lt;/predict-simple&gt;
   <filter-gain>0.1</filter-gain>
  </predict-simple>
</syntaxhighlight>


== Proposed extensions ==
== Proposed extensions ==
This sections contains new features for the autopilot to be implemented. Nobody knows if and when this will happen. Consider this as a collection of ideas as a base for discussion on the mailing list, the forum or IRC.
This sections contains new features for the autopilot to be implemented. Nobody knows if and when this will happen. Consider this as a collection of ideas as a base for discussion on the mailing list, the forum or IRC.


NIL
[[Category:Aircraft enhancement]]

Revision as of 14:50, 5 June 2011

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 Git 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>
   <!-- Place your components here -->
   <!--
   <filter>
     <name>Myfilter</name>
     <input>/foo</input>
     <output>/bar</output>
   </filter>
   -->
 </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 external 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 developers 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>. For example, lateral and vertical autopilot modes could live in separate files, as could a yaw-damper system.

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"/>.

Any top-level element can appear in an autopilot XML file, but only the following elements will be recognised and used:

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

Common Elements Used By All Elements

Name

The <name> element is optional, but should be added to give the controller a distinct name. It is only used in debug output.

<name>NAV hold</name>

Feedback if disabled

The <feedback-if-disabled> element advises the controller to feed back the output property value to the active input property if the condition defined in the <enable> tag evaluates to false. This is usually required for controllers like servo drivers behind a PID-controller to give that PID-controller a valid starting value when it becomes enabled. The absence of this element or anything but the word true within this element results in feedback disabled.

<feedback-if-disabled>true</feedback-if-disabled>

Debug

If the <debug> element is present and if it contains the word true, the containing controller prints out some diagnostic information on the console for each processing loop.

<debug>true</debug>

Input and Reference

Each controller has two input "lines", denoted by the tags <input> and <reference>. The arithmetic difference of these two values is used by the respective controller to compute it's output. Unfortunately due to historical reasons, the sign of input and reference is not consistent for all controllers. While the pid-controller and the pi-simple-controller compute "reference-input", the filter controller computes "input-reference". Each element is optional with a default value of zero. These elements are made of so called Input Values described further down in this document.

Example for a simple differential amplifier, computing output = (input-reference)*2

 <filter>
   <type>gain</type>
   <gain>1.0</gain>
   <input>/some/input</input>
   <reference>/some/output</reference>
   <output>/some/output</output>
 </filter>

Output

The <outptu> element names the properties, the computed value should be written to. More than one <output> may be present, each named property will be assigned the computed value.

<output>controls/flight/elevator</output>

Enable

Controllers can be enabled or disabled using property values. This element <enable> may contain a <prop> and a <value> element. The controller is enabled, if the value of the named property equals the given value. This feature is considered deprecated and might go away in future releases. The preferred way of defining the enable-condition is by adding a <condition> element to the <enable> element. This <condition> follows the same syntactical rules as the one used in model animations and can model complex expression trees. To enable a wing leveler only if the current bank angle does not exceed 30° of bank, use this condition

 <enable>
   <condition>
     <less-than>
       <property>orientation/bank-angle-deg</property>
       <value>30.0</value>
     </less-than>
     <greater-than>
       <property>orientation/bank-angle-deg</property>
       <value>-30.0</value>
     </greater-than>
   </condition>
 </enable>

Input Values

Input values for controllers may be specified in several notations. Values may be supplied as constants, from properties or by means of simple linear transformations. Conditions allow the selection of one of multiple input sources. The following text will use the reference element as an example but it may be substituted by any other input element like Kp, gain etc. Input values will be interpreted as double values.

A constant value

A constant value is defined by just adding the value as text to the input element:

<reference>
  <value>3.5</value>
</reference>

The shortcut syntax is also valid:

<reference>3.5</reference>

If the text can be parsed by strtod() to a double value, it will be used as a constant value, otherwise it will be interpreted as a property value (see next paragraph)

A property value

To evaluate the value of a property, place the name of the property into the text element:

 <reference>
   <property>/my/property</property>
 </reference>

The shortcut syntax is also valid:

<reference>/my/property</reference>

Note: the shortcut syntax is only valid, if neither <property> nor <value> element exists. If both, <property> and <value> element exist, the property will be initialized with the given value with scale and offset applied correctly. Properties don't have to exist, the will be created as needed.

Note: for backward compatibility, the notation <prop> instead of <property> is also valid but considered deprecated and might go away in future releases.

Linear transformation of the input value

Input values may be scaled and shifted before they are processed by the controller using the formula y = value * scale + offset To use a celsius temperature property in a controller which expects the temperature in fahrenheit you might use

 <reference>
   <property>/environment/temperature-degc</property>
   <scale>1.8</scale>
   <offset>32</offset>
 </reference>

Periodical transformation of the input value

Periodical (like angular) input values can be transformed to appear in the correct phase before they are processed by the controller by adding or substracting multiples of the period to the input value until the values is in the requested periods interval. The following example converts the heading which comes in the range of [0..360] into the range of [-180..+180]. This will cause a heading of 270 to be processed as a value of -90.

 <reference>
   <property>/orientation/heading-deg</property>
   <period>
     <min>-180.0</min>
     <max>180.0</max>
   </period>
 </reference>

Input clamping

To clamp the input to a minimum value, maximum value or both, the tags <min> and <max> can be used. Clamping will occur after the linear transformation has been applied. Note the difference of input clamping to output clamping. While input clamping is applied before the signal reaches the controller, output clamping will be applied to the output signal after it has been processed.

The following code will keep the input to the controller in the range of 60 to 80 degrees Fahrenheit:

 <reference>
   <property>/environment/temperature-degc</property>
   <scale>1.8</scale>
   <offset>32</offset>
   <min>60</min>
   <max>80</max>
 </reference>

Absolute values

To use the absolute (unsigned) value of the input, add <abs type="bool">true</abs>.

 <reference>
   <property>/autopilot/internal/course-error-deg</property>
   <abs type="bool">true</abs>
 </reference>

Recursive definition

The elements <scale>, <offset>, <min> and <max> itself can be defined as input values. This code uses as reference the value of course-error-deg, scaled by two and an offset applied which is calculated as the product of the bank-angle-de and the property some/property which itself is limited within the range of -1.5 .. +1.5.

 <reference>
   <property>/autopilot/internal/course-error-deg</property>
   <scale>2.0</scale>
   <offset>
     <property>orientation/bank-angle-deg</property>
     <scale>
       <property>some/property
       <min>-1.5</min>
       <max>1.5</max>
     </scale>
   </offset>
 </reference>

Conditional input values

The direct inputs of controller and filter elements support so called input value lists. This is useful, if the input should be connected to one of many separate inputs like autopilots connected to NAV1, NAV2 or the GPS. A standard <condition> element is allowed within an input value element. The input value list will be traversed until the first input value with a successful condition is found. The behavior is much like the switch statement in programming languages.

 <reference>
   <condition>
     <property>/autopilot/coupled-to-gps</property>
   </condition>
   <property>instrumentation/gps/desired-track-deg</property>
 </reference>
 <reference>
   <condition>
     <property>/autopilot/coupled-to-nav2</property>
   </condition>
   <property>instrumentation/nav[1]/radials/selected-deg</property>
 </reference>
 <reference>instrumentation/nav[0]/radials/selected-deg</reference>

Note the unconditional last <reference<> element which acts as an "if all others fail, use NAV1" anchor. If no input value return with a successful condition, the input value is undefined.
The <scale>, <offset>, <min> and <max> elements of input values itself currently don't support input value lists.

Expressions

Complex math or lookup tables may be represented using the Expression syntax.

Output Values

After processing of a component, the resulting value passes a transformation stage where it can be clipped or normalized into a given period. Periodic values such as angular properties may be normalized into a given period by adding a <period> element, defining the lower and upper bounds of the period. Additionally, a maximun and a minimum value may be given which will guarantee that the output value will ever exceed a defined value.

Note: Both, periodical normalization and clipping may be defined. If both are given, the value will be normalized first and the clipping will be applied to the normalized value.

The following example shifts the computed value into the interval of [-180..180] thereafter being limited into the interval of [-30..30]. The following table contains some computed values and the resulting written value:

computed written
-350 10
-270 30
-90 -30
-29 -29
29 29
90 30
350 -10
 <output>/some/property</output>
 <period>
   <min>-180</min>
   <max>180</max>
 </period>
 <min>-30</min>
 <max>30</max>

logic

The logic controller provides a simple way of creating property values from the result of the condition expression in the <input> element. The condition expression is evaluated once per iteration and the result is written as a boolean value to the named output property or properties. An optional <inverted> element inverts the logic. The default is "not inverted".

Example: output = not( ( a is true ) or ( ( b greater than c ) and ( d is true ) )

 <logic>
   <inverted>true</inverted>
   <input>
     <property>a</property>
     <or>
       <greater-than>
         <property>b</property>
         <property>c</property>
       <greater-than>
       <property>d</property>
     </or>
   </input>
   <output>output</output>
 </logic>

Flip Flop

A flip flop is a controller that has two stable states so it can be used as a one bit memory. Four types of flip flops are implemented: RS, JK, D and T. All use positive logic and operate on the raising edge of the clock signal if a clock is used. All input lines, including the clock line, are encoded as condition constructs. If negative logic for the input line is required, wrap the condition into a <not> tag to invert the logic.

RS Flip Flop

This flip flop sets its output according to the set (S) or reset (R) input lines. If the set line is set, the output gets set. If the reset line is set, the output gets reset. If no line is set, the output stays unchanged. For the special case where set and reset lines are both set, two types of RS flip flops exist: for the RS flip flop (<type>RS</type>), the reset line is dominant and the output is reset. Alternatively, a SR flip flop (<type>SR</type>) has a dominant set line and the output gets set if set and reset line are set.

Example: simple RS flip flop

 <flipflop>
   <type>RS</type> <!-- or SR -->
   <S>
     <property>/myflipflop/set</property>
   </S>
   <R>
     <property>/myflipflop/reset</property>
   </R>
   <output>/myflipflop/output</output>
 </flipflop>

JK Flip Flop

The JK flip flop is an extension of the RS flip flop. In addition to the set and reset lines of the RS flip flop it uses J, K and a clock input. The J line serves as a clock dependent set input while the K line does the reset job. Optionally, a clock input may be provided. State changes do not occour immediately, but on the next raising edge of the clock signal. The state of J=K=true causes the output to toggle it's current state on the next raising edge of the clock signal. If no clock signal is provided, the frame rate serves as the clock input.

Example: simple JK flip flop with negative edge clock

 <flipflop>
   <type>JK</type>
   <J>
     <property>/myflipflop/set</property>
   </J>
   <K>
     <property>/myflipflop/reset</property>
   </K>
   <clock>
     <not>
       <property>/myflipflop/clock</property>
     </not>
   </clock>
   <output>/myflipflop/output</output>
 </flipflop>

D Flip Flop

The D flip flop transfers the state of the input signal D to the output line at the next raising edge of the clock signal, which is mandatory for this flip flop.

Example: simple D flip flop with inverted output

 <flipflop>
   <type>D</type>
   <D>
     <property>/myflipflop/data</property>
   </D>
   <clock>
     <property>/myflipflop/clock</property>
   </clock>
   <output>/myflipflop/output</output>
   <inverted type="bool">true</inverted>
 </flipflop>

T Flip Flop

The T flip flop toggles the state of the output signal at the next raising edge of the clock signal, which is mandatory for this flip flop.

Example: simple T flip flop

 <flipflop>
   <type>T</type>
   <clock>
     <property>/myflipflop/clock</property>
   </clock>
   <output>/myflipflop/output</output>
 </flipflop>

Monostable

A monostable flip flop has only one stable state which will be reentered after a well defined time. The stable state in current implementation is the output set 'false' or 0. The Monostable is an extension of the JK flip flop. Additionally to the input values defined there, an InputValue for the definition of the pulse time is mandatory.

The moment the time for the astable state starts counting depends on the input used to set the output. If the output is set from the SET input of the RS flipflop, the output is kept true for the defined time after the SET input enters it's false state. The total time the output is true equals the time, the SET input is true plus the time defined in the

Note: the optional <R> and <K> inputs may be used to reset the output before the internal timer expired. This will also reset the timer to zero, so no additional event will be triggered after the defined timer interval.

 <flipflop>
   <name>Test mf</name>
   <type>monostable</type>
   <time>
     <property>/myflipflop/pulsetime-sec</property>
     <value>10</value>
   </time>
   <S><property>/myflipflop/s</property></S>
   <J><property>/myflipflop/j</property></J>
   <clock><property>/myflipflop/clock</property></clock>
   <output>/myflipflop/output</output>
  </flipflop>

filter

Pure Gain <gain>

A gain filter multiplies the difference between the <input> and <output> values by a given factor. The multiplier or gain is specified by the <gain> element. More than one <gain> element formatted as in Input Values may be present. The first with a <condition> element evaluating as true will define the used gain.

 <filter>
   <type>gain</type>
   <gain>6.28</gain>
   <input>radius</input>
   <output>circumfence</output>
 </filter>

First Order Low Pass Filter <exponential>

The exponential filter is a typical low pass filter. The magic euler number and the associated mathematical funtion exp() plays a major role here. As the name implies, lower frequencies can pass this filter while higher frequencies are cut. The frequency where only half of the input signal reaches the output is called cutoff frequency. This cutoff frequency is defined by the parameter <filter-time> and resolves as cutoff-frequency = 1/(2*pi*cutoff-frequency).

Example: a 1Hz first order low pass filter

 <filter>
   <type>exponential</type>
   <filter-time>0.16</filter-time>
   <input>/some/input</input>
   <output>/some/output/<output>
 </filter>

Second Order Low Pass Filter <double-exponential>

The double exponential filter is a low pass filter like the exponential filter with a steeper slope of the filter diagram. It acts basically like two chained exponential filters and it is some times called second order filter.

The configuration is the same for exponential and double-exponential filters, just the type entry differs.

 <filter>
   <type>double-exponential</type>
   <filter-time>0.16</filter-time>
   <input>/some/input</input>
   <output>/some/output/<output>
 </filter>

<moving-average>

Rate Limit Filter <noise-spike>

A better name for a noise spike filter would probably have been "rate limit filter". This is exactly what it does: limit the rate of change of the output value. The relevant configuration element is <max-rate-of-change> setting the maximum rate of change of the output property per second.

Example: A transition from 0 to 4 at the input property results in a linear increase of the output property over 8 seconds from 0 to 4 at a rate of 0.5/sec.

 <filter>
   <type>noise-spike</type>
   <max-rate-of-change>0.5</max-rate-of-change>
   <input>/some/input</input>
   <output>/some/output</output>
 </filter>

Reciprocal Filter <reciprocal>

Compute the reciprocal (1/x) value of the input property. If x is zero, no computation is performed. The optional <gain> element may be used to scale the value. Output computes as gain divided by input.

Example: compute the flight time per pound of burned fuel from the fuel flow

 <filter>
   <type>reciprocal</type>
   <gain>1.0</gain>
   <input>/engines/engine[0]/fuel-flow-pph</input>
   <output>/engines/engine[0]/fuel-flow-hpp</output>
 </filter>

PID Controller <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, and usage of <max> and <min> elements for clamping the output is mandatory. The 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:

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 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:

Kp gain of the proportional component
Ki gain of the integrator component

Predictor <predict-simple>

Estimates the future value for a given property based on its current (or averaged) rate of change.

Legal elements are:

seconds the time to be estimated ahead
filter-gain Smoothing factor (0.0-1.0, 1.0=no smoothing)

Example: compute estimated speed 5 seconds ahead

 <predict-simple>
   <name>predicted air speed 5 seconds ahead</name>
   <debug>false</debug>
   <input>velocities/airspeed-kt</input>
   <output>autopilot/internal/airspeed-5-sec-ahead</output>
   <seconds>5.0</seconds>
   <filter-gain>0.1</filter-gain>
 </predict-simple>

Proposed extensions

This sections contains new features for the autopilot to be implemented. Nobody knows if and when this will happen. Consider this as a collection of ideas as a base for discussion on the mailing list, the forum or IRC.