<?xml version="1.0"?>
<PropertyList>

<pid-controller>
    <name>Wing Leveler (Turn Coordinator based)</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>wing-leveler</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/orientation/roll-deg</prop>
    </input>
    <reference>
        <value>0.0</value>
    </reference>
    <output>
        <prop>/controls/flight/aileron</prop>
    </output>
    <config>
        <Kp>0.15</Kp>       <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for unfiltered -->
        <Ti>10.0</Ti>       <!-- integrator time -->
        <Td>0.01</Td>    <!-- derivator time -->
        <u_min>-1.0</u_min> <!-- minimum output clamp -->
        <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pi-simple-controller>
    <name>Heading Bug Hold (DG based) Stage 1</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>dg-heading-hold</value>
    </enable>
    <input>
        <prop>/autopilot/internal/fdm-heading-bug-error-deg</prop>
    </input>
    <reference>
        <value>0.0</value>
    </reference>
    <output>
        <prop>/autopilot/internal/target-roll-deg</prop>
    </output>
    <config>
        <Kp>-1.5</Kp>        <!-- proportional gain -->
        <Ki>0.0</Ki>         <!-- integral gain -->
        <u_min>-30.0</u_min> <!-- minimum output clamp -->
        <u_max>30.0</u_max>  <!-- maximum output clamp -->
    </config>
</pi-simple-controller>

<pid-controller>
    <name>Heading Bug Hold (DG based) Stage 2</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>dg-heading-hold</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/orientation/roll-deg</prop>
    </input>
    <reference>
        <prop>/autopilot/internal/target-roll-deg</prop>
    </reference>
    <output>
        <prop>/controls/flight/aileron</prop>
    </output>
    <config>
        <Kp>0.025</Kp>        <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>20.0</Ti>       <!-- integrator time -->
        <Td>0.0</Td>       <!-- derivator time -->
        <u_min>-0.7</u_min> <!-- minimum output clamp -->
        <u_max>0.7</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pi-simple-controller>
    <name>True Heading Hold (DG based) Stage 1</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>true-heading-hold</value>
    </enable>
    <input>
        <prop>/autopilot/internal/true-heading-error-deg</prop>
    </input>
    <reference>
        <value>0.0</value>
    </reference>
    <output>
        <prop>/autopilot/internal/target-roll-deg</prop>
    </output>
    <config>
        <Kp>-1.5</Kp>        <!-- proportional gain -->
        <Ki>0.0</Ki>         <!-- integral gain -->
        <u_min>-30.0</u_min> <!-- minimum output clamp -->
        <u_max>30.0</u_max>  <!-- maximum output clamp -->
    </config>
</pi-simple-controller>

<pid-controller>
    <name>True Heading Hold (DG based) Stage 2</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>true-heading-hold</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/orientation/roll-deg</prop>
    </input>
    <reference>
        <prop>/autopilot/internal/target-roll-deg</prop>
    </reference>
    <output>
        <prop>/controls/flight/aileron</prop>
    </output>
    <config>
        <Kp>0.25</Kp>        <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>10.0</Ti>       <!-- integrator time -->
        <Td>0.01</Td>       <!-- derivator time -->
        <u_min>-1.0</u_min> <!-- minimum output clamp -->
        <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>Nav1 Hold Stage 1</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>nav1-hold</value>
    </enable>
    <input>
        <prop>/autopilot/internal/nav1-heading-error-deg</prop>
    </input>
    <reference>
        <value>0.0</value>
    </reference>
    <output>
        <prop>/autopilot/internal/target-roll-deg</prop>
    </output>
    <config>
        <Kp>-1.0</Kp>        <!-- proportional gain -->
        <beta>1.0</beta>     <!-- input value weighing factor -->
        <alpha>0.1</alpha>   <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>   <!-- input value weighing factor for -->
        <Ti>40</Ti>          <!-- integrator time -->
        <Td>0.00001</Td>     <!-- derivator time -->
        <u_min>-30.0</u_min> <!-- minimum output clamp -->
        <u_max>30.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>Nav1 Hold Stage 2</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/heading</prop>
        <value>nav1-hold</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/orientation/roll-deg</prop>
    </input>
    <reference>
        <prop>/autopilot/internal/target-roll-deg</prop>
    </reference>
    <output>
        <prop>/controls/flight/aileron</prop>
    </output>
    <config>
        <Kp>0.5</Kp>        <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>10.0</Ti>       <!-- integrator time -->
        <Td>0.02</Td>       <!-- derivator time -->
        <u_min>-1.0</u_min> <!-- minimum output clamp -->
        <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>VS hold</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>vertical-speed-hold</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/velocities/vertical-speed-fps</prop>
    </input>
    <reference>
        <prop>/autopilot/settings/vertical-speed-fpm</prop>
    </reference>
    <output>
        <prop>/controls/engines/engine/throttle</prop>
    </output>
    <config>
        <Kp>-0.5</Kp>      <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>50.0</Ti>       <!-- integrator time -->
        <Td>0.0</Td>       <!-- derivator time -->
        <u_min>0.21</u_min> <!-- minimum output clamp -->
        <u_max>0.7</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pi-simple-controller>
    <name>Altitude Hold (Altimeter based) Stage 1</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>altitude-hold</value>
    </enable>
    <input>
        <prop>/position/altitude-ft</prop>
    </input>
    <reference>
        <prop>/autopilot/settings/target-altitude-ft</prop>
    </reference>
    <output>
        <prop>/autopilot/internal/target-climb-rate-fps</prop>
    </output>
    <config>
        <Kp>0.1</Kp>
        <Ki>0.0</Ki>
        <u_min>-40.0</u_min>
        <u_max>40.0</u_max>
    </config>
</pi-simple-controller>

<pid-controller>
    <name>Altitude Hold (Altimeter based) Stage 2</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>altitude-hold</value>
    </enable>
    <input>
        <prop>/velocities/vertical-speed-fps</prop>
    </input>
    <reference>
        <prop>/autopilot/internal/target-climb-rate-fps</prop>
    </reference>
    <output>
        <prop>/autopilot/settings/target-pitch-deg</prop>
    </output>
    <config>
        <Kp>0.05</Kp>       <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>20.0</Ti>       <!-- integrator time -->
        <Td>0.00001</Td>    <!-- derivator time -->
        <u_min>-5.0</u_min> <!-- minimum output clamp -->
        <u_max>5.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>Pitch hold</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>altitude-hold</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/orientation/pitch-deg</prop>
    </input>
    <reference>
        <prop>/autopilot/settings/target-pitch-deg</prop>
    </reference>
    <output>
        <prop>/controls/flight/elevator-trim</prop>
    </output>
    <config>
        <Kp>-0.05</Kp>      <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>10.0</Ti>       <!-- integrator time -->
        <Td>0.01</Td>       <!-- derivator time -->
        <u_min>-0.5</u_min> <!-- minimum output clamp -->
        <u_max>0.5</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>AGL Hold (Altimeter based) Stage 1</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>agl-hold</value>
    </enable>
    <input>
        <prop>/position/altitude-agl-ft</prop>
    </input>
    <reference>
        <prop>/autopilot/settings/target-agl-ft</prop>
    </reference>
    <output>
        <prop>/autopilot/internal/target-climb-rate-fps</prop>
    </output>
    <config>
        <Kp>0.3</Kp>
        <Ki>0.0</Ki>
        <beta>1.0</beta>
        <u_min>-33.33</u_min>
        <u_max>33.33</u_max>
    </config>
</pid-controller>

<pid-controller>
    <name>Altitude Hold (Altimeter based) Stage 2</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>afl-hold</value>
    </enable>
    <input>
        <prop>/velocities/vertical-speed-fps</prop>
    </input>
    <reference>
        <prop>/autopilot/internal/target-climb-rate-fps</prop>
    </reference>
    <output>
        <prop>/controls/flight/elevator-trim</prop>
    </output>
    <config>
        <Kp>-0.001</Kp>
        <beta>1.0</beta>
        <alpha>0.1</alpha>
        <gamma>0.0</gamma>
        <Ti>10.0</Ti>
        <Td>0.00001</Td>
        <u_min>-1.0</u_min>
        <u_max>1.0</u_max>
    </config>
</pid-controller>

<pid-controller>
    <name>Glideslope Hold</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>gs1-hold</value>
    </enable>
    <input>
        <prop>/velocities/vertical-speed-fps</prop>
    </input>
    <reference>
        <prop>/instrumentation/nav[0]/gs-rate-of-climb</prop>
    </reference>
    <output>
        <prop>/autopilot/settings/target-pitch-deg</prop>
    </output>
    <config>
        <Kp>0.06</Kp>       <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>10.0</Ti>       <!-- integrator time -->
        <Td>0.00001</Td>    <!-- derivator time -->
        <u_min>-5.0</u_min> <!-- minimum output clamp -->
        <u_max>5.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>Pitch hold</name>
    <debug>false</debug>
    <enable>
        <prop>/autopilot/locks/altitude</prop>
        <value>gs1-hold</value>
        <honor-passive>true</honor-passive>
    </enable>
    <input>
        <prop>/orientation/pitch-deg</prop>
    </input>
    <reference>
        <prop>/autopilot/settings/target-pitch-deg</prop>
    </reference>
    <output>
        <prop>/controls/flight/throttle</prop>
    </output>
    <config>
        <Kp>-0.15</Kp>      <!-- proportional gain -->
        <beta>1.0</beta>    <!-- input value weighing factor -->
        <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
        <gamma>0.0</gamma>  <!-- input value weighing factor for -->
        <Ti>10.0</Ti>       <!-- integrator time -->
        <Td>0.02</Td>       <!-- derivator time -->
        <u_min>-1.0</u_min> <!-- minimum output clamp -->
        <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
</pid-controller>

<pid-controller>
    <name>Speed hold (vary pitch) Stage #1</name>
    <debug>false</debug>
    <enable>
      <prop>/autopilot/locks/speed</prop>
      <value>speed-with-pitch-trim</value>
    </enable>
    <input>
      <prop>/velocities/airspeed-kt</prop>
    </input>
    <reference>
      <prop>/autopilot/settings/target-speed-kt</prop>
    </reference>
    <output>
      <prop>/autopilot/settings/target-pitch-deg</prop>
    </output>
    <config>
      <Kp>-1.5</Kp>       <!-- proportional gain -->
      <beta>1.0</beta>    <!-- input value weighing factor -->
      <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
      <gamma>0.0</gamma>  <!-- input value weighing factor for -->
                          <!-- unfiltered derivative error -->
      <Ti>1.0</Ti>        <!-- integrator time -->
      <Td>0.01</Td>    <!-- derivator time -->
      <u_min>-2.0</u_min><!-- minimum output clamp -->
      <u_max>10.0</u_max> <!-- maximum output clamp -->
    </config>
  </pid-controller>

 <pid-controller>
    <name>Speed hold (vary pitch) Stage #2</name>
    <debug>false</debug>
    <enable>
      <prop>/autopilot/locks/speed</prop>
      <value>speed-with-pitch-trim</value>
      <honor-passive>true</honor-passive>
    </enable>
    <input>
      <prop>/orientation/pitch-deg</prop>
    </input>
    <reference>
      <prop>/autopilot/settings/target-pitch-deg</prop>
    </reference>
    <output>
      <prop>/controls/flight/elevator-trim</prop>
    </output>
    <config>
      <Kp>-0.1</Kp>      <!-- proportional gain -->
      <beta>1.0</beta>    <!-- input value weighing factor -->
      <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
      <gamma>0.0</gamma>  <!-- input value weighing factor for -->
                          <!-- unfiltered derivative error -->
      <Ti>1.0</Ti>        <!-- integrator time -->
      <Td>0.001</Td>    <!-- derivator time -->
      <u_min>-1.0</u_min> <!-- minimum output clamp -->
      <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
  </pid-controller>
  
 <!--
 <pid-controller>
    <name>Yaw Damper</name>
    <debug>false</debug>
    <enable>
      <prop>/autopilot/locks/speed</prop>
      <value>speed-with-pitch-trim</value>
      <honor-passive>true</honor-passive>
    </enable>
    <input>
      <prop>/orientation/yaw-rate-degps</prop>
    </input>
    <reference>
      <value>0</value>
    </reference>
    <output>
      <prop>/controls/flight/rudder-trim</prop>
    </output>
    <config>
      <Kp>0.01</Kp>
      <beta>1.0</beta>
      <alpha>0.1</alpha>
      <gamma>0.0</gamma>
      <Ti>10.0</Ti>
      <Td>0.001</Td>
      <u_min>-0.5</u_min>
      <u_max>0.5</u_max>
    </config>
  </pid-controller>
-->
</PropertyList>

