Autopilot PID controller tuning resources: Difference between revisions

Jump to navigation Jump to search
+- first section; Link to autopilot and route manager subforum using Template:Forum; De-camel case section titles; Moving up images
No edit summary
(+- first section; Link to autopilot and route manager subforum using Template:Forum; De-camel case section titles; Moving up images)
Line 1: Line 1:
[[File:FgPlot.jpg|400px|thumb|[[FGPlot]] can be used to plot the value properties while tuning an autopilot.]]
{{forum|46|Autopilot & Route Manager}}
{{Autoflight Navigation}}
{{Autoflight Navigation}}


The [[FlightGear]] [[Autopilot]] is a modular system based on PID controllers. Here are some tips to help tuning such a controller. There is lot of documentation all over the Internet about how to tune the parameters, having this you will have to figure out how the Flightgear PID controller implementation works.
The [[FlightGear]] [[Autopilot]] is a modular system to some extent based on PID controllers. Here are some tips to help tuning such a controller. There is lot of documentation all over the Internet about how to tune the parameters, having this you will have to figure out how the FlightGear PID controller implementation works.


First of all, have a look at the code where you will see the algorithm which is used for our autopilot. Checking existing autopilot configurations in Flightgear aircraft will also help.
First of all, have a look at the code where you will see the algorithm which is used for our autopilot. Checking existing autopilot configurations in FlightGear aircraft will also help.


There is actually a doc about filters in Flightgear documentation. Filters can be applied on input or ouput values, in other words, before and after the PID controller (execution).
There is actually a doc about filters in FlightGear documentation. Filters can be applied on input or output values, in other words, before and after the PID controller (execution).


{{Systems_Modeling_Disclaimer}}
{{Systems_Modeling_Disclaimer}}


For built-in runtime plotting of FlightGear properties (including FDM/Autopilot properties), check out [[FGPlot]] (available in FlightGear 2.11+).
=== FlightGear PID controller ===
[[File:FgPlot.jpg|400px]]  
[[File:pid_controler.png|thumb|PID parameter's application]]
[[File:pid_cotroler_data_graph.png|thumb|Datas of an Auto-trim PID Controller displayed as graphs]]


=== FlightGear PID Controller ===
Knowing the algorithm is mandatory, certain values are forbidden, for example they can lead to a division by zero. Then you will have to understand where the parameters apply to act on the chosen correction module. See the schema which is a good reminder while testing.
Knowing the algorithm is mandatory, certain values are forbidden, for example they can lead to a division by zero. Then you will have to understand where the parameters apply to act on the chosen correction module. See the schema which is a good reminder while testing.
[[File:pid_controler.png|thumb|PID parameter's application]]
[[File:pid_cotroler_data_graph.png|thumb|Datas of an Auto-trim PID Controller displayed as graphs]]


You can find good explanations on how to practically tune the controller. [http://en.wikipedia.org/wiki/PID_controller Wikipedia's article on the PID Controller]
You can find good explanations on how to practically tune the controller. [http://en.wikipedia.org/wiki/PID_controller Wikipedia's article on the PID Controller]


=== Getting graphs of Controller action (Linux) ===
=== Getting graphs of controller action (Linux) ===
While it's possible to tune a PID controller by testing directly the aircraft behavior under the autopilot control, it can be really useful to get everything in graphical view.
While it's possible to tune a PID controller by testing directly the aircraft behavior under the autopilot control, it can be really useful to get everything in graphical view.


Line 52: Line 52:
* [http://kst.kde.org/ Kst, real-time large-dataset viewing and plotting tool]
* [http://kst.kde.org/ Kst, real-time large-dataset viewing and plotting tool]


=== Getting graphs of Controller action (Windows) ===
=== Getting graphs of controller action (Windows) ===
[[File:Live-graph-datafile-settings.png‎|thumb|Setting the Logfile input]]
[[File:Livegraph-graph-settings.png‎|thumb|Setting the visuals]]
[[File:Livegraph-dataseries-settings.png‎|thumb|Finetuning the visuals]]
[[File:Livegraph-plot.png‎|thumb|Livegraph plotted data]]


Under Windows the script of the Linux chapter works (with some minor modifications) together with Live-Graph under Windows, too. Although the output to a logfile is not as fluently as you may experience it under Linux. To get an output you first need a slightly modified version of the above mentioned Perl script:
Under Windows the script of the Linux chapter works (with some minor modifications) together with Live-Graph under Windows, too. Although the output to a logfile is not as fluently as you may experience it under Linux. To get an output you first need a slightly modified version of the above mentioned Perl script:
Line 70: Line 74:
}
}
</pre>
</pre>
[[File:Live-graph-datafile-settings.png‎|thumb|Setting the Logfile input]]
[[File:Livegraph-graph-settings.png‎|thumb|Setting the visuals]]
[[File:Livegraph-dataseries-settings.png‎|thumb|Finetuning the visuals]]
[[File:Livegraph-plot.png‎|thumb|Livegraph plotted data]]


The first 4 lines prepare a kind of "header" in the Logfile so that the Grapher can use it. In the while-part I added the pipe sign as separator so that Live-Graph can use the output. Copy and paste these lines into your favorite ASCII text editor and save it to your FG directory (e.g. save as "fgfsparser.pl"). Next you need to install a Perl Interpreter (e.g. [http://www.activestate.com/activeperl Activestate's Active Perl]). Now start Flightgear the following way:
The first 4 lines prepare a kind of "header" in the Logfile so that the Grapher can use it. In the while-part I added the pipe sign as separator so that Live-Graph can use the output. Copy and paste these lines into your favorite ASCII text editor and save it to your FG directory (e.g. save as "fgfsparser.pl"). Next you need to install a Perl Interpreter (e.g. [http://www.activestate.com/activeperl Activestate's Active Perl]). Now start Flightgear the following way:
Line 91: Line 90:
With "debug" in your AP.xml set to "true" you will now get the logfile filled and step by step the data will be visualized in Live-Graph. Now it's time to preset the autopilot to an initial value and to start the testing.
With "debug" in your AP.xml set to "true" you will now get the logfile filled and step by step the data will be visualized in Live-Graph. Now it's time to preset the autopilot to an initial value and to start the testing.


== Alternative Method ==
== Alternative method ==
As an alternative to using the controller's debug output you can use the built in logging system of FlightGear. This can be configured through the preferences.xml file, or at runtime via the File->Logging menu option.
As an alternative to using the controller's debug output you can use the built in logging system of FlightGear. This can be configured through the preferences.xml file, or at runtime via the File->Logging menu option.


Navigation menu