13,212
edits
(Clarifying the difference between autopilot and property-rule configurations; reordering a few sections) |
(+-Performance considerations; Documenting <params> and aliases, using README.xmlpanel as reference) |
||
Line 17: | Line 17: | ||
The main difference between XML based autopilot and property-rule systems is the update rate: | The main difference between XML based autopilot and property-rule systems is the update rate: | ||
* Autopilot configurations run at FDM rate | * Autopilot configurations run at [[FDM]] rate | ||
* Property-rule configurations run at frame | * Property-rule configurations run at frame rate | ||
=== Performance considerations === | |||
Using property-rule elements for things that does not have to run a FDM rate can improve the frame rate, in particular for complex systems and on weaker computers. Depending on FlightGear settings and the hardware, the FDM rate is about 2–10 times higher than the frame rate. | |||
It is possible to implement a system using both autopilot and property-rule based elements. They can communicate with each other using [[Property tree|properties]]. The only disadvantage is that they will be split between an autopilot and a property-rule configuration file. | |||
For example would a fly-by-wire flight control system element augmenting an instable aircraft need to run at FDM rate, while an element depending on the flap extension would work just as well at frame rate. | |||
== Adding a configuration to an aircraft == | == Adding a configuration to an aircraft == | ||
Line 84: | Line 87: | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<PropertyList> | <PropertyList> | ||
<params> | <params include="MyParams.xml"> <!-- Params can be included like this --> | ||
<controls> | <controls> | ||
<aileron>controls/flight/aileron</aileron> | <aileron>controls/flight/aileron</aileron> | ||
Line 91: | Line 94: | ||
</controls> | </controls> | ||
</params> | </params> | ||
<!-- Place your components here --> | <!-- Place your components here --> | ||
<!-- | <!-- | ||
Line 96: | Line 100: | ||
<name>Myfilter</name> | <name>Myfilter</name> | ||
<input>/foo</input> | <input>/foo</input> | ||
<output>/bar</output> | |||
</filter> | |||
<filter> | |||
<name>Myfilter</name> | |||
<input alias="/params/control/aileron"/> Aliasing a property name | |||
<output>/bar</output> | <output>/bar</output> | ||
</filter> | </filter> | ||
Line 102: | Line 111: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{tip|Using aliased property names is good style and makes the configuration file more readable. | The location and the name of the configuration file is up to the developer. A descriptive name like <code>autopilot.xml</code> might be a good choice. Most developers put these files into the <code>Systems</code> folder of the aircraft. | ||
{{tip|Using aliased property names is good style and makes the configuration file more readable. The params section may be included from an external file to avoid duplication of code. | |||
For complex systems, spread over multiple autopilot and/or property-rule configuration files, this can greatly aid debugging and maintenance.}} | |||
{{tip|Commenting the configuration file to document the purpose elements and groups of elements and what they are intended to do can also aid debugging and maintenance.}} | |||
== Available elements == | == Available elements == |