FGLiveProvider
From j661
The FGLiveProvider contrib is a DataProvider which connect to a live FlightGear instance.
Contents |
Architecture
The FGLiveProvider is a DataProvider which connect to a live FlightGear instance. The architecture of the contrib application is simply constituted by an Embedded Client which is configured by the providers property to use the FGLiveProvider library, and defines the correspondence between the FlightGear tree variables and the ARINC661 parameters:
providers=fgLiveProvider.jar providerConfs=../samples/playbackConfig.xml fg.port=7401 fg.tree=../samples/GenericFlightGearTree fg.host=127.0.0.1
The fg.tree and fg.host properties are optional:
- If fg.host is undefined, the local host will be used
- If fg.tree is undefined, an internal minimal tree definition will be used
FlightGear tree definition
The fg.tree property must point to an XML file defining the properties which will be used by the provider (there can be more properties in the definition than only those that will be used, so one XML definition can be used)
Grammar
<!ELEMENT FlightGearTree (node*)> <!ATTLIST FlightGearTree version CDATA #REQUIRED> <!ATTLIST FlightGearTree desc CDATA #IMPLIED> <!ELEMENT node (node*, variable)> <!ATTLIST node name CDATA #REQUIRED> <!ELEMENT variable EMPTY> <!ATTLIST variable name CDATA #REQUIRED> <!ATTLIST variable alias CDATA #IMPLIED> <!ATTLIST variable type (float|double|int|boolean|string) #REQUIRED>
Content of the tree representation
The content is grouped by nodes in the FlightGear tree. The leaf elements are FlightGear properties which have a name , a type, and optionally an alias. The variables will be used in the DataProvider configuration by their names (excluding their parent nodes), or their alias if there is one.
The alias allows to have two properties under the same name in the tree representation, or to simplify the property name for readability.
Note that there can be any nodes under a parent node.
Example
<FlightGearTree>
<node name="controls">
<node name="flight">
<variable name="aileron[0]" alias="aileron" type="float" />
</node>
</node>
<node name="position">
<variable name="altitude-ft" type="float" />
<variable name="ground-elev-ft" type="float" />
<variable name="latitude-deg" type="float" />
<variable name="longitude-deg" type="float" />
</node>
<node name="orientation">
<variable name="roll-deg" type="float" />
<variable name="pitch-deg" type="float" />
<variable name="heading-deg" type="float" />
<variable name="alpha-deg" type="float" />
</node>
<node name="velocities">
<variable name="airspeed-kt" type="float" />
<variable name="mach" type="float" />
<variable name="speed-north-fps" type="float" />
<variable name="speed-east-fps" type="float" />
<variable name="speed-down-fps" type="float" />
</node>
</FlightGearTree>
How to use it
The fgLive.bat file allows to start the Embedded Client with the appropriate options.
- When starting the Embedded Client, select the arinc.properties file in the config directory as the configuration file.
- Click on the "Activate" button on the toolbar to connect the Client and the Server
- The button image will change to show you that the Client and the Server have been connected
- You can then click on the Start option in the "File" menu to start to listen to FlightGear data.
The connection will be effective as soon as FlightGear has started. You will see the current cycle increasing and the values for the latitude and longitude changing.
Starting FlightGear
You need to start FlightGear by enabling the telnet usage, for example with the following bat file (in the bin directory of your FlightGear install):
Win32\fgfs --telnet=7401
Here 7401 is the same port which must be defined under the fg.port property in the properties file.
Note that with this default way of enabling Telnet on FlightGear, it will poll for "get" commmands on the Telnet port each 200 ms (5 Hz), which is not enough for live parameters of course. To avoid lag, you will need to specify the polling rate. For example, to poll at a 100 Hz rate:
Win32\fgfs --telnet=foo,bar,100,foo,7401,bar
(here the foo and bar parameters are not used by FlightGear and are not significant, you can put anything you want there).
See also
- Embedded Client
- DataProvider
- FGPlayback, another provider which connect to a FlightGear recording
External links
- Playback protocol definition
- Invoking FlightGear's generic IO subsystem
- FlightGear telnet usage
- FlightGear property tree



