Howto:Design an autopilot: Difference between revisions

Jump to navigation Jump to search
m
small visual edits
m (Add link to reference page)
m (small visual edits)
Line 2: Line 2:


This [[:Category:Howto|howto]] will guide you through the process of designing a stable and fully functional [[autopilot]] in [[FlightGear]]. We won't cover every single aspect, because there are hunderts of [[aircraft]] out there, with dozens of different autopilot configurations. However, after reading this howto, you should be able to be creative and create unexisting configurations.
This [[:Category:Howto|howto]] will guide you through the process of designing a stable and fully functional [[autopilot]] in [[FlightGear]]. We won't cover every single aspect, because there are hunderts of [[aircraft]] out there, with dozens of different autopilot configurations. However, after reading this howto, you should be able to be creative and create unexisting configurations.
For a technical reference of the used elements, check [[Autopilot_Configuration_Reference]]
 
For a technical reference of the used elements, check [[Autopilot Configuration Reference]].


===Pre-design===
===Pre-design===
Line 31: Line 32:
===A first controller: heading hold===
===A first controller: heading hold===
Let's start with a simple wing leveler that keeps your bank angle at zero (or any arbitrary value later). This could be a PID controller with the input from your current roll and a reference of zero. Output should go to your aileron-cmd. Start with:
Let's start with a simple wing leveler that keeps your bank angle at zero (or any arbitrary value later). This could be a PID controller with the input from your current roll and a reference of zero. Output should go to your aileron-cmd. Start with:
* Kp:  0.00
* '''Kp:'''   0.00
* Ti: 100.00
* '''Ti:''' 100.00
* Td:  0.00
* '''Td:'''   0.00
 
Be sure to add an <enable> element to easily enable/disable your controller if it gets unstable.
Be sure to add an <enable> element to easily enable/disable your controller if it gets unstable.


<pid-controller>
<pid-controller>
<name>Heading hold</name>
  <name>Heading hold</name>
<debug>false</debug>
  <debug>false</debug>
<enable>
  <enable>
<prop>/autopilot/locks/heading</prop>
  <prop>/autopilot/locks/heading</prop>
<value>wing-leveler</value>
  <value>wing-leveler</value>
</enable>
  </enable>
<input>
  <input>
<prop>/orientation/roll-deg</prop>
  <prop>/orientation/roll-deg</prop>
</input>
  </input>
<reference>0</reference>
  <reference>0</reference>
<output>
  <output>
<prop>/controls/flight/aileron</prop>
  <prop>/controls/flight/aileron</prop>
</output>
  </output>
<config>
  <config>
<Kp>0.00</Kp>
  <Kp>0.00</Kp>
<Ti>100.0</Ti>
  <Ti>100.0</Ti>
<Td>0.0</Td>
  <Td>0.0</Td>
<u_min>-1.0</u_min>
  <u_min>-1.0</u_min>
<u_max>1.0</u_max>
  <u_max>1.0</u_max>
</config>
  </config>
</pid-controller>
</pid-controller>


Since this is our first controller, we will give a short explenation of each part.
Since this is our first controller, we will give a short explenation of each part.


* Name: is only used for debugging.
* '''Name:''' is only used for debugging.
* Debug:  
* '''Debug:'''
* Enable: when the condition is true, the controller will be activated. In this case that will be when <tt>/autopilot/locks/heading=wing-leveler</tt>.
* '''Enable:''' when the condition is true, the controller will be activated. In this case that will be when <tt>/autopilot/locks/heading=wing-leveler</tt>.
* Input: is the property that will be monitored by the controller. As our aim is to have a roll of zero degree, our input property is our roll orientation.  
* '''Input:''' is the property that will be monitored by the controller. As our aim is to have a roll of zero degree, our input property is our roll orientation.  
* Reference: most of the time this is a prop, like input, but for this one we'll use a static value. The controller will try to get the value of the input to this reference-value.
* '''Reference:''' most of the time this is a property, like input, but for this one we'll use a static value. The controller will try to get the value of the input to this reference-value.
* Output: the controller controls flight surfaces, in order to get the input value to the reference one.
* '''Output:''' the controller controls flight surfaces, in order to get the input value to the reference one.
* Config: thit is the tricky part. All these settings affect the behaviour (response time, surface deflection etc.) of the controller.
* '''Config:''' thit is the tricky part. All these settings affect the behaviour (response time, surface deflection etc.) of the controller.
** u_min: the minimum output.
** '''u_min:''' the minimum output.
** u_max: the maximum output.
** '''u_max:''' the maximum output.


To get an idea of the Kp-value, you need to do a simple calclulation. The PID controller computes "reference - input". If you want wings leveled (zero roll) and your current bank angle is, say 30 degrees, the result of "reference - input" is -30. If you think you need full aileron deflection to get from 30 degrees bank to zero in a reasonable time, you need a factor of 1/30=0.033, because aileron-cmd is in the range of -1 to +1. This is the approximate value for your Kp.
To get an idea of the Kp-value, you need to do a simple calclulation. The PID controller computes "reference - input". If you want wings leveled (zero roll) and your current bank angle is, say 30 degrees, the result of "reference - input" is -30. If you think you need full aileron deflection to get from 30 degrees bank to zero in a reasonable time, you need a factor of 1/30=0.033, because aileron-cmd is in the range of -1 to +1. This is the approximate value for your Kp.

Navigation menu