• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Serial/H03-May-2022-

img/H03-May-2022-

keyboard/H03-May-2022-248234

model-combined.eff/H29-Jul-2021-669443

FGShortRef.cssH A D29-Jul-20217.4 KiB150147

Goldhofert.xmlH A D29-Jul-20213.4 KiB153114

Nasal-doc.texH A D29-Jul-202199.9 KiB1,4621,200

READMEH A D29-Jul-2021305 126

README.3DCloudsH A D29-Jul-202110.1 KiB241193

README.IOH A D29-Jul-20214.5 KiB14888

README.JSBsimH A D29-Jul-20212 KiB5438

README.JoystickH A D29-Jul-202159 21

README.add-onsH A D29-Jul-202134.4 KiB926708

README.airspeed-indicatorH A D29-Jul-20213 KiB8461

README.autopushH A D29-Jul-20218.6 KiB256186

README.checklistsH A D29-Jul-20212.1 KiB5443

README.commandsH A D29-Jul-202110.7 KiB332242

README.conditionsH A D29-Jul-20215.2 KiB215156

README.digitalfiltersH A D29-Jul-202117.9 KiB454386

README.effectsH A D29-Jul-202115.6 KiB422344

README.electricalH A D29-Jul-20216.2 KiB171127

README.embedded-resourcesH A D29-Jul-202121.7 KiB475379

README.expressionsH A D29-Jul-20214.7 KiB10892

README.fgjsH A D29-Jul-20211.5 KiB4629

README.flightrecorderH A D29-Jul-202111.2 KiB295237

README.guiH A D29-Jul-202116.9 KiB682481

README.hudH A D29-Jul-202110.6 KiB414253

README.introductionH A D29-Jul-20212.9 KiB8960

README.jsclientH A D29-Jul-2021561 1613

README.layoutH A D29-Jul-20214.2 KiB8671

README.loggingH A D29-Jul-20213 KiB8975

README.materialsH A D29-Jul-202112.7 KiB259191

README.mingwH A D29-Jul-20212.9 KiB149108

README.minipanelH A D29-Jul-20211.2 KiB3322

README.multiplayerH A D29-Jul-20214.7 KiB12694

README.multiscreenH A D29-Jul-20219.9 KiB322284

README.osgtextH A D29-Jul-20214.3 KiB120103

README.propertiesH A D29-Jul-20216.4 KiB259224

README.protocolH A D29-Jul-20217.1 KiB251174

README.sceneryH A D29-Jul-202125.1 KiB697491

README.soundH A D29-Jul-20213.5 KiB10374

README.submodelsH A D29-Jul-20218.8 KiB2141

README.systemsH A D29-Jul-20214.8 KiB135110

README.tutorialsH A D29-Jul-202116.2 KiB480335

README.wildfireH A D29-Jul-20214.5 KiB139103

README.xmlhudH A D29-Jul-202116.4 KiB415323

README.xmlpanelH A D29-Jul-202125.5 KiB660561

README.xmlparticlesH A D29-Jul-20219.3 KiB277248

README.xmlsoundH A D29-Jul-202111.6 KiB349259

README.xmlsyntaxH A D29-Jul-20215.2 KiB187122

README.yasimH A D29-Jul-202148.1 KiB839790

autopush-config.xml.templateH A D29-Jul-2021999 3130

compile_docs.pyH A D29-Jul-20219.6 KiB227177

README

1FGShortRef.pdf describes the key bindings and has a
2nice short description of controls for FGFS.
3
4The HTML documentation is a copy of the official
5manual. If you would like a nicely printed copy
6it is available in PDF form at the the FGFS website
7
8http://flightgear.org/Docs/InstallGuide/getstart.pdf
9
10
11
12

README.3DClouds

1Configuring 3D Clouds
2=====================
3
43D clouds can be created in two ways:
5- By placing individual clouds using a command (e.g. from Nasal)
6- Using the global weather function, which reads cloud definition from
7  an XML file.
8
9Placing Clouds Individually
10===========================
11
12Clouds are created using the "add-cloud" command, passing a property
13node defining the location and characterstics of the cloud.
14
15Location is defined by the following properties:
16
17<layer>      - The cloud layer number to add the cloud to. (default 0)
18<index>      - A unique identifier for the cloud in the layer. If a cloud
19               already exists with this index, the new cloud will not be
20               created, and 0 is returned.
21<lon-deg>    - Longitude to place the cloud, in degrees (default 0)
22<lat-deg>    - Latitude t place the cloud, in degrees (default 0)
23<alt-ft>     - Altitude to place the cloud, relative to the layer (!) in ft
24               (default 0)
25<x-offset-m> - Offset in m from the lon-deg. +ve is south (default 0)
26<y-offset-m> - Offset in m from the lat-deg. +ve is east (default 0)
27
28The cloud itself is built up of a number of "sprites" - simple 2D textures
29that are always rotated to be facing the viewer. These sprites are handled
30by a OpenGL Shader - a small program that is run on your graphics card.
31
32The cloud is defined by the following properties:
33
34<min-cloud-width-m>   - minimum width of the cloud in meters (default 500)
35<max-cloud-width-m>   - maximum width of the cloud (default min-cloud-width-m*1.5)
36<min-cloud-height-m>  - minimum height of the cloud (default 400)
37<max-cloud-height-m>  - maximum height of the cloud (default min-cloud-height-m*1.5)
38<texture>             - texture file of sprites to use (default cl_cumulus.png)
39<num-textures-x>      - number of cloud textures defined horizontally in the
40                        texture file (default 4)
41<num-textures-y>      - number of cloud textures defined vertically in the
42                        texture file (default 4)
43<height-map-texture>  - whether to choose the vertical texture index based on
44                        sprite height within the clouds (default false)
45<num-sprites>         - Number of sprite to generate for the cloud (default 20)
46<min-sprite-width-m>  - minimum width of the sprites used to create the cloud
47                        (default 200)
48<max-sprite-width-m>  - maximum width of the sprites used to create the cloud
49                        (default min-sprite-width-m*1.5)
50<min-sprite-height-m> - minimum height of the spites used to create the cloud
51                        (default 150)
52<max-sprite-height-m> - maximum height of the sprites used to create the cloud
53                        (default min-sprite-height-m*1.5)
54<z-scale>             - vertical scaling factor to apply to to the sprite after
55                        billboarding. A small value would create a sprite that
56                        looks squashed when viewed from the side. (default 1.0)
57<min-bottom-lighting-factor> - See Shading below (default 1.0)
58<max-bottom-lighting-factor> - See Shading below (default min-...-factor + 0.1)
59<min-middle-lighting-factor> - See Shading below (default 1.0)
60<max-middle-lighting-factor> - See Shading below (default min-...-factor + 0.1)
61<min-top-lighting-factor>    - See Shading below (default 1.0)
62<max-top-lighting-factor>    - See Shading below (default min-...-factor + 0.1)
63<min-shade-lighting-factor>  - See Shading below (default 0.5)
64<max-shade-lighting-factor>  - See Shading below (default min-...-factor + 0.1)
65
66Shading
67-------
68
69the [min|max]-...-lighting-factor properties allow you to define diffuse lighting
70multipliers to the bottom, middle, top, sunny and shaded parts of the cloud. In
71each case, individual clouds will have a random multiplier between the min and
72max values used to allow for some variation between individual clouds.
73
74The top, middle and bottom lighting factors are applied based on the pixels vertical
75positon in the cloud. A linear interpolation is used either between top/middle (if
76the pixel is above the middle of the cloud) or middle/bottom (if the pixel is below
77the middle of the cloud).
78
79The top factor is also applied to _all_ pixels on the sunny side of the cloud. The
80shade factor is applied based on the pixel position away from the sun, linearly
81interpolated from top to shade. E.g this is not a straight linear interpolation
82from top to shade across the entire cloud.
83
84The final lighting factor is determined by the minimum of the vertical factor and
85the sunny/shade factor. Note that this is applied to the individual pixels, not
86sprites.
87
88Textures
89--------
90
91The texture to use for the sprites is defined in the <texture> tag.
92To allow some variation, you can create a texture file containing multiple
93sprites in a grid, and define the <num-textures-x/y> tags. The code
94decides which texture to use for a given sprite : randomly in the x-direction
95and based on the altitude of the sprite within the cloud in the y-direction
96if <height-map-texture> is set. Therefore, you should put sprite textures
97you want to use for the bottom of your cloud at the bottom of the texture
98file, and those you want to use for the top of the cloud at the top of the
99texture file.
100
101For example, the following Nasal snippet will create a cloud immediately above the
102aircraft at an altitude of 1000 ft above /environment/clouds/layer[0]/elevation-ft :
103
104var p = props.Node.new({ "layer" : 0,
105                         "index": 1,
106                         "lat-deg": getprop("/position/latitude-deg"),
107                         "lon-deg": getprop("/position/longitude-deg"),
108                         "alt-ft" : 1000 });
109fgcommand("add-cloud", p);
110
111Moving Individual Clouds
112========================
113
114Clouds may be moved by using the "move-cloud" command. This takes the following
115property arguments.
116
117<layer>      - The cloud layer number containing the cloud to move. (default 0)
118<index>      - The unique identifier of the cloud to move.
119<lon-deg>    - Longitude to place the cloud, in degrees (default 0)
120<lat-deg>    - Latitude t place the cloud, in degrees (default 0)
121<alt-ft>     - Altitude to place the cloud, relative to the layer (!) in ft
122               (default 0)
123<x-offset-m> - Offset in m from the lon-deg. +ve is south (default 0)
124<y-offset-m> - Offset in m from the lat-deg. +ve is east (default 0)
125
126Deleting Individual Clouds
127===========================
128
129Clouds may be deleted by using the "del-cloud" command. This takes the following
130property arguments.
131
132<layer>      - The cloud layer number containing the cloud to delete. (default 0)
133<index>      - The unique identifier of the cloud to delete.
134
135Global 3D Clouds
136================
137
138The global weather system uses sets of clouds defined in
139FG_ROOT/Environment/cloudlayers.xml
140
141The file has 3 distinct sections: layers, cloud boxes and clouds,
142described below.
143
144Notes for those editing clouds:
145- All distances are in m. Note that this is in contrast to cloud heights
146  in METAR etc. which are in ft.
147- The XML file is loaded into the properties system, so you can modify
148  the settings in-sim, and see the results by re-generating the cloud
149  layer. The simplest way to do this is to disable METAR, and control
150  the cloud layers using the Clouds dialog, and in particular the coverage.
151- Texture files are in .png format, and have a transparent background.
152  To make the textures easier to edit, create a black layer behind them,
153  so there is some contrast between the background and the white cloud.
154  Having a grid based on the texture dimensions also helps, so you don't
155  bleed over the edges, which causes ugly sharp horizontal and vertical
156  lines.
157
158Clouds
159======
160
161The cloud definitions are as described above for placing individual
162clouds, but no position information is used (this is defined in the
163cloud box and layers below).
164
165Cloud Boxes
166===========
167
168The <boxes> section contains definitions of groups of cloads,for example
169an entire towering CB mass.
170
171The <boxes> section contains a number of named types, which are referenced
172by the <layers> section, described below. Therefore, the names used are
173completely user-defined.
174
175Each of the named section consists of one or more <box> section,
176defining a particular cloud type
177
178Each <box> section contains the following tags:
179
180<type>   - The cloud to use, defined above
181<count>  - The number of clouds to generate (+/- 50%)
182<width>  - The x and y within which these clouds should be generated
183<height> - The height within which the clouds should be generated
184<hdist>  - The horizontal distribution of the clouds within the area.
185           Equates to a sum of random distributions. Defaults to 1.
186           1 = even distribution, 2 = distributed towards the center.
187           3 = very strongly distributed towards the center.
188<vdist>  - The vertical distribution of the clouds. As for hdist.
189
190
191If the  /sim/rendering/clouds3d-density is less than 1.0 (100%), then a
192proportional number of clouds will be displayed.
193
194The following example shows a stratus cloud group, which consists of 5
195st-large clouds and 5 st-small clouds, distributed in a box 2000mx2000m,
196and 100m high, evenly distributed.
197
198    <st>
199      <box>
200        <type>st-large</type>
201        <count>5</count>
202        <width>2000</width>
203        <height>100</height>
204      </box>
205      <box>
206        <type>st-small</type>
207        <count>5</count>
208        <width>2000</width>
209        <height>100</height>
210      </box>
211    </st>
212
213
214Layers
215======
216
217The <layers> section contains definitions for a specific layer type.
218The layer type is derived from the METAR/Weather settings by FG itself.
219
220Each layer type is a named XML tag, i.e.: ns, sc, st, ac, cb, cu.
221If a layer type is not defined, then a 2D layer is used instead.
222
223The layer type contains one or more <cloud> definitions. This
224defines a type of cloud box, and a weighting for that type (<count>).
225
226For example, the following XML fragment will produce 3 "cb" cloud boxes
227for every 1 "cu":
228
229<cloud>
230    <name>cb</name>
231    <count>3</count>
232</cloud>
233<cloud>
234    <name>cu</name>
235    <count>1</count>
236</cloud>
237
238Clouds are randomly distributed across the sky in the x/y plane, but the
239height of them is set by the weather conditions, with a random height range
240applied, defined by <grid-z-rand>
241

README.IO

1This document describes how to invoke FlightGear's generic IO subsystem.
2
3FlightGear has a fairly flexible generic IO subsystem that allows you
4to "speak" any supported protocol over any supported medium.  The IO
5options are configured at runtime via command line options.  You can
6specify multiple entries if you like, one per command line option.
7
8
9The general form of the command line option is as follows:
10
11    --protocol=medium,direction,hz,medium_options,...
12
13    protocol = { native, nmea, garmin, fgfs, rul, pve, ray, etc. }
14    medium = { serial, socket, file, etc. }
15    direction = { in, out, bi }
16    hz = number of times to process channel per second (floating
17         point values are ok.
18
19
20Generic Communication:
21
22    --generic=params
23
24    With this option it is possible to output a pre-configured
25    ASCII string or binary sequence  using a predefined separator.
26    The configuration is defined in an XML file located in the
27    Protocol directory of the base package.
28
29    params can be:
30    serial port communication:    serial,dir,hz,device,baud,protocol
31    socket communication:         socket,dir,hz,machine,port,style,protocol
32    i/o to a file:                file,dir,hz,filename,protocol
33
34    See README.protocol for how to define a generic protocol.
35
36
37Serial Port Communication:
38
39    --nmea=serial,dir,hz,device,baud
40
41    device = OS device name of serial line to be open()'ed
42    baud = {300, 1200, 2400, ..., 230400}
43
44    example to pretend we are a real gps and output to a moving map application:
45
46    --nmea=serial,out,0.5,COM1,4800
47
48    Note that for unix variants you might use a device name like "/dev/ttyS0"
49
50
51Socket Communication:
52
53    --native=socket,dir,hz,machine,port,style
54
55    machine = machine name or ip address if client (leave empty if server)
56    port = port, leave empty to let system choose
57    style = tcp or udp
58
59    example to slave one copy of fgfs to another
60
61    fgfs1:  --native=socket,out,30,fgfs2,5500,udp
62    fgfs2:  --native=socket,in,30,,5500,udp --fdm=external
63
64    This instructs the first copy of fgfs to send UDP packets in the
65    native format to a machine called fgfs2 on port 5500.
66
67    The second copy of fgfs will accept UDP packets (from anywhere) on
68    port 5500.  Note the additional --fdm=external option.  This tells
69    the second copy of fgfs to not run the normal flight model, but
70    instead set the FDM values based on an external source (the
71    network in this case.)
72
73
74File I/O:
75
76    --garmin=file,dir,hz,filename
77
78    filename = file system file name
79
80    example to record a flight path at 10 hz:
81
82    --native=file,out,10,flight1.fgfs
83
84    example to replay your flight
85
86    --native=file,in,10,flight1.fgfs --fdm=external
87
88    You can make the replay from a file loop back to the beginning
89    when it reaches the end of the file with the "repeat" flag:
90
91    --generic=file,in,20,flight.out,playback,repeat
92
93    With a numeric argument, FlightGear will exit after that number of repeats.
94    --generic=file,in,20,flight.out,playback,repeat,5
95
96
97Moving Map Example:
98
99    Per Liedman has developed a moving map program called Atlas
100    (atlas.sourceforge.net) The initial inspiration and much code came
101    from Alexei Novikov.
102
103    The moving map supports NMEA format input either via network or
104    via serial port.  Either way will work, but this example
105    demonstrates the use of a socket connection.
106
107    Start up fgfs with:
108
109        fgfs --nmea=socket,out,0.5,atas-host-name,5500,udp
110
111    Start up the Atlas program with:
112
113        Atlas --udp=5500 --fgroot=path-to-fg-root --glutfonts
114
115    Once both programs are running, the Atlas program should display
116    your current location.  Atlas is a really nifty program with many
117    neat options such as the ability to generate and use background
118    bitmaps that show the terrain, cities, lakes, oceans, rivers, etc.
119
120
121HTTP Server Example
122
123    You can now interact with a running copy of FlightGear using your
124    web browser.  You can view all the key internal variables and even
125    change the ones that are writable.  If you have support in your
126    favorite [scripting] language for interacting with an http server,
127    you should be able to use this as a mechanism to interface your
128    script with FlightGear.
129
130    Start up fgfs with the --httpd=<port#> option:
131
132    For example:
133
134        fgfs --httpd=5500
135
136    Now point your web browser to:
137
138        http://host.domain.name:5500/
139
140    When a value is displayed, you can click on it to bring up a form
141    to assign it a new value.
142
143
144ACMS flight data recorder playback
145
146  fgfs --fdm=acms --generic=file,in,1,<path_to_replay_file>,acms
147
148

README.JSBsim

1JSBSim
2
3JSBSim is an ongoing attempt at producing an OO Flight Dynamics Model
4(FDM) to replace LaRCsim as the default FDM for FlightGear. It can
5also be used standalone.
6
7JSBSim uses config files to represent aircraft, engines, propellers,
8etc. Also, the flight control system is described in the config
9file. Normally, for use with FlightGear, the config files are named
10this way [case is significant]:
11
12<FG_ROOT>/Aircraft/<aircraft name>/<aircraft name>.xml
13
14Engines are named like this:
15
16<FG_ROOT>/Engines/<engine name>.xml
17
18Aircraft and engine config files are present in the FGFS Base package
19which must be downloaded. See the FlightGear web site for more
20information.
21
22How to run FGFS using JSBSim
23
24All the various FDMs are currently compiled into FGFS. You can specify
25which FDM you want at run time. You can also specify which aircraft
26you want. Currently, for JSBSim only the X-15 and C-172 aircraft are
27available. Here is an example command line used to start up FlightGear
28using JSBSim as the FDM:
29
30fgfs --fdm=jsb --aircraft=X15 --units-feet --altitude=60000 --uBody=2000 --wBody=120
31
32or,
33
34fgfs --fdm=jsb --aircraft=c172
35
36[Note: uBody is the forward velocity of the aircraft, wBody is the
37downward velocity - from the aircraft point of view. This essentially
38means that the aircraft is going forward fast and has an angle of
39attack of about 4 degrees or so]
40
41The first command line sets up the initial velocity and altitude to
42allow the X15 to glide down. Note that if you fire up the engine, it
43will burn for only about two minutes and then run out of fuel - but
44you will go very, very fast! The second command line example will
45start up the C172 on the end of the runway.
46
47Check out the JSBSim home page at http://jsbsim.sf.net. Please report
48any bugs to jsb@hal-pc.org, or apeden@earthlink.net, or post on the
49jsbsim web site using the SourceForge bug tracking system for the
50project.
51
52JSBSim is written by Jon S. Berndt and Tony Peden with contributions
53by other FlightGear programmers, as well.
54

README.Joystick

1Replaced by Docs/README.Joystick.html in the base package.
2

README.add-ons

1-*- coding: utf-8; fill-column: 72; -*-
2
3Add-ons in FlightGear
4=====================
5
6This document explains how add-ons work in FlightGear. The add-on
7feature was first added in FlightGear 2017.3. This document describes an
8evolution of the framework that appeared in FlightGear 2017.4.
9
10
11Contents
12--------
13
141. Terminology
15
162. The addon-metadata.xml file
17
183. Add-ons and the Property Tree
19
20   a) Add-on metadata
21   b) Subtree reserved for add-on developers
22
234. Resources under the add-on directory
24
255. Persistent storage location for add-ons
26
276. Add-on-specific menus and dialogs
28
29   a) Add-on-specific menus
30   b) Add-on-specific dialogs
31
327. How to run code after an add-on is loaded
33
348. Overview of the C++ API
35
369. Nasal API
37
3810. Add-on development; in-sim reload of Nasal code
39
40
41Introduction
42------------
43
44fgfs can be passed the --addon=<path> option, where <path> indicates an
45add-on directory. Such a directory, when used as the argument of
46--addon, receives special treatment :
47
48  1) The add-on directory is added to the list of aircraft paths.
49
50  2) The add-on directory must contain a PropertyList file called
51     addon-metadata.xml that gives the name of the add-on, its
52     identifier (id), its version and possibly a few other things (see
53     details below).
54
55  3) The add-on directory may contain a PropertyList file called
56     addon-config.xml, in which case it will be loaded into the Property
57     Tree at FlightGear startup, as if it were passed to the --config
58     fgfs option.
59
60  4) The add-on directory must contain a Nasal file called
61     addon-main.nas. This file will be loaded at startup too, and its
62     main() function run in the namespace __addon[ADDON_ID]__, where
63     ADDON_ID is the add-on identifier specified in the
64     addon-metadata.xml file. The main() function is passed one
65     argument: the addons.Addon object (a Nasal ghost, see below)
66     corresponding to the add-on being loaded. This operation is done by
67     $FG_ROOT/Nasal/addons.nas at the time of this writing.
68
69Also, the Property Tree is populated (under /addons) with information
70about registered add-ons. More details will be given below.
71
72The --addon option can be specified zero or more times; each of the
73operations indicated above is carried out for every specified add-on in
74the order given by the --addon options used: that's what we call add-on
75registration order, or add-on load order. In other words, add-ons are
76registered and loaded in the order specified by the --addon options
77used.
78
79
801. Terminology
81   ~~~~~~~~~~~
82
83add-on base path
84
85  Path to a directory containing all of the add-on files. This is the
86  path passed to the --addon fgfs option, when one wants to load the
87  add-on in question.
88
89add-on identifier (id)
90
91  A string such as org.flightgear.addons.ATCChatter or
92  user.joe.MyGreatAddon, used to uniquely identify an add-on. The add-on
93  identifier is declared in <path>/addon-metadata.xml, where <path> is
94  the add-on base path.
95
96add-on registration
97
98  When a --addon option is processed, FlightGear ensures that the add-on
99  identifier found in the corresponding addon-metadata.xml file isn't
100  already used by an add-on from a previous --addon option on the same
101  command line, and stores the add-on metadata inside dedicated C++
102  objects. This process is called add-on registration.
103
104add-on loading
105
106  The following sequence of actions:
107
108    a) loading an add-on's addon-main.nas file in the namespace
109       __addon[ADDON_ID]__
110    b) calling its main() function
111
112  is performed later (see $FG_ROOT/Nasal/addons.nas) and called add-on
113  loading.
114
115
1162. The addon-metadata.xml file
117   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
118
119Every add-on must have in its base directory a file called
120'addon-metadata.xml'. This section explains how to write this file.
121
122Sample addon-metadata.xml file
123==============================
124
125Here is an example of an addon-metadata.xml file, for a hypothetical
126add-on called “Flying Turtle” distributed by Joe User:
127
128  <?xml version="1.0" encoding="UTF-8"?>
129
130  <PropertyList>
131    <meta>
132      <file-type type="string">FlightGear add-on metadata</file-type>
133      <format-version type="int">1</format-version>
134    </meta>
135
136    <addon>
137      <identifier type="string">user.joe.FlyingTurtle</identifier>
138      <name type="string">Flying Turtle</name>
139      <version type="string">1.0.0rc2</version>
140
141      <authors>
142        <author>
143          <name type="string">Joe User</name>
144          <email type="string">optional_address@example.com</email>
145          <url type="string">http://joe.example.com/foobar/</url>
146        </author>
147
148        <author>
149          <name type="string">Jane Maintainer</name>
150          <email type="string">jane@example.com</email>
151          <url type="string">https://jane.example.com/</url>
152        </author>
153      </authors>
154
155      <maintainers>
156        <maintainer>
157          <name type="string">Jane Maintainer</name>
158          <email type="string">jane@example.com</email>
159          <url type="string">https://jane.example.com/</url>
160        </maintainer>
161      </maintainers>
162
163      <short-description type="string">
164        Allow flying with new foobar powers.
165      </short-description>
166
167      <long-description type="string">
168        This add-on enables something really great involving turtles...
169      </long-description>
170
171      <localized>
172        <fr>
173          <short-description type="string">
174            Permet de voler avec de nouveaux pouvoirs foobar.
175          </short-description>
176          <name>
177          Tortue volante
178          </name>
179        </fr>
180        <de>
181        <short-description type="string">
182         Erlaube das Fliegen mit neuen Foobar-Kräften.
183          </short-description>
184        </de>
185      </localized>
186
187      <license>
188        <designation type="string">
189          GNU GPL version 2 or later
190        </designation>
191
192        <file type="string">
193          COPYING
194        </file>
195
196        <url type="string">
197          https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
198        </url>
199      </license>
200
201      <min-FG-version type="string">2017.4.0</min-FG-version>
202      <max-FG-version type="string">none</max-FG-version>
203
204      <urls>
205        <home-page type="string">
206          https://example.com/quux
207        </home-page>
208
209        <download type="string">
210          https://example.com/quux/download
211        </download>
212
213        <support type="string">
214          https://example.com/quux/support
215        </support>
216
217        <code-repository type="string">
218          https://example.com/quux/code-repository
219        </code-repository>
220      </urls>
221
222      <tags>
223        <tag type="string">first tag</tag>
224        <tag type="string">second tag</tag>
225        <tag type="string">etc.</tag>
226      </tags>
227    </addon>
228  </PropertyList>
229
230General rules
231=============
232
233We use the terms “field” or “node” interchangeably here to refer to
234nodes of the addon-metadata.xml PropertyList file (technically, a field
235always has a value, possibly empty, therefore fields are all leaf
236nodes).
237
238Leading and trailing whitespace in each field of addon-metadata.xml is
239removed. All other whitespace is a priori preserved (this could depend
240on the particular field, though).
241
242Most fields are optional. In most cases, omitting a field is the same as
243leaving it empty. But don't write empty tag fields, it is really too
244ugly. ;-)
245
246Name and id
247===========
248
249Nodes: /addon/name and /addon/identifier
250
251The add-on name is the pretty form. It should not be overly long, but
252otherwise isn't constrained. On the other hand, the add-on identifier
253(id), which serves to uniquely identify an add-on:
254  - must contain only ASCII letters (A-Z, a-z) and dots ('.');
255  - must be in reverse DNS style (even if the domain doesn't exist),
256    e.g., org.flightgear.addons.ATCChatter for an add-on distributed in
257    FGAddon, or user.joe.FlyingTurtle for Joe User's “Flying Turtle”
258    add-on. Of course, if Joe User owns a domain name and uses it to
259    distribute his add-on, he should put it here.
260
261Authors and maintainers
262=======================
263
264Nodes: /addon/authors and /addon/maintainers
265
266Authors are people who contributed significantly to the add-on.
267Maintainers are people currently in charge of maintaining it.
268
269It is possible to declare any number of authors and any number of
270maintainers---the example above shows only one maintainer for shortness,
271but this is not a restriction.
272
273For each author and maintainer, you can give a name, an email address
274and a URL. The name must be non-empty, but the email address and URL
275need not be specified or may be left empty, which is equivalent.
276Obviously, if no email address nor URL is given for any maintainer, it
277is highly desirable that /addon/urls/support contains a usable URL for
278contacting the add-on maintainers.
279
280The data in children nodes of /addon/maintainers may refer either to
281real persons or to more abstract entities such as mailing-lists. In case
282of a real person, the corresponding URL, if specified, is expected to be
283the person's home page. On the other hand, if a declared “maintainer” is
284a mailing-list, a good use for the 'url' field is to indicate the
285address of a web page from which people can subscribe to the
286mailing-list.
287
288Short and long descriptions
289===========================
290
291Nodes: /addon/short-description and /addon/long-description
292
293The short description should fit on one line (try not to exceed, say, 78
294characters), and in general consist of only one sentence.
295
296The long description is essentially free-form, but only break lines when
297you do want a line break at this point. In other words, don't wrap lines
298manually in the XML file: this will be automatically done by the
299software displaying the add-on description, according to the particular
300line width it uses (which can depend on the user's screen or
301configuration, etc.). A single \n inside a paragraph (see footnote [1])
302means a hard line break. Two \n in a row (i.e., a blank line) should be
303used to separate paragraphs. Example:
304
305This is a paragraph.
306This is the second line of the same paragraph. It can be very, very, very long and contain several sentences.
307
308This is a different paragraph. Again, don't break lines (i.e., don't press Enter) unless a particular formatting reason makes it necessary. For instance, it is okay to break lines in order to present a list of items, but not for line wrapping.
309
310Licensing terms
311===============
312
313Nodes: /addon/license/designation
314       /addon/license/file
315       /addon/license/url
316
317The /add-on/license/designation node should describe the add-on
318licensing terms in a short but accurate way, if possible. If this is not
319practically doable, use the value “Custom”. If the add-on is distributed
320under several licenses, use the value “Multiple”. In all cases, make
321sure the licensing terms are clearly specified in other files of the
322add-on (typically, at least README.txt or COPYING). Values for
323/add-on/license/designation could be “GNU GPL version 2 or later”, “CC0
3241.0 Universal”, “3-clause BSD”, etc.
325
326In most cases, the add-on should contain a file containing the full
327license text. Use the /add-on/license/file node to point to this file:
328it should contain a file path that is relative to the add-on base
329directory. This path must use slash separators ('/'), even if you use
330Windows.
331
332The /add-on/license/url node should contain a single URL if there is an
333official, stable URL for the license under which the add-on is
334distributed. The term “official” here is to be interpreted in the
335context of the particular license. For instance, for a GNU license
336(GPL2, LGPL2.1, etc.), the URL domain must be gnu.org; for a CC license
337(CC0 1.0 Universal, CC-BY-SA 4.0...), it must be creativecommons.org,
338etc.
339
340Minimum and maximum FlightGear versions
341=======================================
342
343Nodes: /addon/min-FG-version and /addon/max-FG-version
344
345These two nodes are optional and may be omitted unless the add-on is
346known not to work with particular FlightGear versions.
347/addon/min-FG-version defaults to 2017.4.0 and /addon/max-FG-version to
348the special value 'none' (only allowed for /addon/max-FG-version). Apart
349from this special case, every non-empty value present in one of these
350two fields must be a proper FlightGear version number usable with
351simgear::strutils::compare_versions(), for instance '2017.4.1'.
352
353Add-on version
354==============
355
356Node: /addon/version
357
358The /addon/version node gives the version of the add-on and must obey a
359strict syntax[2], which is a subset of what is described in PEP 440:
360
361  https://www.python.org/dev/peps/pep-0440/
362
363Valid examples are, in increasing sort order:
364
365  1.2.5.dev1      # first development release of 1.2.5
366  1.2.5.dev4      # fourth development release of 1.2.5
367  1.2.5
368  1.2.9
369  1.2.10a1.dev2   # second dev release of the first alpha release of 1.2.10
370  1.2.10a1        # first alpha release of 1.2.10
371  1.2.10b5        # fifth beta release of 1.2.10
372  1.2.10rc12      # twelfth release candidate for 1.2.10
373  1.2.10
374  1.3.0
375  2017.4.12a2
376  2017.4.12b1
377  2017.4.12rc1
378  2017.4.12
379
380.devN suffixes can of course be used on beta and release candidates too,
381just as with the 1.2.10a1.dev2 example given above for an alpha release.
382Note that a development release always sorts before the corresponding
383non-development release (e.g., 2017.2.1b5.dev4 comes before 2017.2.1b5).
384
385Translations
386============
387
388Certain nodes can be translated based on the active languages within FlightGear.
389Especially, the name and descriptions can be translated, by adding them to
390a language node beneath 'localized', as show in the example above. Where there is
391no translation for a particular value, the default one is used.
392
393Other fields
394============
395
396The other nodes of 'addon-metadata.xml' should be self-explanatory. :-)
397
398
3993. Add-ons and the Property Tree
400   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401
402a) Add-on metadata
403   ^^^^^^^^^^^^^^^
404
405The most important metadata for each registered add-on is made
406accessible in the Property Tree under /addons/by-id/ADDON_ID and the
407property /addons/by-id/ADDON_ID/loaded can be checked or listened to, in
408order to determine when a particular add-on is loaded. There is also a
409Nasal interface to access add-on metadata in a convenient way (see
410below).
411
412More precisely, when an add-on is registered, its name, id, base path,
413version (converted to a string), loaded status (boolean) and load
414sequence number (int) become available in the Property Tree as
415/addons/by-id/ADDON_ID/{name,id,path,version,loaded,load-seq-num}. The
416loaded status is initially false, and set to true when the add-on
417loading phase is complete.
418
419There are also /addons/addon[i]/path nodes where i is 0 for the first
420registered add-on, 1 for the second one, etc.
421
422
423b) Subtree reserved for add-on developers
424   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
425
426For each add-on, the subtree of the global Property Tree starting at
427/addons/by-id/ADDON_ID/addon-devel is reserved for the specific needs of
428the add-on, where ADDON_ID stands for the add-on identifier. For
429instance, developers of the add-on whose identifier is
430user.joe.FlyingTurtle can store whatever they want under
431/addons/by-id/user.joe.FlyingTurtle/addon-devel with the assurance that
432doing this won't clash with properties used by the add-on framework.
433
434Example:
435
436  /addons/by-id/user.joe.FlyingTurtle/addon-devel/some/property and
437  /addons/by-id/user.joe.FlyingTurtle/addon-devel/other/property
438
439  could be two properties used for the specific needs of the
440  add-on whose identifier is user.joe.FlyingTurtle.
441
442Add-on developers should *not* use other places in the /addons subtree
443of the Property Tree for their custom properties.
444
445
4464. Resources under the add-on directory
447   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
448
449Many functions in FlightGear use files that are located using the
450SimGear ResourceManager class. This class allows one to point to files
451by relative path in aircraft source files and other places. The resource
452manager queries a set of providers, some of which look inside aircraft
453paths (starting with the current aircraft), others inside scenery paths,
454others under $FG_ROOT, etc. The first file that matches the specified
455resource path is used.
456
457One of these providers only handles resource paths with a very specific
458syntax, which is:
459
460  [addon=ADDON_ID]path/relative/to/the/addon/directory
461
462  (for instance, [addon=user.joe.FlyingTurtle]images/eject-button.png)
463
464When you use such a syntax in a place that is expected to contain a
465resource path, it will only find the specified file under the directory
466of the add-on whose identifier is ADDON_ID. This allows one to
467specifically target a particular file inside a particular add-on,
468instead of crossing fingers and hoping that the specified resource won't
469be found by coincidence in another place such as an aircraft directory,
470a scenery directory or inside $FG_ROOT (such mistakes can easily happen
471when unrelated places use files with rather generic names, such as
472button.png, system.xml, etc.).
473
474The [addon=ADDON_ID]relative/path syntax is useful where resources are
475specified inside non-Nasal files (e.g., in property-rule configuration
476files, which use the XML format). For the particular case of Nasal code,
477there is a better way that is explained below (see “Nasal API”): the
478resourcePath() method of addons.Addon objects returns a string like
479"[addon=ADDON_ID]relative/path" when you pass it the string
480"relative/path". This is a good thing to use, because then your Nasal
481code doesn't need to know about the particular syntax for
482add-on-specific resources and, more interestingly, doesn't have to
483hardcode the add-on identifier every time you need to access a resource
484inside the add-on directory.
485
4864.1 Resources extending $FG_ROOT
487    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
488
489Add-ons can options supply a special sub-directory which is searched when
490FlightGear looks for files normally residing in $FG_ROOT. For example input
491configurations, network protocols and other non-aircraft resources. Since
492these files cannot use the scheme above, a different approach is used. If
493an add-on defines a subdirectory called 'FGData', this is becomes an
494additional data directory to be searched for any such standard files. For
495security reasons, add-on FGData extensions are searched after the main
496$FG_ROOT location, so that an addon cannot maliciously replace a core resource.
497
498Only some files currently support being added via this mechanism, so if you
499find a non-working case which would be useful, please request it via the
500developer mailing list.
501
502
5035. Persistent storage location for add-ons
504   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
505
506If an add-on needs to store data that persists across FlightGear
507sessions, it can use a specific directory tree whose path is obtained
508with addon.storagePath, where 'addon' is an addons.Addon instance. This
509corresponds to $FG_HOME/Export/Addons/ADDON_ID, however it is simpler
510and better to use addon.storagePath instead of hardcoding and manually
511assembling this path in each add-on. Since the directory is likely not
512to exist until the add-on creates it, the recommended usage pattern is
513the following:
514
515  1) Create the add-on-specific storage directory if it doesn't already
516     exist, and optionally get its path at the same time:
517
518       storageDir = addon.createStorageDir();
519
520     Typically, you'll run this in the add-on main() function (at least,
521     early enough) if your add-on uses the storage directory. Note that
522     there is no need to check yourself whether the directory already
523     exists: addon.createStorageDir() does that for you.
524
525  2) At any time, you can get a path to the add-on-specific storage
526     directory with:
527
528       storageDir = addon.storagePath
529
530     Accessing addon.storagePath doesn't check for the existence nor the
531     type of $FG_HOME/Export/Addons/ADDON_ID, thus it is a bit faster
532     than addon.createStorageDir(). Use addon.storagePath whenever you
533     know that the directory has already been created.
534
535The features described in this section were added in FlightGear 2018.2.
536
537
5386. Add-on-specific menus and dialogs
539   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
540
541a) Add-on-specific menus
542   ^^^^^^^^^^^^^^^^^^^^^
543
544Add-ons can easily provide their own menus. If an add-on is loaded that
545has a file named 'addon-menubar-items.xml' in its base directory, the
546menus described in this file are added to the FlightGear menu bar. The
547file should look like this:
548
549<?xml version="1.0" encoding="UTF-8"?>
550
551<PropertyList>
552  <meta>
553    <file-type type="string">FlightGear add-on menu bar items</file-type>
554    <format-version type="int">1</format-version>
555  </meta>
556
557  <menubar-items>
558    <menu>
559      ...
560    </menu>
561
562    ...
563
564    <menu>
565      ...
566    </menu>
567  </menubar-items>
568</PropertyList>
569
570In this file, each <menu> element must be a valid menu description for
571the FlightGear menu system (the FlightGear standard menubar in
572$FG_ROOT/gui/menubar.xml provides good examples). Here is an example
573that adds one menu with an entry for running some Nasal code and another
574entry for opening a custom dialog (see below for add-on-specific dialogs):
575
576    <menu>
577      <label>My Menu</label>
578      <enabled type="bool">true</enabled>
579
580      <item>
581        <label>Run Foobar Nasal</label>
582        <binding>
583          <command>nasal</command>
584          <script>foobar.doBaz();</script>
585        </binding>
586      </item>
587
588      <item>
589        <label>My Foobar Dialog</label>
590        <binding>
591          <command>dialog-show</command>
592          <dialog-name>my-foobar-dialog</dialog-name>
593        </binding>
594      </item>
595    </menu>
596
597This feature was added in FlightGear 2018.2.
598
599  For older versions, one can add menus via addon-config.xml, but it's a
600  bit hackish because of the menu index problem.
601
602
603b) Add-on-specific dialogs
604   ^^^^^^^^^^^^^^^^^^^^^^^
605
606As is the case for aircraft, add-ons can provide their own dialogs by
607shipping the corresponding XML files in the subfolder gui/dialogs of the
608add-on base directory. In other words, with a file like
609
610  <addon-base-path>/gui/dialogs/my-foobar-dialog.xml
611
612starting with:
613
614  <?xml version="1.0" encoding="UTF-8"?>
615  <PropertyList>
616    <name>my-foobar-dialog</name>
617
618  ...
619
620the following <item> element inside 'addon-menubar-items.xml' (see
621above) describes a valid menu entry for showing the custom dialog.
622
623      <item>
624        <label>My Foobar Dialog</label>
625        <binding>
626          <command>dialog-show</command>
627          <dialog-name>my-foobar-dialog</dialog-name>
628        </binding>
629      </item>
630
631See $FG_ROOT/gui/dialogs to get inspiration from FlightGear's standard
632dialogs.
633
634This feature was added in FlightGear 2018.2.
635
636
6377. How to run code after an add-on is loaded
638   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
639
640You may want to set up Nasal code to be run after an add-on is loaded;
641here is how to do that:
642
643  var addonId = "user.joe.FlyingTurtle";
644  var loadedFlagNode = props.globals.getNode("/addons")
645                                    .getChild("by-id", 0, 1)
646                                    .getChild(addonId, 0, 1)
647                                    .getChild("loaded", 0, 1);
648
649  if (loadedFlagNode.getBoolValue()) {
650    logprint(5, addonId ~ " is already loaded");
651  } else {
652    # Define a function to be called after the add-on is loaded
653    var id = setlistener(
654      loadedFlagNode,
655      func(changedNode, listenedNode) {
656        if (listenedNode.getBoolValue()) {
657          removelistener(id);
658          logprint(5, addonId ~ " is loaded");
659        };
660      },
661      0, 0);
662  }
663
664
6658. Overview of the C++ API
666   ~~~~~~~~~~~~~~~~~~~~~~~
667
668The add-on C++ infrastructure mainly relies on the following classes:
669AddonManager, Addon and AddonVersion. AddonManager is used to register
670add-ons, which later leads to their loading. AddonManager relies on an
671std::map<std::string, AddonRef>, where keys are add-on identifiers and
672AddonRef is SGSharedPtr<Addon> at the time of this writing (changing it
673to another kind of smart pointer should be a mere one-line change). This
674map holds the metadata of each registered add-on. Accessor methods are
675available for:
676
677  - retrieving the lists of registered and loaded add-ons;
678
679  - checking if a particular add-on has already been registered or
680    loaded;
681
682  - for each add-on, obtaining an Addon instance which can be queried
683    for its identifier, its name, identifier, version, base path, the
684    minimum and maximum FlightGear versions it requires, its base node
685    in the Property Tree, its order in the load sequence...
686
687The AddonVersion class handles everything about add-on version numbers:
688  - initialization from the individual components or from a string;
689  - conversion to a string and output to an std::ostream;
690  - access to every component;
691  - comparisons using the standard operators: ==, !=, <, <=, >, >=.
692
693Registering an add-on using AddonManager::registerAddon() ensures
694uniqueness of the add-on identifier and makes its name, identifier, base
695path, version (converted to a string), loaded status (boolean) and load
696sequence number (int) available in the Property Tree as
697/addons/by-id/ADDON_ID/{name,id,path,version,loaded,load-seq-num}.
698
699Note: if C++ code needs to use the add-on base path, better use
700      AddonManager::addonBasePath() or Addon::getBasePath(), whose
701      return values can't be tampered with by Nasal code.
702
703AddonManager::registerAddon() fails with a specific exception if the
704running FlightGear instance doesn't match the min-FG-version and
705max-FG-version requirements declared in the addon-metadata.xml file, as
706well as in the obvious other cases (required files such as
707addon-metadata.xml not found, invalid syntax in such files, etc.). The
708code in options.cxx (fgOptAddon()) catches such exceptions and displays
709the appropriate error message with SG_LOG() and
710fatalMessageBoxThenExit().
711
712
7139. Nasal API
714   ~~~~~~~~~
715
716The Nasal add-on API all lives in the 'addons' namespace. It gives Nasal
717code easy access to add-on metadata, for instance like this:
718
719  var myAddon = addons.getAddon("user.joe.FlyingTurtle");
720  print(myAddon.id);
721  print(myAddon.name);
722  print(myAddon.version.str());
723
724  foreach (var author; myAddon.authors) {
725    print(author.name, " ", author.email, " ", author.url);
726  }
727
728  foreach (var maintainer; myAddon.maintainers) {
729    print(maintainer.name, " ", maintainer.email, " ", maintainer.url);
730  }
731
732  print(myAddon.shortDescription);
733  print(myAddon.longDescription);
734  print(myAddon.licenseDesignation);
735  print(myAddon.licenseFile);
736  print(myAddon.licenseUrl);
737  print(myAddon.basePath);
738  print(myAddon.minFGVersionRequired);
739  print(myAddon.maxFGVersionRequired);
740  print(myAddon.homePage);
741  print(myAddon.downloadUrl);
742  print(myAddon.supportUrl);
743  print(myAddon.codeRepositoryUrl);
744
745  foreach (var tag; myAddon.tags) {
746    print(tag);
747  }
748
749  print(myAddon.loadSequenceNumber);
750  # myAddon.node is a props.Node object for /addons/by-id/ADDON_ID
751  print(myAddon.node.getPath());
752
753Among other things, the Nasal add-on API allows one to get the version
754of any registered add-on as a ghost and reliably compare it to another
755instance of addons.AddonVersion:
756
757  var myAddon = addons.getAddon("user.joe.FlyingTurtle");
758  var firstVersionOK = addons.AddonVersion.new("2.12.5rc1");
759  # Or alternatively:
760  #   var firstVersionOK = addons.AddonVersion.new(2, 12, 5, "rc1");
761
762  if (myAddon.version.lowerThan(firstVersionOK)) {
763    ...
764
765Here follows the complete Nasal add-on API, at the time of this writing.
766All strings are encoded in UTF-8.
767
768Queries to the AddonManager:
769
770  addons.isAddonRegistered(string addonId) -> bool (1 or 0)
771  addons.registeredAddons()                -> vector<addons.Addon>
772                                              (in registration/load order)
773  addons.isAddonLoaded(string addonId)     -> bool (1 or 0)
774  addons.loadedAddons()                    -> vector<addons.Addon>
775                                              (in lexicographic order)
776  addons.getAddon(string addonId)          -> addons.Addon instance (ghost)
777
778Read-only data members (attributes) of addons.Addon objects:
779
780  id                    the add-on identifier, in reverse DNS style (string)
781  name                  the add-on “pretty name” (string)
782  version               the add-on version (instance of addons.AddonVersion,
783                        ghost)
784  authors               the add-on authors (vector of addons.Author ghosts)
785  maintainers           the add-on maintainers (vector of addons.Maintainer
786                        ghosts)
787  shortDescription      the add-on short description (string)
788  longDescription       the add-on long description (string)
789  licenseDesignation    licensing terms: "GNU GPL version 2 or later",
790                        "CC0 1.0 Universal", etc. (string)
791  licenseFile           relative, slash-separated path to a file under
792                        the add-on base directory containing the license
793                        text (string)
794  licenseUrl            stable, official URL for the add-on license text
795                        (string)
796  basePath              path to the add-on base directory (string)
797  storagePath           path to the add-on storage directory (string)
798                        This is $FG_HOME/Export/Addons/ADDON_ID.
799                        [added in FlightGear 2018.2]
800  minFGVersionRequired  minimum required FG version for the add-on (string)
801  maxFGVersionRequired  max. required FG version... or "none" (string)
802  homePage              add-on home page (string)
803  downloadUrl           add-on download URL (string)
804  supportUrl            add-on support URL (string)
805  codeRepositoryUrl     URL pointing to the development repository of
806                        the add-on (Git, Subversion, etc.; string)
807  tags                  vector containing the add-on tags used to help
808                        users find add-ons (vector of strings)
809  node                  base node for the add-on in the Property Tree:
810                        /addons/by-id/ADDON_ID (props.Node object)
811  loadSequenceNumber    0 for the first registered add-on, 1 for the
812                        second one, etc. (integer)
813
814Member functions (methods) of addons.Addon objects:
815
816  createStorageDir() -> string
817                        Create the add-on storage directory if it
818                        doesn't already exist (that is,
819                        $FG_HOME/Export/Addons/ADDON_ID). Return its
820                        path as a string.
821                        [added in FlightGear 2018.2]
822  resourcePath(string relPath) -> string
823                        Return a resource path suitable for use with the
824                        simgear::ResourceManager. 'relPath' must be
825                        relative to the add-on base directory, and
826                        mustn't start with a '/'. You can use this
827                        method for instance to specify an image file for
828                        display in a Canvas widget.
829
830                        In you want a full path to the resource file
831                        (e.g., for troubleshooting), call resolvepath()
832                        with the return value of addons.Addon.resourcePath().
833
834Read-only data members (attributes) of addons.AddonVersion objects:
835
836  majorNumber           non-negative integer
837  minorNumber           non-negative integer
838  patchLevel            non-negative integer
839  suffix                string such as "", "a1", "b2.dev45", "rc12"...
840
841Member functions (methods) of addons.AddonVersion objects:
842
843  new(string version)                           | construct from string
844
845  new(int major, int minor=0, int patchLevel=0, | construct
846      string suffix="")                         | from components
847
848  str()                                         | string representation
849
850  equal(addons.AddonVersion other)              |
851  nonEqual(addons.AddonVersion other)           | compare to another
852  lowerThan(addons.AddonVersion other)          | addons.AddonVersion
853  lowerThanOrEqual(addons.AddonVersion other)   | instance
854  greaterThan(addons.AddonVersion other)        |
855  greaterThanOrEqual(addons.AddonVersion other) |
856
857Read-only data members (attributes) of addons.Author objects:
858
859  name                  author name (non-empty string)
860  email                 email address of the author (string)
861  url                   home page of the author (string)
862
863Read-only data members (attributes) of addons.Maintainer objects:
864
865  name                  maintainer name (non-empty string)
866  email                 email address of the maintainer (string)
867  url                   home page of the maintainer, if a person; if the
868                        maintainer is a mailing-list, the URL can point
869                        to a web page from which people can subscribe to
870                        that mailing-list (string)
871
872
87310. Add-on development; in-sim reload of Nasal code
874---------------------------------------------------
875
876!!! WARNING:
877!!! The reload feature is meant for developers only, it should not be made
878!!! visible to end users. Unexpected side effects may occur due to reload,
879!!! if not implemented correctly.
880!!! We really don't want users to send bug reports due to reload going wrong.
881
882To make development of add-ons less time consuming, you can reload the
883Nasal part of your add-on without having to restart FlightGear. When an
884add-on is loaded, setlistener() and maketimer() wrappers are installed
885in the add-on's own namespace; these wrappers shadow and call themselves
886the standard setlistener() and maketimer() functions. The setlistener()
887and maketimer() wrapper functions keep track of every listener and timer
888they create. When the add-on is removed (e.g., as part of its reload
889sequence), removelistener() is called for each of these listeners, and
890each timer has its stop() method called.
891_
892For the time being, you have to track any other resources outside the
893namespace of your add-on by yourself and clean them up in the unload()
894function, e.g. delete canvas or close any files you opened.
895
896You can define this unload() function in the addon-main.nas file. When
897your add-on is reloaded, its unload() function, if defined, will be
898called with one argument: the addons.Addon object (a Nasal ghost)
899corresponding to your add-on. unload() is run in the add-on's own
900namespace.
901
902In FlightGear Versions before 2020.1 the reload is triggered by setting the
903property /addon/by-id/ADDON_ID/reload to true (replace ADDON_ID with your
904particular add-on identifier).
905
906!!! Since version 2020.1 reload should be done like this:
907!!! fgcommand("addon-reload", props.Node.new({'id': 'ADDON_ID'}));
908
909You can add a menu item to trigger the reload easily, but it should be removed
910before publishing your add-on to endusers (see the above warning).
911
912Please have a look at the skeleton add-on at
913https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Addons/Skeleton/
914
915
916Footnotes
917---------
918
919[1] \n represents end-of-line in string literals of languages such as C,
920    C++, Python and many others. We use this convention here to
921    represent the end-of-line character sequence in the XML data.
922
923[2] MAJOR.MINOR.PATCHLEVEL[{a|b|rc}N1][.devN2] where MAJOR, MINOR and
924    PATCHLEVEL are non-negative integers, and N1 and N2 are positive
925    integers.
926

README.airspeed-indicator

1The airspeed indicator can be initialized in an instrumentation.xml file.
2If not specified, the generic indicator will be loaded
3from the Aircraft/Generic/generic-instrumentation.xml.
4
5The normal setup is :
6
7  <airspeed-indicator>
8    <name>airspeed-indicator</name>
9    <number>0</number>
10    <total-pressure>/systems/pitot/total-pressure-inhg</total-pressure>
11    <static-pressure>/systems/static/pressure-inhg</static-pressure>
12    <has-overspeed-indicator>1</has-overspeed-indicator>
13  </airspeed-indicator>
14
15Of course the total and static pressure may be sourced from any other
16pitot and static system when defined:
17
18  <airspeed-indicator>
19    <name>airspeed-indicator</name>
20    <number>1</number>
21    <total-pressure>/systems/pitot[1]/total-pressure-inhg</total-pressure>
22    <static-pressure>/systems/static[1]/pressure-inhg</static-pressure>
23    <has-overspeed-indicator>0</has-overspeed-indicator>
24  </airspeed-indicator>
25
26Note that the Aircraft/Generic/generic-systems.xml only initiates one
27pitot and one static system, see also README.systems
28
29<total-pressure> is optional --- defaults to "/systems/pitot/total-pressure-inhg"
30For supersonic aircraft with an airspeed indicator NOT compensating for
31a shockwave in front of the pitot tube (most probably the case), use:
32<total-pressure>/systems/pitot/measured-total-pressure-inhg</total-pressure>
33
34<static-pressure> is optional --- defaults to "/systems/static/pressure-inhg"
35<has-overspeed-indicator> is optional --- defaults to 0 / off
36
37The <has-overspeed-indicator> provides a property for "barber-pole" animation,
38 and is set to 0 / false by default ,
39
40If enabled , these properties should be added in the aircraft -set file,
41with that aircraft's correct figures.
42
43    <airspeed-indicator>
44        <ias-limit>248.0</ias-limit>
45        <mach-limit>0.48</mach-limit>
46        <alt-threshold>13200.0</alt-threshold>
47    </airspeed-indicator>
48
49
50The default values are for a Beechcraft B1900D .
51
52<ias-limit> is the aircraft's VNE (never exceed speed) in KIAS
53
54<mach-limit> Mach speed limit.
55
56<alt-threshold> altitude at which these figures were calculated.
57
58Note : <mach-limit> is the mach limit at <alt-threshold>
59This was designed for indicated airspeed limits, but could probably be extended
60for mach limits.
61
62
63To initiate additional airspeed indicators, add in your instrumentation
64file (for airspeed indicator index 1):
65
66  <airspeed-indicator>
67    <name>airspeed-indicator</name>
68    <number>1</number>
69    <total-pressure>/systems/pitot[1]/total-pressure-inhg</total-pressure>
70    <static-pressure>/systems/static[1]/pressure-inhg</static-pressure>
71    <has-overspeed-indicator>0</has-overspeed-indicator>
72  </airspeed-indicator>
73
74Note: this airspeed indicator sources its pressures from the second
75pitot and static system (with index 1).
76and in the aircraft -set file:
77
78    <airspeed-indicator n="1">
79	  <serviceable type="bool" archive="y">true</serviceable>
80    </airspeed-indicator>
81
82And if "has-overspeed-indicator" = 1, the appropriate limits as explained
83above in the airspeed-indicator brackets.
84

README.autopush

1AUTOMATIC PUSHBACK FOR FLIGHTGEAR
2http://gitlab.com/mdanil/flightgear-autopush
3
4Version 2.0.1
5
6Copyright (c) 2018 Autopush authors:
7 Michael Danilov <mike.d.ft402 -eh- gmail.com>
8 Joshua Davidson http://github.com/Octal450
9 Merspieler http://gitlab.com/merspieler
10Some of the code (c) FlightGear
11Distribute under the terms of GPLv2.
12
13
14This project aims to develop a generic pushback for JSBSim and YASim
15aircraft, with the following characteristics.
16
171. Do the pushback procedure automatically.
182. Scale to different aircraft with minimum changes to their logic.
193. Use no computer resources in flight.
20
21
22INSTALLATION
23
24Minimum FlightGear version: 2018.0
25
26NOTE: these steps cover the minimal testing setup. To get the most
27realism out of Autopush, you will have to add logic aircraft-side as
28described in the last step.
29
301. Copy the autopush.config.xml.template into your aircraft directory
31and the Goldhofert.xml into <your-airfraft>/Models/Autopush/
32
332. Set up the pushback logic.
34
35Add the following line under <sim><model> of your set.xml
36
37<autopush include="autopush-config.xml"/>
38
39Rename autopush-config.xml.template to autopush-config.xml and edit
40the file as described below.
41
42Alternatively, you can copy the contents of
43autopush-config.xml.template to under <sim><model><autopush> of your
44set.xml and make these modifications there.
45
46Change the aliases to point to the following data:
47
48steer-cmd-norm   nose wheel steering command norm
49yaw              nose wheel steering output norm or angle (see below)
50chocks           chocks command bool (or leave it until step 7)
51available        pushback availability bool (or leave it until step 7)
52
53Replace the MULTIPLIER in yaw-mult with:
54
55max steering angle  if yaw is norm
561.0                 if yaw is degrees
5757.3                if yaw is radians
58
59Replace PITCH with the pushback's pitch relative to aircraft. If your
60aircraft's ground pitch varies greatly, you can make an alias to
61property with calculated relative pitch.
62
63Replace MIN_RADIUS with the minimum allowed turning radius in m of the
64center of the aircraft during pushback procedure.
65
66NOTE: on some aircraft the turning radius is different for taxi and
67pushback. Please check the aircraft's literature.
68
69Replace STOP_DIST with the stopping distance in m from pushback speed.
70
71Add under <nasal> of your set.xml:
72
73 <autopush>
74  <file>Nasal/Autopush/autopush.nas</file>
75 </autopush>
76 <autopush_driver>
77  <file>Nasal/Autopush/driver.nas</file>
78 </autopush_driver>
79 <dynarr>
80  <file>Nasal/Autopush/dynarr.nas</file>
81 </dynarr>
82 <autopush_route>
83  <file>Nasal/Autopush/route.nas</file>
84 </autopush_route>
85
86Add under <sim><aircraft-data> of your set.xml:
87
88 <path>/sim/model/autopush/route/show</path>
89 <path>/sim/model/autopush/route/show-wingtip</path>
90
913. Connect the force to FDM.
92
93 3.a. JSBSim:
94
95  3.a.1. Add the following under <external_reactions> of your JSBSim
96         XML.
97
98 <force name="tractor" frame="BODY">
99  <location unit="M">
100   <x>FRONT-X</x>
101   <y>FRONT-Y</y>
102   <z>FRONT-Z</z>
103  </location>
104  <direction>
105   <x>1.0</x>
106   <y>0.0</y>
107   <z>0.0</z>
108  </direction>
109 </force>
110
111Replace FRONT-X, FRONT-Y, FRONT-Z with coordinates of your front
112bogey.
113
114  3.a.2. Add the following under <fdm><jsbsim><external_reactions> of
115         your set.xml.
116
117   <tractor>
118    <magnitude alias="/sim/model/autopush/force-lbf"/>
119    <x alias="/sim/model/autopush/force-x"/>
120    <y alias="/sim/model/autopush/force-y"/>
121    <z alias="/sim/model/autopush/force-z"/>
122   </tractor>
123
124 3.b. YASim. Add the following under <airplane> of your YASim xml.
125
126 <thruster x="FRONT-X" y="FRONT-Y" z="FRONT-Z" vx="1" vy="0" vz="0" thrust="100000.0">
127  <control-input axis="/sim/model/autopush/force-x-yasim" control="THROTTLE" src0="-1" src1="1" dst0="-1" dst1="1"/>
128 </thruster>
129 <thruster x="FRONT-X" y="FRONT-Y" z="FRONT-Z" vx="0" vy="1" vz="0" thrust="100000.0">
130  <control-input axis="/sim/model/autopush/force-y-yasim" control="THROTTLE" src0="-1" src1="1" dst0="-1" dst1="1"/>
131 </thruster>
132 <thruster x="FRONT-X" y="FRONT-Y" z="FRONT-Z" vx="0" vy="0" vz="1" thrust="100000.0">
133  <control-input axis="/sim/model/autopush/force-z-yasim" control="THROTTLE" src0="-1" src1="1" dst0="-1" dst1="1"/>
134 </thruster>
135
136Replace FRONT-X, FRONT-Y, FRONT-Z with coordinates of your front
137bogey.
138
1394. Add the pushback model to your Model XML:
140
141 <model>
142  <name>Pushback</name>
143  <path>MODEL</path>
144  <offsets>
145   <x-m>FRONT-X</x-m>
146   <y-m>FRONT-Y</y-m>
147   <z-m>FRONT-Z</z-m>
148  </offsets>
149 </model>
150
151Replace FRONT-X, FRONT-Y, FRONT-Z with coordinates of your front
152bogey. Replace MODEL with one of the following file names:
153
154Autopush/Goldhofert.xml  for Goldhofer towbarless pushback
155
156Edit the "SETTINGS" part in the beginning of the Goldhofert.xml to match
157your setup.
158
1595. Add gui/dialogs/autopush.xml to your aircraft's menu (see
160   FlightGear documentation for editing the menu).
161
1626. If you have a bug tracker, please add a note, that autopush related
163   bugs should be reported here:
164
165https://gitlab.com/mdanil/flightgear-autopush/issues
166
1677. Launch the simulator and try Autopush. After making sure it works,
168   complete the support by implementing some logic in your aircraft
169   and connecting the rest of the interface.
170
171CAUTION.
1721. Make sure to HAVE A BACK-UP COPY of your work.
1732. If anything is not clear in the instruction below, do not guess --
174   contact the authors.
175
176 7.1. When pushback is connected ("/sim/model/autopush/connected"),
177      nose wheel steering must actuate at different speed, depending
178      on its rollspeed. The exact dependency is different per aircraft
179      and used pushback visual, and for most aircraft the only way to
180      find it is trial and error until it "looks right":
181      - the input must be taken from pushback steering command norm
182        (set by autopush-config.xml, default:
183        "/controls/flight/rudder");
184      - the output must be written to pushback orientation in degrees,
185        radians or norm (set by autopush-config.xml, default:
186        "/gear/gear[0]/steering-norm").
187
188 7.2. Set or alias (in autopush-config.xml) the availability property
189      "/sim/model/autopush/available". It must be false if e.g. the
190      aircraft is moving too fast, the front wheel is not touching
191      the ground, the aircraft is damaged or is outside of an airport
192      etc.
193
194 7.3. Make Autopush remove wheel chocks by setting the alias in
195      autopush-config.xml to the chocks property. (default:
196      "/controls/gear/wheel-chocks").
197
198 7.4. Optionally, Autopush may be made visible in multiplayer by
199      duplicating the properties used in its model.xml into some
200      unused MP properties. See the list in
201
202https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/MultiPlayer/multiplaymgr.cxx
203
204      around line 215, and then using those properties in the
205      "SETTINGS" part of Autopush model.xml.
206
207   After making these changes check the Autopush model.xml's settings
208   and make sure they match the setup. Launch the simulator and try
209   Autopush.
210
211
212TUNING
213
214There should normally be no need to change the coefficients, because
215the inertia of different aircraft is already taken into account. But
216the gear setup may differ enough to require some tuning.
217
218If these settings are changed during simulation, they take effect
219after disconnecting and reconnecting the pushback.
220
221Pushback (/sim/model/autopush):
222
223Coefficient  Unit                    Description
224
225K_p          ((km/h)/s)/(km/h)       Proportional coefficient of PID.
226                                     Defines the start/stop throttle
227                                     and immediate response to speed
228                                     difference deltaV = V_set - V.
229
230F_p          (km/h)/s                Proportional clipping.
231
232K_i          ((km/h)/s)/((km/h)*s)   Integral coefficient of PID.
233                                     Defines how fast the steady
234                                     throttle is ramped during the
235                                     push.
236
237F_i          (km/h)/s                Integral clipping.
238
239K_d          -((km/h)/s)/((km/h)/s)  Differential coefficient of PID.
240                                     Stabilizes the approaching of
241                                     steady throttle.
242
243F_d          (km/h)/s                Differential clipping.
244
245Pushback driver (/sim/model/autopush/driver):
246
247Coefficient  Unit        Description
248
249F_V          km/h        Max towing speed in auto mode.
250K_psi        1/deg       Amount of steering per heading correction.
251F_psi        1/deg       Max steering per heading correction.
252K_deltapsi   -1/(deg/s)  Amount of steering compensation per heading
253                         derivative.
254F_psi        1/(deg/s)   Max amount of steering compensation per
255                         heading derivative.
256

README.checklists

1CHECKLISTS
2
3You can create one or more checklist for an aircraft under /sim/checklists. These
4are intended to mimic the checklists of aircraft themselves, and can be found under
5the Help->Checklists menu within the simulator.
6
7Tutorials are automatically generated from checklists on startup.
8
9Each checklist is defined as a property tree under /sim/checklists/checklist[n]
10or /sim/checklists/group[n]/checklist[m]
11
12with the following tags
13
14<title>       - Name of the checklist
15<auto-tutorial> - Whether a tutorial should be automatically generated (true, default)
16                  or not (false).
17<page>        - Zero or more pages for the checklist containing:
18 <item>       - One or more checklist items containing:
19  <name>      - name of the checklist item (e.g. Carb Heat), to appear on the left
20  <value>     - One or more values for the checklist item, to appear on the right
21                hand side
22  <marker>    - A tutorial marker (displayed when the user presses the ? button)
23                This can be easily placed using the Help->Display Tutorial Marker.
24                Contains x-m, y-m, z-m and scale tag.
25  <condition> - Optional standard FlightGear condition node that evaluates when the
26                checklist item has been completed.
27  <binding>   - Zero or more bindings to execute the checklist item.  Allows the user
28                to have their virtual co-pilot perform the action if they select the
29                ">" button next to the checklist item.
30
31The <page> tag may be omitted for single-page checklists, with the <item> tags
32immediately under the <checklist[n]> node.
33
34Tutorial auto-generation of all checklists can be disabled by setting
35/sim/checklists/auto-tutorials=false.
36
37Checklists may be grouped under <group> nodes with a <name> tag decribing the
38group.  For example
39
40<group>
41 <name>Emergency</name>
42 <auto-tutorial>false</auto-tutorial>
43 <checklist>...
44 <checklist>...
45</group>
46<group>
47 <name>Normal</name>
48 <auto-tutorial>true</auto-tutorial>
49 <checklist>...
50 <checklist>...
51</group>
52
53See the c172p for an example of this in action (Aircraft/c172p/c172-checklists.xml).
54

README.commands

1FlightGear Commands Mini-HOWTO
2
3David Megginson
4Started: 2002-10-25
5Last revised: 2007-12-01
6
7
8In FlightGear, a *command* represents an action, while a *property*
9represents a state.  The trigger for a command can be any kind of user
10input, including the keyboard, mouse, joystick, GUI, instrument panel,
11or a remote network client.
12
13
14XML Command Binding Markup
15--------------------------
16
17Most of the command-binding in FlightGear is handled through static
18XML configuration files such as $FG_ROOT/keyboard.xml for the
19keyboard, $FG_ROOT/mice.xml for the mouse, and
20$FG_ROOT/gui/menubar.xml for the menubar.  In all of these files, you
21reference a command through a binding.  This binding advances the
22first throttle by 1%, up to a maximum value of 1.0:
23
24  <binding>
25   <command>property-adjust</command>
26   <property>/controls/throttle[0]</property>
27   <step type="double">0.01</step>
28   <max>1.0</max>
29  </binding>
30
31A command binding always consists of the XML 'binding' element, with
32one subelement named 'command' containing the command name (such as
33'property-adjust').  All other subelements are named parameters to the
34command: in this case, the parameters are 'property', 'step', and
35'max'.  Here is a simpler binding, with no parameters:
36
37  <binding>
38   <command>exit</command>
39  </binding>
40
41Bindings always appear inside some other kind of markup, depending on
42the input type.  For example, here is the binding from keyboard.xml
43that links the ESC key to the 'exit' command:
44
45 <key n="27">
46  <name>ESC</name>
47  <desc>Prompt and quit FlightGear.</desc>
48  <binding>
49    <command>exit</command>
50  </binding>
51 </key>
52
53Usually, more than one binding is allowed for a single input trigger,
54and bindings are executed in order from first to last. Bindings support
55conditions (see README.conditions):
56
57 <key n="113">
58  <name>q</name>
59  <desc>Test</desc>
60
61  <binding>
62   <condition>
63    <property>/devices/status/mice/mouse/button[0]</property>
64   </condition>
65   <command>nasal</command>
66   <script>print("mouse button 0 pressed")</script>
67  </binding>
68 </key>
69
70Keyboard definitions can embed bindings in tags <mod-up> (key released),
71<mod-shift>, <mod-ctrl>, <mod-alt>, <mod-meta>, <mod-super>, and <mod-hyper>.
72Nesting is supported. Meta, Super, and Hyper modifier tags are for local
73use only, and must be supported by the operating system to work.
74
75 <key n="113">
76  <name>q</name>
77  <desc>Test</desc>
78  <binding>
79   <command>nasal</command>
80   <script>print("q pressed")</script>
81  </binding>
82
83  <mod-alt>
84   <binding>
85    <command>nasal</command>
86    <script>print("Alt-q pressed")</script>
87   </binding>
88
89   <mod-super>
90    <binding>
91     <command>nasal</command>
92     <script>print("Alt-Super-q pressed")</script>
93    </binding>
94
95    <mod-meta>
96     <binding>
97      <command>nasal</command>
98      <script>print("Alt-Super-Meta-q pressed")</script>
99     </binding>
100
101    </mod-meta>
102   </mod-super>
103  </mod-alt>
104 </key>
105
106
107
108Built-in Commands
109-----------------
110
111As of the last revision date, the following commands were available
112from inside FlightGear; the most commonly-used ones are the commands
113that operate on property values (FlightGear's internal state):
114
115
116null - do nothing
117
118script - execute a PSL script
119  script: the PSL script to execute
120
121exit - prompt and quit FlightGear
122
123pause - pause/resume the simulation
124
125load - load properties from an XML file
126  file: the name of the file to load, relative to the current
127    directory (defaults to "fgfs.sav")
128
129save - save properties to an XML file
130  file: the name of the file to save, relative to the current
131    directory (defaults to "fgfs.sav").
132
133loadxml - load XML file into property tree
134  filename: the path & filename of the file to load
135  targetnode: the target node within the property tree where to store the XML
136  file's structure. If targetnode isn't defined, then the data will be stored
137  in a node "data" under the argument branch.
138
139savexml - save property tree node to XML file
140  filename: the path & filename for the file to be saved
141  sourcenode: the source node within the property tree where the XML file's
142  structure is assembled from. If sourcenode isn't defined, then savexml will
143  try to save data stored in a node "data" in the argument branch.
144
145panel-load - (re)load the 2D instrument panel
146  path: the path of the XML panel file, relative to $FG_ROOT (defaults
147    to the value of /sim/panel/path if specified, or
148    "Panels/Default/default.xml" as a last resort.
149
150panel-mouse-click - pass a mouse click to the instrument panel
151  button: the number of the mouse button (0-based)
152  is-down: true if the button is down, false if it is up
153  x-pos: the x position of the mouse click
154  y-pos: the y position of the mouse click
155
156preferences-load - (re)load preferences
157  path: the file name to load preferences from, relative to $FG_ROOT.
158    Defaults to "preferences.xml".
159
160view-cycle - cycle to the next viewpoint
161
162screen-capture - capture the screen to a file
163
164tile-cache-reload - reload the scenery tile cache
165
166lighting-update - update FlightGear's lighting
167
168property-toggle - swap a property value between true and false
169  property: the name of the property to toggle
170
171property-assign - assign a value to a property
172  property[0]: the name of the property that will get the new value.
173  value: the new value for the property; or
174  property[1]: the name of the property holding the new value.
175
176property-interpolate - assign a value to a property, interpolated
177                       over time
178  property[0]: the name of the property that will get the new value
179               and defines the starting point of the interpolation
180  value:       the new value for the property; or
181  property[1]: the name of the property holding the new value.
182  time:        the time in seconds it takes for the transition from the
183               old value to the new value of property[0]; or
184  rate:        the ammount of change per second the value of property[0] changes
185               to transition to the new value
186
187property-adjust - adjust the value of a property
188  property: the name of the property to increment or decrement
189  step: the amount of the increment or decrement (defaults to 0)
190  offset: input offset distance (used for the mouse; multiplied by
191    factor)
192  factor: factor for multiplying offset distance (used for the mouse;
193    defaults to 1)
194  min: the minimum allowed value (default: no minimum)
195  max: the maximum allowed value (default: no maximum)
196  mask: 'integer' to apply only to the left of the decimal point;
197    'decimal' to apply only to the right of the decimal point; 'all'
198    to apply to the full value (defaults to 'all')
199  wrap: true if the value should be wrapped when it passes min or max;
200    both min and max must be specified (defaults to false)
201
202property-multiply - multiply the value of a property
203  property: the name of the property to multiply
204  factor: the amount by which to multiply (defaults to 1.0)
205  min: the minimum allowed value (default: no minimum)
206  max: the maximum allowed value (default: no maximum)
207  mask: 'integer' to apply only to the left of the decimal point;
208    'decimal' to apply only to the right of the decimal point; 'all'
209    to apply to the full value (defaults to 'all')
210  wrap: true if the value should be wrapped when it passes min or max;
211    both min and max must be specified (defaults to false)
212
213property-swap - swap the values of two properties
214  property[0]: the name of the first property
215  property[1]: the name of the second property
216
217property-scale - set the value of a property based on an axis
218  property: the name of the property to set
219  setting: the current input setting (usually a joystick axis from -1
220    or 0 to 1)
221  offset: the offset to shift by, before applying the factor (defaults
222    to 0)
223  factor: the factor to multiply by (use negative to reverse; defaults
224    to 1.0)
225  squared: if true will square the resulting value (same as power=2)
226  power: the resulting value will be taken to the power of this integer
227    value (overrides squared; default=1)
228
229property-cycle - cycle a property through a set of values
230  property: the name of the property to cycle
231  value[*]: all of the allowed values
232
233dialog-new - create new dialog from the argument branch
234
235dialog-show - show an XML-configured dialog box
236  dialog-name - the name of the dialog to show
237
238dialog-close - close the active dialog box
239
240dialog-update - copy values from FlightGear to the active dialog box
241  object-name: the name of the GUI object to update (defaults to all
242    objects)
243
244dialog-apply - copy values from the active dialog box to FlightGear
245  object-name: the name of the GUI object to apply (defaults to all
246    objects)
247
248presets-commit - commit preset values from /sim/presets
249
250open-browser - open the web browser and show given file
251   path: name of the local file to be opened.
252   url: URL to be opened (http://..., ftp://...).
253
254The following commands are temporary, and will soon disappear or be
255renamed; do NOT rely on them:
256
257old-save-dialog - offer to save a flight
258
259old-load-dialog - offer to load a flight
260
261old-reinit-dialog - offer to reinit FlightGear
262
263old-hires-snapshot-dialog - save a hires screen shot
264
265old-snapshot-dialog - save a screenshot
266
267old-print-dialog - print the screen (Windows only)
268
269old-pilot-offset-dialog - set pilot offsets graphically
270
271old-hud-alpha-dialog - set the alpha value for the HUD
272
273old-properties-dialog - display the property browser
274
275old-preset-airport-dialog - set the default airport
276
277old-preset-runway-dialog - set the default runway
278
279old-preset-offset-distance-dialog - set the default offset distance
280
281old-preset-altitude-dialog - set the default altitude
282
283old-preset-glidescope-dialog - set the default glidescope
284
285old-preset-airspeed-dialog - set the default airspeed
286
287old-preset-commit-dialog - commit preset values
288
289old-ap-add-waypoint-dialog - add a waypoint to the current route
290
291old-ap-pop-waypoint-dialog - remove a waypoint from the current route
292
293old-ap-clear-dialog - clear the current route
294
295old-ap-adjust-dialog - adjust the autopilot settings
296
297old-lat-lon-format-dialog - toggle the lat/lon format in the HUD
298
299
300Adding New Commands in C++
301--------------------------
302
303
304To add a new command to FlightGear, you first need to create a
305function that takes a single SGPropertyNode const pointer as an
306argument:
307
308  void
309  do_something (SGPropertyNode * arg)
310  {
311    something();
312  }
313
314Next, you need to register it with the command manager:
315
316  globals->get_commands()->addCommand("something", do_something);
317
318Now, the command "something" is available to any mouse, joystick,
319panel, or keyboard bindings.  If the bindings pass any arguments, they
320will be children of the SGPropertyNode passed in:
321
322  void
323  do_something (const SGPropertyNode * arg)
324  {
325    something(arg->getStringValue("foo"), arg->getDoubleValue("bar"));
326  }
327
328That's pretty-much it.  Apologies in advance for not making things any
329more complicated.
330
331
332

README.conditions

1CONDITIONS IN FLIGHTGEAR PROPERTY FILES
2
3Written by David Megginson, david@megginson.com
4Last modified: $Date$
5
6This document is in the Public Domain and comes with NO WARRANTY!
7
8
91. Introduction
10---------------
11
12Some FlightGear property files contain conditions, affecting whether
13bindings or animations are applied.  For example, the following
14binding will apply only when the /sim/input/selected/engine[0]
15property is true:
16
17  <binding>
18   <condition>
19    <property>/sim/input/selected/engine[0]</property>
20   </condition>
21   <command>property-assign</command>
22   <property>/controls/starter[0]</property>
23   <value type="bool">true</value>
24  </binding>
25
26Conditions always occur within a property subtree named "condition",
27which is equivalent to an "and" condition.
28
29
302. Comparison Operators
31-----------------------
32
33The simplest condition is "property".  It resolves as true when the
34specified property has a boolean value of true (i.e. non-zero, etc.)
35and false otherwise.  Here is an example:
36
37  <condition>
38   <property>/sim/input/selected/engine[0]</property>
39  </condition>
40
41For more sophisticated tests, you can use the "less-than",
42"less-than-equals", "greater-than", "greater-than-equals", "equals",
43and "not-equals" comparison operators.  These all take two operands,
44either two "property" operands or one "property" and one "value"
45operand, and return true or false depending on the result of the
46comparison.  The value of the second operand is always forced to the
47type of the first; for example, if you compare a string and a double,
48the double will be forced to a string and lexically compared.  If one
49of the operands is a property, it is always assumed to be first.  Here
50is an example of a comparison that is true only if the RPM of the
51engine is less than 1500:
52
53  <condition>
54   <less-than>
55    <property>/engines/engine[0]/rpm</property>
56    <value>1500</value>
57   </less-than>
58  </condition>
59
60
613. Boolean Operators
62--------------------
63
64Finally, there are the regular boolean operators "and", "or", and
65"not".  Each one surrounds a group of other conditions, and these can
66be nested to arbitrary depths.  Here is an example:
67
68  <condition>
69   <and>
70    <or>
71     <less-than>
72      <property>/engines/engine[0]/rpm</property>
73      <value>1500</value>
74     </less-than>
75     <greater-than>
76      <property>/engines/engine[0]/rpm</property>
77      <value>2500</value>
78     </greater-than>
79    </or>
80    <property>/engines/engine[0]/running</property>
81   </and>
82  </condition>
83
84The top-level "condition" is an implicit "and".
85
86
874. Approximating if...else
88--------------------------
89
90There is no equivalent to the regular programming 'else' statement in
91FlightGear conditions; instead, each condition separately must take
92the others into account.  For example, the equivalent of
93
94  if (x == 3) ... else if (y == 5) ... else ...
95
96in FlightGear conditions is
97
98  <condition>
99   <equals>
100    <property>/x</property>
101    <value>3</value>
102   </equals>
103   <not>
104    <equals>
105     <property>/y</property>
106     <value>5</value>
107    </equals>
108   </not>
109  </condition>
110
111and then
112
113  <condition>
114   <equals>
115    <property>/y</property>
116    <value>5</value>
117   </equals>
118   <not>
119    <equals>
120     <property>/x</property>
121     <value>3</value>
122    </equals>
123   </not>
124  </condition>
125
126and then
127
128  <condition>
129   <not>
130    <equals>
131     <property>/x</property>
132     <value>3</value>
133    </equals>
134   </not>
135   <not>
136    <equals>
137     <property>/y</property>
138     <value>5</value>
139    </equals>
140   </not>
141  </condition>
142
143It's verbose, but it works nicely within existing property-based
144formats and provides a lot of flexiblity.
145
146
1475. Syntax Summary
148-----------------
149
150Here's a quick syntax summary:
151
152* <and>...</and>
153
154  Contains one or more subconditions, all of which must be true.
155
156* <condition>...</condition>
157
158  The top-level container for conditions, equivalent to an "and" group
159
160* <equals>...</equals>
161
162  Contains two properties or a property and value, and is true if the
163  properties have equivalent values.
164
165* <not-equals>...</not-equals>
166
167  Contains two properties or a property and value, and is true if the
168  properties have different values.
169
170* <greater-than>...</greater-than>
171
172  Contains two properties or a property and a value, and is true if
173  the second property or the value has a value greater than the first
174  property.
175
176* <greater-than-equals>...</greater-than-equals>
177
178  Contains two properties or a property and a value, and is true if
179  the second property or the value has a value greater than or equal
180  to the first property.
181
182* <less-than>...</less-than>
183
184  Contains two properties or a property and a value, and is true if
185  the second property or the value has a value less than the first
186  property.
187
188* <less-than-equals>...</less-than-equals>
189
190  Contains two properties or a property and a value, and is true if
191  the second property or the value has a value less than or equal
192  to the first property.
193
194* <not>...</not>
195
196  Contains one subcondition, which must not be true.
197
198* <not-equals>...</not-equals>
199
200  Contains two properties or a property and value, and is true if the
201  properties do not have equivalent values.
202
203* <or>...</or>
204
205  Contains one or more subconditions, at least one of which must be
206  true.
207
208* <property>...</property>
209
210  The name of a property to test.
211
212* <value>...</value>
213
214  A literal value in a comparison.
215

README.digitalfilters

1COMMON SETTINGS
2==============================================================================
3
4Currently four types of digital filter implementations are supported. They all
5serve an individual purpose or are individual implementations of a specific
6filter type. Each filter implementation uses the same set of basic configuration
7tags and individual configuration elements. These individual elements are
8described in the section of the filter.
9
10The InputValue
11==============================================================================
12Each filter has several driving values, like the input value itself, sometimes
13a reference value, a gain value and others. Most of these input values can be
14either a constant value or the value of a property. They all use the same syntax
15and will be referred to as InputValue in the remaining document.
16
17The complete XML syntax for a InputValue is
18
19<some-element>
20  <condition>
21    <!-- any condition as defined in README.conditions -->
22  </condition>
23  <property>/some/property/name</property>
24  <value>0.0</value>
25  <scale>1.0</value>
26  <offset>0.0</offset>
27  <max>infinity</max>
28  <min>-infinity<min>
29  <abs>false</abs>
30  <period>
31    <min>-180.0</min>
32    <max>-180.0</max>
33  </period>
34</some-element>
35
36The enclosing element <some-element> is the element defined in each filter, like
37<input>, <u_min>, <reference> etc. These elements will be described later.
38The value of the input is calculated based on the given value, scale and offset as
39value * scale + offset
40and the result is clipped to min/max, if given.
41With the full set of given elements, the InputValue will initialize the named
42property to the value given, reduced by the given offset and reverse scaled by
43the given scale.
44
45Example:
46<input>
47  <property>/controls/flight/rudder</property>
48  <value>0.0</value>
49  <scale>0.5</scale>
50  <offset>0.5</offset>
51</input>
52
53Will use the property /controls/flight/rudder as the input of the filter. The
54property will be initialized at a value of zero and since the property usually is
55in the range [-1..+1], the the value of <input> will be in the range
56(-1)*0.5+0.5 to (+1)*0.5+0.5 which is [0..1].
57
58The default values for elements not given are:
59<value/> : 0.0
60<scale/> : 1.0
61<offset/>: 0.0
62<property/> : none
63<min/>   : unclipped
64<max/>   : unclipped
65<abs/>   : false
66
67Some examples:
68<input>
69  <property>/position/altitude-ft</property>
70  <scale>0.3048</scale>
71</input>
72Gives the altitude in meters. No initialization of the property is performed, no
73offset applied.
74
75<reference>
76  <value>0.0</value>
77</reference>
78A constant reference of zero.
79
80A abbreviated method of defining values exist for using a just constant or a
81property. The above example may be written as
82<reference>0.0</reference>
83Or if the reference is defined in a property
84<reference>/some/property/name</reference>
85No initialization, scaling or offsetting is performed here.
86The logic behind this is: If the text node in the element (the text between the
87opening and closing tag) can be converted to a double value, it will be interpreted
88as a double value. Otherwise the text will
89be interpreted as a property name.
90Examples:
91<reference>3.1415927</reference>             - The constant of PI (roughly)
92<reference>/position/altitude-ft</reference> - The property /position/altitude-ft
93<reference>3kings</reference>                - The constant 3. The word kings is
94                                               ignored
95<reference>food4less</reference>             - The property food4less
96
97The <property> element may also be written as <prop> for backward compatibility.
98
99There may be one or more InputValues for the same input of a filter which may be
100bound to conditions. Each InputValue will have its condition checked in the order
101of InputValues given in the configuration file. The first InputValue that returns
102true for its condition will be evaluated. Chaining a number of InputValues with
103conditions and an unconditioned InputValue works like the C language equivalent
104if( condition ) {
105  // compute value of first element
106} else if( condition2 ) {
107  // compute value of second element
108} else if( condition3 ) {
109  // compute value of third element
110} else {
111  // compute value of last element
112}
113
114Example: Set the gain to 3.0 if /autopilot/locks/heading equals dg-heading-hold or
1152.0 otherwise.
116<digital-filter>
117  <gain>
118    <condition>
119      <equals>
120        <property>/autopilot/locks/heading</property>
121        <value>dg-heading-hold</value>
122      </equals>
123    </condition>
124    <value>3.0</value>
125  <gain>
126  <!-- Hint: omit a condition here as a fallthru else condition -->
127  </gain>
128    <value>2.0</value>
129  <gain>
130<digital-filter>
131
132If the element <abs> is used and set to the value "true", only the absolute
133value of the input (the positive part) is used for further computations. The
134abs function is applied after all other computations are completed.
135
136OutputValue
137==============================================================================
138Each filter drives one to many output properties. No scaling or offsetting is
139implemented for the output value, these should be done in the filter itself.
140The output properties are defined in the <output/> element by adding <property/>
141elements within the <output/> element. For just a single output property, the
142<property/> element may be ommited. For backward compatibility, <property/> may
143be replaced by <prop/>.  Non-existing properties will be created with type double.
144
145Example: (Multiple output properties)
146<output>
147  <property>/some/output/property</property>
148  <property>/some/other/output/property</property>
149  <property>/and/another/output/property</property>
150</output>
151
152Example: a single output property
153<output>/just/a/single/property</output>
154
155Other Common Settings
156==============================================================================
157<name>        String      The name of the filter. Used for debug purpose.
158Example:
159<name>pressure rate filter</name>
160
161<debug>       Boolean     If true, this filter puts out debug information when
162                          updated. Example: <debug>false</debug>
163
164<input>       InputValue  The input property driving the filter.
165                          Refer to InputValue for details.
166
167<reference>   InputValue  The reference property for filter that need one.
168                          Refer to InputValue for details.
169
170<output>      Complex     Each filter can drive one to many output properties.
171                          Refer to OutputValue for details.
172
173<u_min>       InputValue  This defines the optional minimum and maximum value the
174<u_max>                   output is clamped to. If neither <u_min> nor <u_max>
175                          exists, the output is only limited by the internal limit
176                          of double precision float computation.  If either <u_min>
177                          or <u_max> is given, clamping is activated. A missing min
178                          or max value defaults to 0 (zero).
179                          Note: <u_min> and <u_max> may also occour within a <config>
180                          element. <min> and <max> may be used as a substitude for
181                          the corresponding u_xxx element.
182<period>      Complex     Define a periodical input or output value. The phase width
183                          is defined by the child elements <min> and <max> which are
184                          of type InputValue
185
186Example: Limit the pilot's body temperature to a constant minimum of 36 and a
187maximum defined in /pilots/max-body-temperature-degc, initialized to 40.0
188<u_max>
189  <prop>/pilots/max-body-temperature-degc</prop>
190  <value>40.0</
191</u_max>
192<min>
193  <value>36.0</value>
194</min
195
196Implicit definition of the minimum value of 0 (zero) and defining a maximum of 100.0
197<config>
198  <u_max>100.0</u_max>
199</config>
200
201This defines the input or output as a periodic value with a phase width of 360, like
202the compass rose.  Any value reaching the filter's input or leaving the filter at the
203output will be transformed to fit into the given range by adding or substracting one
204phase width of 360. Values of -270, 90 or 450 applied to this periodical element will
205always result in +90. A value of 630, 270 or -90 will be normalized to -90 in the
206given example.
207<period>
208  <min>-180.0</min>
209  <max>180.0</max>
210</period>
211
212
213<enable>      Complex     Define a condition to enable or disable the filter. For
214                          disabled filters, no output computations are performed.
215                          Only enabled filters fill the output properties. The
216                          default for undefined conditions is enabled.
217                          Several way exist to define a condition. The most simple
218                          case is checking a boolean property. For this, just a
219                          <prop> element naming this boolean property is needed.
220                          The boolean value of the named property defines the
221                          enabled state of the filter. To compare the value of a
222                          property with a constant, a <prop> and a <value> element
223                          define the property name and the value to be compared.
224                          The filter is enabled, if the value of the property equals
225                          the given value. A case sensitive string compare is
226                          performed here.
227                          To define more complex conditions, a <condition> element
228                          may be used to define any condition described in
229                          README.conditions.  If a <condition> element is present
230                          and if it contains a valid condition, this conditions has
231                          precedence over a given <prop>/<value> condition.
232                          The child element <honor-passive>, a boolean flag, may be
233                          present within the <enable> element. If this element is
234                          true, the property /autopilot/locks/passive-mode is checked
235                          and if it is true, the filter output is computed, but the
236                          output properties are not set.  The default for
237                          honor-passive is false
238Example: Check a boolean property, only compute this filter if gear-down is true and
239         /autopilot/locks/passive-mode is false
240<enable>
241  <prop>/gear/gear-down</prop>
242  <honor-passive>true</honor-passive>
243</enable>
244
245Check a property for equality, only compute this filter if the autopilot is locked
246in heading mode.
247<enable>
248  <prop>/autopilot/locks/heading</prop>
249  <value>dg-heading-hold</value>
250</enable>
251
252Use a complex condition, only compute this filter if the autopilot is serviceable
253and the lock is either dg-heading-hold or nav1-heading-hold
254<enable>
255  <condition>
256    <property>/autopilo/serviceable</property>
257    <or>
258      <equals>
259        <property>/autopilot/locks/heading</property>
260        <value>dg-heading-hold</value>
261      </equals>
262      <equals>
263        <property>/autopilot/locks/heading</property>
264        <value>nav1-heading-hold</value>
265      </equals>
266    </or>
267  </condition>
268</enable>
269
270INDIVIDUAL FILTER CONFIGURATION
271==============================================================================
272
273Digital Filter
274
275Six different types of digital filter can be configured inside the autopilot
276configuration file. There are four low-pass filter types and two gain filter
277types.
278
279The low-pass filter types are:
280
281* Exponential
282* Double exponential
283* Moving average
284* Noise spike filter
285
286The gain filter types are:
287
288* gain
289* reciprocal
290
291To add a digital filter, place a <filter> element under the root element. Next to
292the global configuration elements described above, the following elements configure
293the digital filter:
294<filter-time> InputValue  This tag is only applicable for the exponential and
295                          double-exponential filter types. It controls the
296                          bandwidth  of the filter. The bandwidth in Hz of the
297                          filter is: 1/filter-time. So a low-pass filter with a
298                          bandwidth of 10Hz would have a filter time of 1/10 = 0.1
299
300<samples>     InputValue  This tag only makes sense for the moving-average filter.
301                          It says how many past samples to average.
302
303<max-rate-of-change>
304              InputValue  This tag is applicable for the noise-spike filter.
305                          It says how much the value is allowed to change per
306                          second.
307
308<gain>        InputValue  This is only applicable to the gain and reciprocal filter
309                          types. The output for gain filter is computed as input*gain
310                          while  the reciprocal filter computes output as gain/input
311                          for input values != 0 (zero). Gain may be a constant, a
312                          property name defined by a <prop> element within the <gain>
313                          element or a  property name initialized to a value by using
314                          a <prop> and <value> element.
315
316Example: a pressure-rate-filter implemented as a double exponential low pass filter
317         with a bandwith of 10Hz
318
319  <filter>
320    <name>pressure-rate-filter</name>
321    <debug>false</debug>
322    <type>double-exponential</type>
323    <enable>
324      <prop>/autopilot/locks/pressure-rate-filter</prop>
325      <value>true</value>
326    </enable>
327    <input>/autopilot/internal/pressure-rate</input>
328    <output>/autopilot/internal/filtered-pressure-rate</output>
329    <filter-time>0.1</filter-time>
330  </filter>
331
332This will filter the pressure-rate property. The output will be to a new
333property called filtered-pressure-rate. You can select any numerical property
334from the property tree. The input property will not be affected by the filter,
335it will stay the same as it would if no filter was configured.
336
337Example 2:
338
339  <filter>
340    <name>airspeed elevator-trim gain reciprocal filter</name>
341    <debug>false</debug>
342    <enable>
343      <prop>/autopilot/locks/airspeed-elevator-trim-gain</prop>
344      <value>true</value>
345    </enable>
346    <type>reciprocal</type>
347    <gain>
348      <prop>/autopilot/settings/elevator-trim-airspeed-reciprocal-gain</prop>
349      <value>7</value>
350    </gain>
351    <input>/velocities/airspeed-kt</input>
352    <output>/autopilot/internal/elevator-trim-gain</output>
353    <u_min>0.005</u_min>
354    <u_max>0.02</u_max>
355  </filter>
356
357This will use the /velocities/airspeed-kt property to produce a gain factor
358that reduces as airspeed increases.  At airspeeds up to 350kt the gain will
359be clamped to 0.02, at 700kt the gain will be 0.01 and at 1400kt the gain will
360be 0.005.  The gain will be clamped to 0.005 for airspeeds > 1400kt.
361
362The output from this filter could then be used to control the gain in a PID
363controller:
364
365  <pid-controller>
366    <name>Pitch hold</name>
367    <debug>false</debug>
368    <enable>
369      <prop>/autopilot/locks/pitch</prop>
370      <value>true</value>
371    </enable>
372    <input>
373      <prop>/orientation/pitch-deg</prop>
374    </input>
375    <reference>
376      <prop>/autopilot/settings/target-pitch-deg</prop>
377    </reference>
378    <output>
379      <prop>/autopilot/internal/target-elevator-trim-norm</prop>
380    </output>
381    <config>
382      <Ts>0.05</Ts>
383      <Kp>
384        <prop>/autopilot/internal/elevator-trim-gain</prop>
385        <value>0.02</value>
386      </Kp>
387      <beta>1.0</beta>
388      <alpha>0.1</alpha>
389      <gamma>0.0</gamma>
390      <Ti>2.0</Ti>
391      <Td>0.2</Td>
392      <u_min>-1.0</u_min>
393      <u_max>1.0</u_max>
394    </config>
395  </pid-controller>
396
397IMPORTANT NOTE: The <Kp> tag in PID controllers has been revised to operate in
398the same way as the <gain> elements in filters.  However, the original format
399of <Kp> will continue to function as before i.e. <Kp>0.02</Kp> will specify a
400fixed and unalterable gain factor, but a warning message will be output.
401
402The gain type filter is similar to the reciprocal filter except that the gain
403is applied as a simple factor to the input.
404-------------------------------------------------------------------------------
405Parameters
406
407<name> The name of the filter. Give it a sensible name!
408
409<debug> If this tag is set to true debugging info will be printed on the
410console.
411
412<enable> Encloses the <prop> and <value> tags which are used to enable or
413disable the filter. Instead of the <prop> and <value> tags, a <condition>
414tag may be used to define a condition. Check README.conditions for more
415details about conditions.  Defaults to enabled if unspecified.
416
417<type> The type of filter. This can be exponential, double-exponential,
418moving-average, noise-spike, gain or reciprocal.
419
420<input> The input property to be filtered. This should of course be a
421numerical property, filtering a text string or a boolean value does not make
422sense.
423
424<output> The filtered value. You can make up any new property.
425
426<u_min> The minimum output value from the filter.  Defaults to -infinity.
427
428<u_max> The maximum output value from the filter.  Defaults to +infinity.
429
430These are the tags that are applicable to all filter types. The following tags
431are filter specific.
432
433<filter-time> This tag is only applicable for the exponential and
434double-exponential filter types. It controls the bandwidth of the filter. The
435bandwidth in Hz of the filter is: 1/filter-time. So a low-pass filter with a
436bandwidth of 10Hz would have a filter time of 1/10 = 0.1
437
438<samples> This tag only makes sense for the moving-average filter. It says how
439many past samples to average.
440
441<max-rate-of-change> This tag is applicable for the noise-spike filter. Is
442says how much the value is allowed to change per second.
443
444<gain>  This, and it's enclosed <prop> and <value> tags, are only applicable to
445the gain and reciprocal filter types.  The <prop> tag specifies a property node
446to hold the gain value and the <value> tag specifies an initial default value.
447The gain defaults to 1.0 if unspecified.
448
449The output from the gain filter type is: input * gain.
450The output from the reciprocal filter type is: gain / input.
451
452The gain can be changed during run-time by updating the value in the property
453node.
454

README.effects

1Effects
2-------
3
4Effects describe the graphical appearance of 3d objects and scenery in
5FlightGear. The main motivation for effects is to support OpenGL
6shaders and to provide different implementations for graphics hardware
7of varying capabilities. Effects are similar to DirectX effects files
8and Ogre3D material scripts.
9
10An effect is a property list. The property list syntax is extended
11with new "vec3d" and "vec4d" types to support common computer graphics
12values. Effects are read from files with a ".eff" extension or can be
13created on-the-fly by FlightGear at runtime.  An effect consists of a
14"parameters" section followed by "technique" descriptions.  The
15"parameters" section is a tree of values that describe, abstractly,
16the graphical characteristics of objects that use the effect. Techniques
17refer to these parameters and use them to set OpenGL state or to set
18parameters for shader programs. The names of properties in the
19parameter section can be whatever the effects author chooses, although
20some standard parameters  are set by FlightGear itself. On the other
21hand, the properties in the techniques section are all defined by the
22FlightGear.
23
24Techniques
25----------
26
27A technique can contain a predicate that describes the OpenGL
28functionality required to support the technique. The first
29technique with a valid predicate in the list of techniques is used
30to set up the graphics state of the effect. A technique with no
31predicate is always assumed to be valid. The predicate is written in a
32little expression language that supports the following primitives:
33
34and, or, equal, less, less-equal
35glversion - returns the version number of OpenGL
36extension-supported - returns true if an OpenGL extension is supported
37property - returns the boolean value of a property
38float-property - returns the float value of a property, useful inside equal, less
39                or less-equal nodes
40shader-language - returns the version of GLSL supported, or 0 if there is none.
41
42The proper way to test whether to enable a shader-based technique is:
43  <predicate>
44    <and>
45    <property>/sim/rendering/shader-effects</property>
46    <less-equal>
47      <value type="float">1.0</value>
48      <shader-language/>
49    </less-equal>
50    </and>
51  </predicate>
52
53There is also a property set by the user to indicate what is the level
54of quality desired. This level of quality can be checked in the predicate
55like this :
56    <predicate>
57      <and>
58        <property>/sim/rendering/shader-effects</property>
59  <less-equal>
60    <value type="float">2.0</value>
61    <float-property>/sim/rendering/quality-level</float-property>
62  </less-equal>
63  <!-- other predicate conditions -->
64      </and>
65    </predicate>
66
67The range of /sim/rendering/quality-level is [0..5]
68 * 2.0 is the threshold for relief mapping effects,
69 * 4.0 is the threshold for geometry shader usage.
70
71A technique can consist of several passes. A pass is basically an Open
72Scene Graph StateSet. Ultimately all OpenGL and OSG modes and state
73attributes  will be accessable in techniques. State attributes -- that
74is, technique properties that have children and are not just boolean
75modes -- have an <active> parameter which enables or disables the
76attribute. In this way a technique can declare parameters it needs,
77but not enable the attribute at all if it is not needed; the decision
78can be based on a parameter in the parameters section of the
79effect. For example, effects that support transparent and opaque
80geometry could have as part of a technique:
81
82    <blend>
83    <active><use>blend/active</use></active>
84    <source>src-alpha</source>
85    <destination>one-minus-src-alpha</destination>
86    </blend>
87
88So if the blend/active parameter is true blending will be activated
89using the usual blending equation; otherwise blending is disabled.
90
91Values of Technique Attributes
92------------------------------
93
94Values are assigned to technique properties in several ways:
95
96  * They can appear directly in the techniques section as a
97    constant. For example:
98    <uniform>
99      <name>ColorsTex</name>
100      <type>sampler-1d</type>
101      <value type="int">2</value>
102    </uniform>
103    * The name of a property in the parameters section can be
104    referenced using a "use" clause. For example, in the technique
105    section:
106    <material>
107      <ambient><use>material/ambient</use></ambient>
108    </material>
109    Then, in the parameters section of the effect:
110    <parameters>
111      <material>
112        <ambient type="vec4d">0.2 0.2 0.2 1.0</ambient>
113      </material>
114    </parameters>
115
116    It's worth pointing out that the "material" property in a
117    technique specifies part of OpenGL's state, whereas "material"
118    in the parameters section is just a name, part of a
119    hierarchical namespace.
120
121    * A property in the parameters section doesn't need to contain
122    a constant value; it can also contain a "use" property. Here
123    the value of the use clause is the name of a node in an
124    external property tree which will be used as the source of a
125    value. If the name begins with '/', the node is in
126    FlightGear's global property tree; otherwise, it is in a local
127    property tree, usually belonging to a model [NOT IMPLEMENTED
128    YET]. For example:
129    <parameters>
130      <chrome-light><use>/rendering/scene/chrome-light</use></chrome-light>
131    </parameters>
132    The type is determined by what is expected by the technique
133    attribute that will ultimately receive the value. [There is
134    no way to get vector values out of the main property system
135    yet; this will be fixed shortly.] Values that are declared
136    this way are dynamically updated if the property node
137    changes.
138
139OpenGL Attributes
140-----------------
141
142The following attributes are currently implemented in techiques:
143alpha-test - children: active, comparison, reference
144     Valid values for comparision:
145       never, less, equal, lequal, greater, notequal, gequal,
146       always
147
148alpha-to-coverage - true, false
149
150blend - children: active, source, destination, source-rgb,
151     source-alpha, destination-rgb, destination-alpha
152     Each operand can have the following values:
153       dst-alpha, dst-color, one, one-minus-dst-alpha,
154       one-minus-dst-color, one-minus-src-alpha,
155       one-minus-src-color, src-alpha, src-alpha-saturate,
156       src-color, constant-color, one-minus-constant-color,
157       constant-alpha, one-minus-constant-alpha, zero
158
159cull-face - front, back, front-back
160
161lighting - true, false
162
163material - children: active, ambient, ambient-front, ambient-back, diffuse,
164     diffuse-front, diffuse-back, specular, specular-front,
165     specular-back, emissive, emissive-front, emissive-back, shininess,
166     shininess-front, shininess-back, color-mode
167
168polygon-mode - children: front, back
169    Valid values:
170        fill, line, point
171
172program
173    vertex-shader
174    geometry-shader
175    fragment-shader
176    attribute
177    geometry-vertices-out - integer, max number of vertices emitted by geometry
178                            shader
179    geometry-input-type - points, lines, lines-adjacency, triangles,
180                          triangles-adjacency
181    geometry-output-type - points, line-strip, triangle-strip
182
183render-bin - (OSG) children: bin-number, bin-name
184
185rendering-hint - (OSG) opaque, transparent
186
187shade-model - flat, smooth
188
189texture-unit - has several child properties:
190  unit - The number of an OpenGL texture unit
191  point-sprite - true, false - Whether this should rendered as a point-sprite
192  type - This is either an OpenGL texture type or the name of a
193    builtin texture. Currently supported OpenGL types are 1d, 2d,
194    3d which have the following common parameters:
195      image (file name)
196      filter - nearest, linear, [nearest|linear]-mipmap-[nearest|linear]
197      mag-filter - nearest, linear, [nearest|linear]-mipmap-[nearest|linear]
198      wrap-s - clamp, clamp-to-border, clamp-to-edge, mirror, repeat
199      wrap-t - clamp, clamp-to-border, clamp-to-edge, mirror, repeat
200      wrap-r - clamp, clamp-to-border, clamp-to-edge, mirror, repeat
201      mipmap-control - control the mipmap on a per-channel basis.  Children:
202        function-r - auto, average, sum, product, min, max
203        function-g - auto, average, sum, product, min, max
204        function-b - auto, average, sum, product, min, max
205        function-a - auto, average, sum, product, min, max
206
207    The following built-in types are supported:
208      white - 1 pixel white texture
209      noise - a 3d noise texture. (size parameter defines size of texture)
210      light-sprite - a procedurally generated sprite suitable for point lights
211      cubemap - build a cube-map.  Children:
212        images - build from 6 images. Children: [positive|negative]-[x|y|z]
213        image - build from a single cross-image
214
215  environment
216    mode - add, blend, decal, modulate, replace
217    color
218
219  texenv-combine
220    combine-[rgb|alpha] - replace, modulate, add, add-signed, interpolate, subtract, dot3-rgb, dot3-rgba
221    source[0|1|2]-[rgb|alpha] - constant, primary_color, previous, texture, texture[0-7]
222    operand[0|1|2]-[rgb|alpha] -src-color, one-minus-src-color, src-alpha, one-minus-src-alpha
223    scale-[rgb|alpha]
224    constant-color
225
226  texgen
227    mode - object-linear, eye-linear, sphere-map, normal-map, reflection-map
228    planes - s, t, r, q
229
230uniform
231    name
232    type - float, float-vec3, float-vec4, sampler-1d, sampler-2d,
233    sampler-3d
234
235vertex-program-two-side - true, false
236
237vertex-program-point-size - true, false
238
239Inheritance
240-----------
241
242One feature not fully illustrated in the sample below is that
243effects can inherit from each other. The parent effect is listed in
244the "inherits-from" form. The child effect's property tree is
245overlaid over that of the parent. Nodes that have the same name and
246property index -- set by the "n=" attribute in the property tag --
247are recursively merged. Leaf property nodes from the child have
248precedence.  This means that effects that inherit from the example
249effect below could be very short, listing just new
250parameters and adding nothing to the techniques section;
251alternatively, a technique could be altered or customized in a
252child, listing (for example) a different shader program. An example
253showing inheritance Effects/crop.eff, which inherits some if its
254values from Effects/terrain-default.eff.
255
256FlightGear directly uses effects inheritance to assign effects to 3D
257models and terrain. As described below, at runtime small effects are
258created that contain material and texture values in a "parameters"
259section. These effects inherit from another effect which references
260those parameters in its "techniques" section. The derived effect
261overrides any default values that might be in the base effect's
262parameters section.
263
264Generate
265--------
266
267Often shader effects need tangent vectors to work properly. These
268tangent vectors, usually called tangent and binormal, are computed
269on the CPU and given to the shader as vertex attributes. These
270vectors are computed on demand on the geometry using the effect if
271the 'generate' clause is present in the effect file. Exemple :
272
273  <generate>
274    <tangent type="int">6</tangent>
275    <binormal type="int">7</binormal>
276    <normal type="int">8</normal>
277  </generate>
278
279Valid subnodes of 'generate' are 'tangent', 'binormal' or 'normal'.
280The integer value of these subnode is the index of the attribute
281that will hold the value of the vec3 vector.
282
283The generate clause is located under PropertyList in the xml file.
284
285In order to be available for the vertex shader, these data should
286be bound to an attribute in the program clause, like this :
287
288  <program>
289    <vertex-shader>my_vertex_shader</vertex-shader>
290    <attribute>
291      <name>my_tangent_attribute</name>
292      <index>6</index>
293    </attribute>
294    <attribute>
295      <name>my_binormal_attribute</name>
296      <index>7</index>
297    </attribute>
298  </program>
299
300attribute names are whatever the shader use. The index is the one
301declared in the 'generate' clause. So because generate/tangent has
302value 6 and my_tangent_attribute has index 6, my_tangent_attribute
303holds the tangent value for the vertex.
304
305Default Effects in Terrain Materials and Models
306-----------------------------------------------
307
308Effects for terrain work in this way: for each material type in
309materials.xml an effect is created that inherits from a single default
310terrain effect, Effects/terrain-default.eff. The parameters section of
311the effect is filled in using the ambient, diffuse, specular,
312emissive, shininess, and transparent fields of the material. The
313parameters image, filter, wrap-s, and wrap-t are also initialized from
314the material xml. Seperate effects are created for each texture
315variant of a material.
316
317Model effects are created by walking the OpenSceneGraph scene graph
318for a model and replacing nodes (osg::Geode) that have state sets with
319node that uses an effect instead. Again, a small effect is created
320with parameters extracted from OSG objects; this effect inherits, by
321default, from Effects/model-default.eff. A larger set of parameters is
322created for model effects than for terrain because there is more
323variation possible from the OSG model loaders than from the terrain
324system. The parameters created are:
325
326  * material active, ambient, diffuse, specular, emissive,
327    shininess, color mode
328    * blend active, source, destination
329    * shade-model
330    * cull-face
331  * rendering-hint
332  * texture type, image, filter, wrap-s, wrap-t
333
334Specifying Custom Effects
335-------------------------
336
337You can specify the effects that will be used by FlightGear as the
338base effect when it creates terrain and model effects.
339
340In the terrain materials.xml, an "effect" property specifies the name
341of the model to use.
342
343In model .xml files, A richer syntax is supported. [TO BE DETERMINED]
344
345Material animations will be implemented by creating a new effect
346that inherits from one in a model, overriding the parameters that
347will be animated.
348
349Examples
350--------
351
352The Effects directory contains the effects definitions; look there for
353examples. Effects/crop.eff is a good example of a complex effect.
354
355Application
356-----------
357
358To apply an effect to a model or part of a model use:
359
360  <effect>
361    <inherits-from>Effects/light-cone</inherits-from>
362    <object-name>Cone</object-name>
363  </effect>
364
365where <inherits-from> </inherits-from> contains the path to the effect you want to
366apply. The effect does not need the file extension.
367
368NOTE:
369
370Chrome, although now implemented as an effect, still retains the old method of
371application:
372
373  <animation>
374      <type>shader</type>
375      <shader>chrome</shader>
376      <texture>glass_shader.png</texture>
377      <object-name>windscreen</object-name>
378  </animation>
379
380in order to maintain backward compatibility.
381
382Model Hierarchy
383---------------
384
385There are a large number of techniques used by the models, with complex
386inheritance.  Here is a handy list of the techniques, what they are for, and
387where the base technique is defined
388
389Non-Compositor
390
391# Where Defined                Summary
3924 model-combined.xml           ALS, quality>0, model>0
3935 model-defaults.xml           Base ALS
3947 model-combined-deferred.xml  Rembrandt, model>0
3959  model-combined.xml          quality>0, model>0
39610 model-defaults.xml          Base Rembrandt
39711 model-defaults.xml          Generic shaders, quality>0
39813 model-defaults.xml          Fallback - no predicate
399
400
401Compositor
402
403# Where Defined                Summary
4044 model-combined.xml          quality>0, model>0
4057 model-combined.xml          ALS, quality>0, model>0
4068 model-default.xml          generic>0, quality>0
4079 model-default.xml          Fallback - no predicate
40819 model-default.xml         ALS, basic
409
410
411Scenery Hierarchy
412-----------------
413
414Compositor
415
416# Where defined          Summary
4178 terrain-default.xml    quality>0, generic>0
4189 terrain-default.xml    Fallback - no predicate
41917 terrain-default.xml   ALS, landmass=6, transition=6
42018 terrain-default.xml   ALS, landmass>3, transition>2
42119 terrain-default.xml   ALS, basic
422

README.electrical

1Specifying and Configuring and Aircraft Electrical System
2=========================================================
3
4Written by Curtis L. Olson <curt@flightgear.org>
5
6February 3, 2003 - Initial revision.
7
8
9Introduction
10============
11
12The FlightGear electrical system model is an approximation.  We don't
13model down to the level of individual electrons, but we do try to
14model a rich enough subset of components so that a realistic (from the
15pilot's perspective) electrical system may be implemented.  We try to
16model enough of the general flow so that typical electrical system
17failures can be implimented and so that the pilot can practice
18realistic troubleshooting techniques and learn the basic structure and
19relationships of the real aircraft electrical system.
20
21An electrical system can be built from 4 major components: suppliers,
22buses, outputs, and connectors.  Suppliers are things like batteries
23and generators.  Buses collect input from multiple suppliers and feed
24multiple outputs.  Outputs are not strictly necessary, but are
25included so we can name generic output types and provide a consistent
26naming scheme to other FlightGear subsystems.  Finally connectors
27connect a supplier to a bus, or a bus to an output, and optionally can
28specify a switch property (either a physical switch or a circuit
29breaker.)
30
31At run time, the structure specified in the electrical system config
32file is parsed and a directional graph (in the computer science sense)
33is built.  Each frame, the current is propagated through the system,
34starting at the suppliers, flowing through the buses, and finally to
35the outputs.  The system follows the path of connectors laid out in
36the config file and honors the state of any connector switch.
37
38
39Suppliers
40=========
41
42A supplier entry could look like the following:
43
44  <supplier>
45    <name>Battery 1</name>
46    <prop>/systems/electrical/suppliers/battery[0]</prop>
47    <kind>battery</kind>
48    <volts>24</volts>
49    <amps>60</amps>   <!-- WAG -->
50  </supplier>
51
52<name> can be anything you choose to call this entry.
53<prop> is the name of a property that will be updated with the state
54       of this supplier.
55<kind> can be "battery", "alternator", or "external".
56<volts> specifies the volts of the source
57<amps> specifies the amps of the source
58
59Currently <volts> and <amps> are not really modeled in detail.  This
60is more of a place holder for the future.
61
62For alternators, you must additionally specify:
63
64    <rpm-source>/engines/engine[0]/rpm</rpm-source>
65
66The value of the rpm source determines if the generator is able to
67produce power or not.
68
69
70Buses
71=====
72
73A bus entry could look like the following:
74
75  <bus>
76    <name>Essential/Cross Feed Bus</name>
77    <prop>/systems/electrical/outputs/bus-essential</prop>
78    <prop>/systems/electrical/outputs/annunciators</prop>
79    <prop>/systems/electrical/outputs/master-switch</prop>
80  </bus>
81
82<name> is whatever you choose to call this bus
83
84You can have an arbitrary number of <prop> entries.  Each entry is the
85name of a property that will be updated with the value of the current
86at that bus.  This allows you to wire devices directly to the bus but
87does not allow you to insert a switch or circuit breaker in between.
88See "Outputs" and "Connectors" if you want to do that.
89
90
91Outputs
92=======
93
94An output entry could look like the following:
95
96  <output>
97    <name>Starter 1 Power</name>
98    <prop>/systems/electrical/outputs/starter[0]</prop>
99  </output>
100
101An output isn't entirely unlike a bus, but it's nice conceptually to
102have a separate entity type.  This enables us to specify a common set
103of output property names so that other subsystems can automatically
104work with any electrical system that follows the same conventions.  An
105output lives on the other side of a switch, so this is how you can
106wire in cockpit switches to model things like fuel pump power,
107avionics master switch, or any other switch on the panel.
108
109<name> is whatever you choose to call this bus
110
111You can have an arbitrary number of <prop> entries.  Each entry is the
112name of a property that will be updated with the value of the current
113at that bus.  This allows you to wire devices directly to the bus but
114does not allow you to insert a switch or circuit breaker in between.
115See "Outputs" and "Connectors" if you want to do that.
116
117Other FlightGear subsystems can monitor the property name associated
118with the various outputs to decide how to render an instrument,
119whether to run the fuel pump, whether to spin a gyro, or any other
120subsystem that cares about electrical power.
121
122
123Connectors
124==========
125
126An connector entry could look like the following:
127
128  <connector>
129    <input>Alternator 1</input>
130    <output>Virtual Bus 1</output>
131    <switch>/controls/switches/master-alt</switch>
132    <initial-state>off</initial-state>  <!-- optional tag -->
133  </connector>
134
135A connector specifies and input, and output, and any number of
136switches that are wired in series.  In other words, all switches need
137to be true/on in order for current to get from the input to the output
138of the connector.
139
140<input> specifies the <name> of the input.  Typically you would
141specify a "supplier" or a "bus".
142
143<output> specifies the <name> of the output.  Typically you would
144specify a bus or an output.
145
146You can have an arbitrary number of <switch> entries.  The switches
147are wired in series so all of them need to be on (i.e. true) in order
148for current to pass to the output.
149
150Note: by default the system forces any listed switches to be true.
151The assumption is that not every aircraft or cockpit may impliment
152every available switch, so rather than having systems be switched off,
153with no way to turn them on, we default to switched on.
154
155This is a problem however with the starter switch which we want to be
156initialized to "off".  To solve this problem you can specify
157<initial-state>off</initial-state> or
158<initial-state>on</initial-state> Switches default to on, so you
159really only need to specify this tag if you want the connector's
160switch to default to off.
161
162
163Summary
164=======
165
166The electrical system has a lot of power and flexibility to model a
167variety of electrical systems.  However, it is not yet perfect or
168finished.  One major weakness is that it doesn't yet model degraded
169battery or generator power, and it doesn't model the "charge" of the
170batteries in case of a generator failure.
171

README.embedded-resources

1-*- coding: utf-8; fill-column: 72; -*-
2
3The Embedded Resources System
4=============================
5
6This document gives an overview of FlightGear's embedded resources
7system and related classes. For specific information on the C++
8functions, the reference documentation is in the corresponding header
9files.
10
11
12Contents
13--------
14
151. The CharArrayStream and ZlibStream classes
162. The “embedded resources” system
173. About the XML resource declaration files
184. The EmbeddedResourceProxy class
19
20
21Introduction
22------------
23
24The embedded resources system allows FlightGear to use data from files
25without relying on FG_ROOT to be set. This can be used, for instance, to
26grab the contents of XML files at FG build time, from any repository[1],
27and use said contents in the C++ code. The term “embedded” is used to
28avoid confusion with the ResourceProvider and ResourceManager classes
29provided by SimGear, which have nothing to do with the system described
30here.
31
32The embedded resources system relies on classes present in
33simgear/io/iostreams/{zlibstream.cxx,CharArrayStream.cxx}, which were
34implemented as a way to address a concern that embedding a few XML files
35in the fgfs binary could use precious memory. The resource compiler
36(fgrcc) compresses resources before writing them in C++ form---except
37for some extensions, and it's configurable on a per-resource basis
38anyway. Then, the EmbeddedResourceManager instance, which lives in the
39fgfs process, can decompress them on-the-fly, incrementally,
40transparently. So, there is really no reason to worry about memory
41consumption, even for several dozens of XML files.
42
43fgrcc is the resource compiler: it turns arbitrary files into C++ code
44the EmbeddedResourceManager can make use of, in order to “serve” the
45files' contents at runtime. It is named this way, because it fulfills
46the same role as Qt's rcc tool. It supports a thin superset of the
47XML-based format used by rcc for declaring resources[2][3].
48'fgrcc --help' gives a lot of info.
49
50
511) The CharArrayStream and ZlibStream classes
52   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
54The CharArrayStream* files in simgear/io/iostreams/ implement
55CharArrayStreambuf and related IOStreams classes for working with char
56arrays, namely:
57  - CharArrayStreambuf    subclass of std::streambuf      stream buffer
58  - ROCharArrayStreambuf  subclass of CharArrayStreambuf  stream buffer
59  - CharArrayIStream      subclass of std::istream        input stream
60  - CharArrayOStream      subclass of std::ostream        output stream
61  - CharArrayIOStream     subclass of std::iostream       input/output stream
62
63(in the 'simgear' namespace, of course)
64
65CharArrayStreambuf is a stream buffer class allowing to read from, and
66write to char arrays (std::strstream has been deprecated since C++98).
67Contrary to std::strstream, this class does no dynamic allocation: it is
68very simple, strictly staying for both reads and writes within the
69bounds of the buffer specified in its constructor. Contrary to
70std::stringstream, CharArrayStreambuf allows one to work on an array of
71char (that could be static data, on the stack, whatever) without having
72to make a whole copy of it.
73
74ROCharArrayStreambuf is a read-only subclass of CharArrayStreambuf
75(useful for const-correctness). CharArrayIStream, CharArrayOStream and
76CharArrayIOStream are very simple convenience stream classes using
77either CharArrayStreambuf or ROCharArrayStreambuf as their associated
78stream buffer class.
79
80While these classes can be of general-purpose usefulness, the particular
81reason they have been written for is to make the embedded resources
82system clean and memory-friendly. Concretely, this system supports both
83compressed and uncompressed resources, all of which can be read from
84their respective static arrays like this (think pipelines):
85
86static char array
87(uncompressed       --------------->      data available via an std::istream
88 resource)          CharArrayIStream         or std::streambuf interface
89                 or ROCharArrayStreambuf
90
91static char array
92(compressed       ---------------> compressed data ------------------->    ditto
93 resource)        CharArrayIStream               ZlibDecompressorIStream
94                                              or ZlibDecompressorIStreambuf
95
96where ditto = uncompressed data available via an std::istream or
97              std::streambuf interface
98
99So, whether the resource data stored in static arrays by fgrcc is
100compressed or not, end-user code can read it in uncompressed form using
101an std::istream or std::streambuf interface, which means the resource
102never needs to be copied in memory a second time. This is particularly
103interesting with compressed resources, because:
104
105  1) The in-memory static data is much smaller in general than the
106     uncompressed contents, and it's the only one we really have to
107     “pay” for if one uses these stream-based interfaces.
108
109  2) The data is transparently decompressed on-demand as the end-user
110     code reads from the ZlibDecompressorIStream or
111     ZlibDecompressorIStreambuf instance.
112
113In other words, these CharArrayStream classes complement the ones in
114zlibstream.cxx and make it easy to implement all kinds of pipelines to
115incrementally read or write, and possibly on-the-fly compress or
116decompress data from or to in-memory buffers (cf.
117writeCompressedDataToBuffer() in
118simgear/simgear/embedded_resources/embedded_resources_test.cxx, or
119ResourceCodeGenerator::writeEncodedResourceContents() in
120flightgear/src/EmbeddedResources/fgrcc.cxx for examples).
121
122Since all of these provide standard IOStreams interfaces, they can be
123easily plugged into existing code. For instance, readXML() in
124simgear/simgear/xml/easyxml.cxx and readProperties() in
125simgear/props/props_io.cxx can incrementally read and parse data from an
126std::istream instance, and thus are able to directly read from a
127resource containing the compressed version of an XML file.
128
129This incremental stuff is of course really interesting with large
130resources... which probably won't be used in FlightGear, in order not to
131waste RAM[4][5]. The EmbeddedResourceManager also has a getString()
132method to simply get an std::string when you don't care about the fact
133that this operation, by std::string design, will necessarily make a copy
134of the whole resource contents (in uncompressed form in the case of a
135compressed resource). This getString() method should be convenient and
136quite acceptable for reasonably-sized resources.
137
138Finally, all of these classes---CharArray*Stream*, the classes in
139zlibstream.cxx, the EmbeddedResourceManager and related classes---can
140handle text and binary data in exactly the same way (std::string doesn't
141care, and neither do the other classes).
142
143
1442) The “embedded resources” system
145   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146
147The embedded resources system works this way:
148
149  (1) The fgrcc resource compiler reads an XML file which has almost the
150      same syntax[2] as Qt's .qrc files[3] and writes a .cxx file
151      containing:
152        - static char arrays initialized with resource contents
153          (possibly compressed, this is automatic unless explicitly
154          specified in the XML file);
155        - a function definition containing calls to
156          EmbeddedResourceManager::addResource() that register each of
157          these resources with the EmbeddedResourceManager instance.
158
159      If you pass the --output-header-file option to fgrcc, it also
160      writes a header file that goes with the generated .cxx file. For
161      other options, see the output of 'fgrcc --help'.
162
163      It is quite possible to call fgrcc several times, each time with a
164      different (XML input file, .cxx/.hxx output files) tuple: for
165      instance, one call for resources present in the FlightGear repo,
166      and possibly another call for resources in FGData. The point of
167      this is that paths in the XML input file should be relative to
168      avoid being system-dependent, and fgrcc accepts a --root option to
169      indicate what you want them to be relative to, in order to let it
170      find the real files. Thus, on a first invocation of fgrcc, one can
171      make --root point to a path to the FlightGear repository when
172      building, and on the second call use it to indicate a path to the
173      FGData repository. Other variations are possible, of course.
174
175      Notes:
176
177        1) The example given here with FGData would *not* freeze the
178           FGData location at FG compile time; this is only to allow
179           files from FGData to be turned into generated .cxx files
180           inside the FG source tree, that will make their contents
181           available as embedded resources at runtime.
182
183        2) At the time of this writing, resources from the FlightGear
184           repository are compiled at build time, and resources from the
185           FGData repository are compiled offline using the
186           'rebuild-fgdata-embedded-resources' script[6] (a
187           convenience wrapper for fgrcc), before being committed to the
188           FlightGear repository.
189
190  (2) SimGear contains an EmbeddedResourceManager class with, among
191      others, createInstance() and instance() methods similar to the
192      ones of NavDataCache. See [7] for the corresponding code.
193
194      FlightGear creates an EmbeddedResourceManager instance at startup
195      and calls the various init functions generated by fgrcc, each of
196      which registers the resources present in its containing .cxx file
197      (using EmbeddedResourceManager::addResource()).
198
199      End-user FG code can then use EmbeddedResourceManager methods such
200      as getResource(), getString(), getStreambuf() and getIStream()
201      to access resource contents:
202        - getResource() returns an
203          std::shared_ptr<const AbstractEmbeddedResource>
204        - getString() returns an std::string
205        - getStreambuf() returns an std::unique_ptr<std::streambuf>
206        - getIStream() returns an std::unique_ptr<std::istream>
207
208      AbstractEmbeddedResource is an abstract base class that you can
209      think of as a resource descriptor: it points to (not contains!)
210      the resource data (which is normally of static storage class), and
211      contains + gives access to metadata such as the compression type
212      and resource size (compressed and uncompressed).
213
214     AbstractEmbeddedResource currently has two derived concrete
215     classes: RawEmbeddedResource for resources stored as-is
216     (uncompressed) and ZlibEmbeddedResource for resources compressed by
217     fgrcc. It's quite easy to add new subclasses if wanted, e.g. for
218     LZMA compression or other things.
219
220     Resource fetching requires two things:
221
222       - an std::string key (fgrcc manipulates them with SGPath, but the
223         EmbeddedResourceManager code in SimGear is so far completely
224         agnostic of the kind of data stored in keys; this could be
225         changed, though, if we wanted for example to be able to query
226         at runtime all available resources in a given “virtual
227         directory”);
228
229       - a “locale” name, similar to what FlightGear's XML translation
230         files and FGLocale use. We used double quotes here, because
231         fgrcc and the EmbeddedResourceManager expect “locale” names to
232         be of one of these forms:
233           * empty string: default locale, typically but not necessarily
234             English (it is “engineering English” in FlightGear, i.e.,
235             English written by programmers in the code, before
236             translators possibly fix it up :)
237           * en, fr, de, es, it...
238           * en_GB, en_US, fr_FR, fr_CA, de_DE, de_CH, it_IT...
239
240         There is no encoding part, contrary to POSIX locales, hence the
241         use of double quotes around the term “locale” in this context.
242
243     The FGLocale::getPreferredLanguage() method returns the preferred
244     “locale” in the form described above, according to user choice
245     (from fgfs' --language option) and/or settings (system locale).
246     This allows FG to tell the EmbeddedResourceManager the preferred
247     “locale” for resource fetching (same syntax as in Qt's rcc tool for
248     declaration in the XML file, using the 'lang' attribute on
249     'qresource' elements).
250
251     [ Regarding the default locale, the way things are currently set
252       up, I would use no 'lang' attribute for resources suitable for
253       English in the XML input file for fgrcc, except when a
254       country-specific variant is desired (en_GB, en_US, en_AU...). In
255       such a case, there should also be a generic variant with no
256       'lang' attribute declared for the same resource virtual path.
257       This matches what I did for FGLocale::getPreferredLanguage(),
258       that maps unset locales and locales such as C and C.UTF-8 to the
259       default locale for the EmbeddedResourceManager, which is the
260       empty string. This is a matter of policy, of course, and could be
261       changed if desired. ]
262
263     The EmbeddedResourceManager class has getLocale() and
264     selectLocale() methods to manage the _selected locale_. Each
265     resource-fetching method of this class (getResourceOrNullPtr(),
266     getResource(), getString(), getStreambuf() and getIStream()) has
267     two overloads:
268       - one taking only a virtual path (the key mentioned above);
269       - one taking a virtual path and a “locale” name.
270
271     (we'll write “locale” without enclosing double-quotes from now on,
272     otherwise it gets too painful to read; but we're *not* talking
273     about POSIX-style locales ending with an encoding part)
274
275     The first kind of overload uses the selected locale to look up the
276     resource, whereas the second kind uses the explicitly specified
277     locale. Then resource lookup behaves as one could expect. For
278     instance, assuming a resource is looked up for in the "fr_FR"
279     locale, then the EmbeddedResourceManager tries in this order:
280       - "fr_FR";
281       - if no resource has been registered for "fr_FR" with the provided
282         virtual path, it then tries with the "fr" locale;
283       - if this is also unsuccessful, it finally tries with the default
284         locale: "";
285       - if this third attempt fails, the resource-fetching method
286         throws an sg_exception, except for getResourceOrNullPtr(),
287         which returns a null
288         std::shared_ptr<const AbstractEmbeddedResource> instead.
289
290     To see how this is used, you can look at
291     simgear/simgear/embedded_resources/embedded_resources_test.cxx. The
292     only difference with real use is that in this file, resource
293     contents and registering calls with the EmbeddedResourceManager
294     have been written manually instead of by fgrcc. Apart from
295     embedded_resources_test.cxx, here are two examples of client usage
296     of the EmbeddedResourceManager:
297
298  (a) With EmbeddedResourceManager::getString():
299
300      #include <simgear/embedded_resources/EmbeddedResourceManager.hxx>
301      #include <simgear/debug/logstream.hxx>
302
303      [...]
304
305      const auto& resMgr = simgear::EmbeddedResourceManager::instance();
306      SG_LOG(SG_GENERAL, SG_INFO,
307             "Resource contents: '" <<
308             resMgr->getString("/virtual/path/to/resource") << "'");
309
310  (b) With EmbeddedResourceManager::getIStream():
311
312      #include <cstddef>              // std::size_t
313      #include <simgear/io/iostreams/sgstream.hxx>
314      #include <simgear/embedded_resources/EmbeddedResourceManager.hxx>
315
316      [...]
317
318      sg_ofstream outFile(SGPath("/tmp/whatever"));
319      if (!outFile) {
320        <handle open error>
321      }
322
323      const auto& resMgr = simgear::EmbeddedResourceManager::instance();
324      auto resStream = resMgr->getIStream("/virtual/path/to/resource");
325      // One possible way of handling errors from resStream[8]:
326      // resStream->exceptions(std::ios_base::badbit);
327
328      constexpr std::size_t bufSize = 4096;
329      std::unique_ptr<char[]> buf(new char[bufSize]); // intermediate buffer
330
331      do {
332        resStream->read(buf.get(), bufSize);
333        outFile.write(buf.get(), resStream->gcount());
334      } while (*resStream && outFile); // resStream *points* to an std::istream
335
336      <handle possible errors that might have caused to loop to stop
337      prematurely>
338
339
3403) About the XML resource declaration files
341   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
342
343You may want to read the output of 'fgrcc --help', which explains a few
344things, in particular how to write an XML resource declaration file that
345fgrcc can use. At the time of this writing, such files are already
346present as flightgear/src/EmbeddedResources/FlightGear-resources.xml and
347flightgear/src/EmbeddedResources/FGData-resources.xml in the FlightGear
348repository. In case you need resources from elsewhere, it's easy to add
349other XML resource declaration files:
350
351  1) If you want the .cxx/.hxx resource files to be automatically
352     generated as part of the FlightGear build:
353
354     Copy and adapt the add_custom_command() call in
355     flightgear/src/Main/CMakeLists.txt[9] that invokes fgrcc on
356     flightgear/src/EmbeddedResources/FlightGear-resources.xml.
357
358  2) In flightgear/src/Main/CMakeLists.txt, add paths for your new
359     fgrcc-generated .cxx and .hxx files to the SOURCES and HEADERS
360     CMake variables for the 'fgfs' target.
361
362  3) Assuming you passed for instance
363     --init-func-name=initFoobarEmbeddedResources in step 1, add a call
364     to initFoobarEmbeddedResources() after this code in fgMainInit()
365     (flightgear/src/Main/main.cxx):
366
367      simgear::EmbeddedResourceManager::createInstance();
368      initFlightGearEmbeddedResources();
369
370
3714) The EmbeddedResourceProxy class
372   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
373
374SimGear contains an EmbeddedResourceProxy class that allows one to
375access real files or embedded resources in a unified way. When using it,
376one can switch from one data source to the other with minimal code
377changes, possibly even at runtime (in which case there is obviously no
378code change at all).
379
380Sample usage (from FlightGear):
381
382  simgear::EmbeddedResourceProxy proxy(globals->get_fg_root(), "/FGData");
383  proxy.setUseEmbeddedResources(false); // can also be set via the constructor
384
385  std::string s = proxy.getString("/some/path");
386  std::unique_ptr<std::istream> streamp = proxy.getIStream("/some/path");
387
388This example would retrieve contents from the real file
389$FG_ROOT/some/path. If true had been passed in the
390proxy.setUseEmbeddedResources() call, it would instead have used the
391default-locale version of the embedded resource whose virtual path is
392/FGData/some/path.
393
394For more information about this class, see [10] and [11].
395
396
397Footnotes
398=========
399
400[1] E.g., FlightGear or FGData, as long as the path to the latter is
401    provided to the FG build system, which is currently possible but not
402    required (passing '-D FG_DATA_DIR:PATH=...' to CMake when
403    configuring the FlightGear build).
404
405[2] The differences with the QRC format[3] are explained in the output
406    of 'fgrcc --help'. Here is the relevant excerpt:
407
408,----
409| 1. The <!DOCTYPE RCC> declaration at the beginning should be omitted (or
410|    replaced with <!DOCTYPE FGRCC>, however such a DTD currently doesn't
411|    exist). I suggest to add an XML declaration instead, for instance:
412|
413|      <?xml version="1.0" encoding="UTF-8"?>
414|
415| 2. <RCC> and </RCC> must be replaced with <FGRCC> and </FGRCC>,
416|    respectively.
417|
418| 3. The FGRCC format supports a 'compression' attribute for each 'file'
419|    element. At the time of this writing, the allowed values for this
420|    attribute are 'none', 'zlib' and 'auto'. When set to a value that is
421|    not 'auto', this attribute of course bypasses the algorithm for
422|    determining whether and how to compress a given resource (algorithm
423|    which relies on the file extension).
424|
425| 4. Resource paths (paths to the real files, not virtual paths) are
426|    interpreted relatively to the directory specified with the --root
427|    option. If this option is not passed to 'fgrcc', then the default root
428|    directory is the one containing INFILE, which matches the behavior of
429|    Qt's 'rcc' tool.
430`----
431
432[3] http://doc.qt.io/qt-5/resources.html
433
434[4] The main reason why I wrote the classes in
435    simgear/simgear/io/iostreams/{CharArrayStream,zlibstream}.cxx is
436    thus not to maximize memory-efficiency with very large resources;
437    rather, it is to make the implementation of the following parts
438    simple, clean and modular:
439      - the resource compiler (fgrcc);
440      - the EmbeddedResourceManager.
441
442[5] The EmbeddedResourceManager architecture would make it quite easy to
443    also support runtime loading of resources from files (a thing the Qt
444    resource system supports), but it is not very clear how interesting
445    this would be, compared to having the files loaded from $FG_ROOT.
446    Well, maybe for large files [apt.dat.gz & Co] that we would want to
447    load but not see in the FGData repository at all. But then there
448    would be the requirement, of course, that “something” puts the files
449    in a clearly-defined, platform-dependent location known to the
450    EmbeddedResourceManager.
451
452[6] https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/python3-flightgear/rebuild-fgdata-embedded-resources
453
454[7] https://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/embedded_resources/
455
456[8] We know that in some buggy C++ implementations, the
457    std::ios_base::failure exception can't be caught, at least not under
458    its name, due to some ABI compatibility mess:
459
460      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66145
461
462    However, it stills causes the program to abort, and since this
463    error handling technique makes for much more readable and less
464    error-prone code, I think it's still a good way to handle IOStreams
465    errors even now, unless you really need to *catch* the
466    std::ios_base::failure exception.
467
468[9] flightgear/CMakeModules/GenerateFlightgearResources.cmake in my
469    'i18n-and-init-work-v2' branch (not merged into 'next' at the time
470    of this writing).
471
472[10] https://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/embedded_resources/EmbeddedResourceProxy.hxx
473
474[11] https://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/embedded_resources/embedded_resources_test.cxx
475

README.expressions

1Expressions (or SGExpressions) are a feature of the SimGear library
2and provide a nice way of implementing complex math formulas using XML
3syntax. They are supported in many systems within the FlightGear code.
4
5Caution: Expressions do not check if your math creates floating point
6exceptions (like division by zero conditions, taking the square root
7of a negative number, etc.). This can cause undefined behavior and may
8result in NaNs or even Cascading NaNs.  Usage
9
10Expressions are supported in
11
12* Autopilot configuration files
13* Particle system configuration files
14* Animations (translate, rotate, scale, range, blend)
15* The shader technique
16
17Sample Expressions
18
19This is a sample expression for the euation c = sqrt(a*a + b^2).
20
21Children/arguments are parsed in the order they appear in in the file
22(or the order in which they are set via property methods).
23
24<expression>
25  <sqrt>
26    <sum>
27      <product>
28        <property>/value/a</property>
29        <property>/value/a</property>
30      </product>
31      <pow>
32        <property>/value/b</property>
33        <value>2</value>
34      </pow>
35    </sum>
36  </sqrt>
37</expression>
38
39Supported elements
40
41NOTE: #c in the table below is the number of child nodes required.
42
43+-------------------+----+--------------------------------------------------+
44| Function          | #c | Notes                                            |
45+-------------------+----+--------------------------------------------------+
46| <abs> <fabs>      | 1  |                                                  |
47| <acos>            | 1  |                                                  |
48| <asin>            | 1  |                                                  |
49| <atan2>           | 2  |                                                  |
50| <atan>            | 1  |                                                  |
51| <ceil>            | 1  |                                                  |
52| <clip>            | 3  | clipMin, clipMax, expression                     |
53| <cos>             | 1  |                                                  |
54| <cosh>            | 1  |                                                  |
55| <deg2rad>         | 1  |                                                  |
56| <difference> <dif>| 1+ |                                                  |
57| <div>             | 2  |                                                  |
58| <exp>             | 1  |                                                  |
59| <floor>           | 1  |                                                  |
60| <log10>           | 1  |                                                  |
61| <log>             | 1  |                                                  |
62| <max>             | 1+ |                                                  |
63| <min>             | 1+ |                                                  |
64| <mod>             | 2  |                                                  |
65| <pow>             | 2  |                                                  |
66| <product> <prod>  | 1+ |                                                  |
67| <property>        | 0  | Property name e.g.<property>node/value</property>|
68| <rad2deg>         | 1  |                                                  |
69| <sin>             | 1  |                                                  |
70| <sinh>            | 1  |                                                  |
71| <sqr>             | 1  |                                                  |
72| <sqrt>            | 1  |                                                  |
73| <sum>             | 1+ |                                                  |
74| <table>           | 2+ | <entry><ind> 0.0 </ind><dep> 10 </dep></entry>   |
75| <tan>             | 1  |                                                  |
76| <tanh>            | 1  |                                                  |
77| <value>           | 0  | Constant Value e.g. <value>0</value>             |
78+-------------------+----+--------------------------------------------------+
79
80Hints and tips
81--------------
82
831. There is no function for rounding, hwoever "Round half up" can be
84   achieved as follows
85
86  <expression>
87    <floor>
88      <sum>
89        <property>your/property/here</property>
90        <value>0.5</value>
91      </sum>
92    </floor>
93  </expression>
94
952. Interpolation tables can be useful when a formula cannot be found,
96   In the example below <ind> is the indepdendant variable and
97   <dep> is the dependant variable. What this table does is as follows
98   - values below 0.2 will be 10
99   - values above 0.2 and between 1.0 will be interpolated between 10
100     and 0
101   - values above 1.0 will be 0
102
103    <table>
104      <entry><ind> 0.0 </ind><dep> 10 </dep></entry>
105      <entry><ind> 0.2 </ind><dep> 10 </dep></entry>
106      <entry><ind> 1.0 </ind><dep>  0 </dep></entry>
107    </table>
108

README.fgjs

1fgjs -- a small program for creating a basic FlightGear joystick
2        configuration
3
4fgjs requires plib to be installed on your system.  If you've
5successfully installed and built FlightGear then you should be
6all set
7
8Build instructions
9At this point, fgjs has only been built and tested under Linux,
10so the makefile is a simple one. cd into the directory in which
11the fgjs source resides and type 'make' and, if you are lucky,
12all will go well.  You can e-mail me (apeden@earthlink.net) any
13changes needed to make it work on other systems.  It's quite
14possible that this program will become part of the regular
15FlightGear package so
16
17Running
18Set up your joystick and make sure it works with js_demo from the
19FlightGear distribution.  Upon executing fgjs, it will prompt you
20to move the control you wish to use for elevator, ailerons, etc.
21Note that when being prompted for an analog control, you can skip
22the current one by pressing any button and vice-versa when being
23prompted for a button.  You may want to do this if for, as an
24example, rudder if you have only one joystick or your joystick
25doesn't have as many analog axes as FlightGear supports.
26
27Once you've run with this configuration, you may wish to tune
28the dead-band a bit (see fgfsrc.js) as the default, 0.02, may
29be too narrow for your particular hardware/taste.
30
31
32And last, but not least, this thing needs a GUI!!!!  Hopefully,
33the joystick handling code and interface code are separate
34enough that using that a GUI version could be built using this
35source as a starting point.
36
37
38
39
40
41
42
43
44
45
46

README.flightrecorder

1FlightGear Flight Recorder Mini-HOWTO
2
3Thorsten Brehm
4Started in August 2011
5Last revised: 2011-09-26
6
7
8FlightGear provides a customizable flight recorder capable of capturing
9any selection of properties described via XML configuration files.
10The recorder is currently used for the replay system.
11
12
13Feature Brief
14-------------
15* Generic recording system, adaptable to any aircraft/data, provided that
16  data is accessible via the property tree. No hard-coded selections or
17  assumptions on properties to be recorded.
18* Configuration read from XML files or the property tree itself.
19* Interpolation method configurable per recorded/replayed signal.
20* Adaptable recording resolution per signal.
21* Multiple configurations supported.
22
23
24Quick Start: Basic Configuration
25--------------------------------
26To configure and adapt the flight recorder, add a "/sim/flight-recorder"
27section to your aircraft -set.xml file.
28
29Example:
30
31<sim>
32
33  <!-- ... -->
34
35  <flight-recorder>
36    <replay-config type="int">0</replay-config>
37    <config n="0"
38        include="/Aircraft/Generic/flightrecorder/generic-piston-propeller-1.xml">
39      <name type="string">My Aircraft's Flight Recorder</name>
40      <!-- Custom properties -->
41      <signal>
42        <type>float</type>
43        <property type="string">/controls/gear/nosegear-steering-cmd-norm</property>
44        <interpolation>linear</interpolation>
45      </signal>
46      <!-- More custom signals here -->
47    </config>
48  </flight-recorder>
49
50      <!-- ... -->
51
52</sim>
53
54Default type for each signal is "float". Default "interpolation" method
55is "linear" (for float/double). Default values may be omitted. See
56configuration details below.
57
58
59Generic Configuration Files
60---------------------------
61Select one of the default configuration files to specify the basic
62properties to be recorded. It's not recommended to specify all
63properties to be recorded individually.
64The following generic files are provided:
65
66* /Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml
67  Matches propeller aircraft with 4 piston engines, 4 tanks,
68  3 retractable gear.
69  It is the same configuration that was hard-coded for the replay system
70  up to FlightGear 2.4.0. To provide backward compatibility this
71  configuration is loaded by default, unless an aircraft provides a
72  specific flight recorder configuration.
73
74* /Aircraft/Generic/flightrecorder/generic-piston-propeller-1.xml
75  Matches propeller aircraft with 1 piston engines, 2 tanks, 3 fixed
76  gear.
77
78* /Aircraft/Generic/flightrecorder/generic-turboprop-2.xml
79  Matches turboprop aircraft with 2 turbines/propellers, 4 tanks,
80  3 retractable gear.
81
82* /Aircraft/Generic/flightrecorder/generic-jet.xml
83  Matches jet aircraft with 2 jet engines, 4 tanks.
84
85* /Aircraft/Generic/flightrecorder/generic-glider.xml
86  Matches gliders (no engines, no tanks, single fixed gear).
87
88* /Aircraft/Generic/flightrecorder/generic-helicopter.xml
89  Matches helicopters with main and tail rotor (tested with YASim).
90
91If none of the generic files matches your aircraft, simply use a
92configuration which covers more than you need. Alternatively, copy the
93contents of one of these generic files to your aircraft, and adapt as
94needed (see below).
95
96FDM experts are welcome to add more generic configuration files to
97/Aircraft/Generic/flightrecorder - such as YASim-/JSBSim-specific
98configurations, and configurations for other types of aircraft
99(balloons, airships, ...).
100
101
102Generic Components
103-----------------
104The generic configuration files in turn include a set of generic
105components. If you copy the contents of a generic file to your aircraft,
106you can adapt the components to your needs. See examples.
107It is not recommended to copy the contents of the _component_ files to
108an aircraft though (causes too much hassle and dependencies).
109
110Engine Selection:
111 * /Aircraft/Generic/flightrecorder/components/engine-jet.xml
112   Records properties of a single jet engine.
113   For multiple jet engines, use "count". Example for 4 jets:
114     <signals include="/Aircraft/Generic/flightrecorder/components/engine-jet.xml">
115       <count>4</count>
116     </signals>
117
118 * /Aircraft/Generic/flightrecorder/components/engine-piston.xml
119   Records properties of a single piston engine and propeller.
120   For multiple piston engines, use "count" (see "jet" example).
121
122 * /Aircraft/Generic/flightrecorder/components/rotor.xml
123   Records properties of a single helicopter rotor (tested with YASim).
124   To use this, provide the base property path to the rotor as "prefix".
125   Example recording the rotor below "/rotors/main":
126     <signals include="/Aircraft/Generic/flightrecorder/components/rotor.xml">
127         <prefix type="string">/rotors/main</prefix>
128     </signals>
129
130Gear Selection:
131 * /Aircraft/Generic/flightrecorder/components/gear-fixed.xml
132   Records properties of a single non-retractable gear.
133   For multiple fixed gear, use "count" (see "jet" example).
134
135 * /Aircraft/Generic/flightrecorder/components/gear-retractable.xml
136   Records properties of a single retractable gear.
137   For multiple retractable gear, use "count" (see "jet" example).
138
139Tanks:
140 * /Aircraft/Generic/flightrecorder/components/tanks.xml
141   Records properties of a single fuel tank.
142   For multiple fuel tanks, use "count" (see "jet" example).
143
144Other:
145 * /Aircraft/Generic/flightrecorder/components/surfaces.xml
146   Records properties of flight control surfaces. Include this
147   for aircraft (with wings). Not useful for helicopters,
148   balloons, ...
149
150 * /Aircraft/Generic/flightrecorder/components/faults-engines.xml
151   Records fault properties of a single engine. Only include this
152   if your aircraft supports fault simulation.
153   For multiple engines, use "count" (see "jet" example). If used,
154   it should be compined with piston or jet engine.
155
156 * /Aircraft/Generic/flightrecorder/components/environment.xml
157   Records properties of environment/weather (visibility,
158   temperature - but _not_ cloud position...).
159
160 * /Aircraft/Generic/flightrecorder/components/position.xml
161   Records properties of a the aircrafts main position (latitude,
162   longitude, velocities, ...).
163   This is the most important component. Always include this.
164
165 * /Aircraft/Generic/flightrecorder/components/controls.xml
166   Records most important flight controls (rudder, aileron,
167   elevator, ...). Always include this.
168
169
170Custom Properties
171-----------------
172When the generic or component files are not be sufficient to record or
173replay aircraft-specific effects, you can add custom properties (signals
174to be recorded) to the configuration.
175Each signal consits of a recording type/resolution (which does _not_
176need to match the actual type in the property tree!), the path to the
177property and interpolation type.
178
179Example recording some additional custom properties:
180  <sim>
181    <flight-recorder>
182      <config n="0"
183        include="/Aircraft/Generic/flightrecorder/generic-piston-propeller-1.xml">
184        <!-- Add custom properties here -->
185        <signal>
186          <type>float</type>
187          <property type="string">/controls/gear/nosegear-steering-cmd-norm</property>
188        </signal>
189        <signal>
190          <type>double</type>
191          <interpolation>rotational-deg</interpolation>
192          <property type="string">/ai/model/carrier/alpha-angle-deg</property>
193        </signal>
194        <signal>
195          <type>bool</type>
196          <property type="string">/controls/panel/custom-switch</property>
197        </signal>
198      </config>
199    </flight-recorder>
200  </sim>
201
202
203Signal Configuration
204--------------------
205Template:
206  <signal>
207    <type>bool</type>
208    <interpolation>angular-deg</interpolation>
209    <property type="string">/controls/panel/custom-switch</property>
210  </signal>
211
212* type: The signal's type specifies the recording resolution - not the
213  type of the original property. The following types are supported:
214
215  - double: 8 byte/sample
216  - float:  4 byte/sample (default)
217  - int:    4 byte/sample, integer
218  - int16:  2 byte/sample, integer
219  - int8:   1 byte/sample, integer
220  - bool:   1 bit/sample (yes, 1 bit. 8 bools per byte).
221
222  String type is unsupported (too expensive).
223
224* interpolation: Specifies how values are interpolated during replay, i.e.
225  when replay is in slow-motion mode and more frames/second are required
226  than recorded, or when replaying data from the medium/long term memory.
227  Supported methods:
228    - discrete: No interpolation. Default for integer/bool types.
229    - linear: Standard linear interpolation. Default for float/double.
230    - angular-rad (or angular): Angular values in radians (0-2pi).
231    - angular-deg: Angular values in degrees (0-360).
232
233* property: Path to the property to be recorded.
234
235
236Advanced Configuration
237----------------------
238- Multipe recorder configurations for a single aircraft are supported
239  (multiple "<config n=..>" sections for n=0,1,...).
240  Active configuration to be used for the replay system is selected via
241     /sim/flight-recorder/replay-config (= 0,1,...).
242  This can be useful for specific recorders for specific scenarios,
243  which should not be used by default. For example, a specific recorder
244  configuration could be provided which also records the position of
245  an aircraft carrier, of other AI aircraft, ...
246  This may also be useful for future use, i.e. to select another flight
247  recorded configuration for a different purpose, such as for the
248  multiplayer system.
249
250- Flight recorder configuration can be adapted during run-time
251  (configuration is visible in the property browser below
252  /sim/flight-recorder). However it is necessary to reset (reinit) the
253  replay subsystem first - which also erases earlier recordings. It is
254  not possible to mix recordings of different configurations on to a
255  single "tape".
256
257- Each configuration should be given a name. Useful for a (future)
258  selection GUI, when multiple configurations are available.
259
260
261Optimizing Performance
262----------------------
263- Recording properties consumes memory and also CPU time. A few
264  additional properties don't matter much, but avoid execessive numbers.
265  Reduce the resolution (type) of signals to the minimum necessary to
266  save space.
267- Use "bool" types where possible, they are most efficient.
268- Avoid recording with "double" resolution (type "double"). Use "float"
269  instead - even if the original property in the property tree is a
270  "double" (almost all of them do). "float" precision is almost always
271  sufficient for recording/replay purposes, with few exceptions (like
272  latitude/longitude properties).
273- Use int16/int8 for "small" integer values.
274
275
276Recording/Replay Limits
277-----------------------
278- All properties can be recorded, however, only writable properties can
279  be replayed. Properties marked as read-only, or tied properties not
280  implementing the "set" method cannot be replayed.
281- Replaying a property overwrites the property's value. However, other
282  sources may also write to the same property - such as Nasal code,
283  autopilot rules etc. When multiple sources "fight" over a property's
284  value then the last update "wins" - resulting in a dependency to an
285  unknown/random sequence. Hence, during deplay, try to disable other
286  sources writing to properties which were recorded and should be
287  replayed.
288  If the other source cannot be disabled, check if you're recording the
289  right property. It may be better to record the input properties of the
290  other source instead (i.e. the inputs processed by the Nasal or
291  autopilot rule).
292
293__end__
294
295

README.gui

1FlightGear GUI Mini-HOWTO
2
3David Megginson
4Started: 2003-01-20
5Last revised: 2003-01-20
6
7
8FlightGear creates its drop-down menubar and dialog boxes from XML
9configuration files under $FG_ROOT/gui.  This document gives a quick
10explanation of how to create or modify the menubar and dialogs.  The
11toolkit for the FlightGear GUI is PUI, which is part of plib.
12
13All of the XML files use the standard FlightGear PropertyList format.
14
15
16MENUBAR
17-------
18
19FlightGear reads the configuration for its menubar from
20$FG_ROOT/gui/menubar.xml.  The file consists of a series of top-level
21elements named "menu", each of which defines on of the drop-down
22menus, from left to right.  Each menu contains a series of items,
23representing the actual items a user can select from the menu, and
24each item has a series of bindings that FlightGear will activate when
25the user selects the item.
26
27Here's a simplified grammar:
28
29  [menubar] : menu*
30
31  menu : label, item*
32
33  item : label, enabled, binding*
34
35The bindings are standard FlightGear bindings, the same as the ones
36used for the keyboard, mouse, joysticks, and the instrument panel.
37Any commands allowed in those bindings are allowed here as well.
38
39Here's an example of a simple menubar with a "File" drop-down menu and
40a single "Quit" item:
41
42  <PropertyList>
43
44   <menu>
45    <label>File</label>
46
47    <item>
48     <label>Quit</label>
49     <binding>
50      <command>exit</command>
51     </binding>
52    </item>
53
54  </PropertyList>
55
56PUI menus do not allow advanced features like submenus or checkmarks.
57The most common command to include in a menu item binding is the
58'dialog-show' command, which will open a user-defined dialog box as
59described in the next section.
60
61
62DIALOGS
63-------
64
65The configuration files for XML dialogs use a nested structure to set
66up dialog boxes.  The top-level always describes a dialog box, and the
67lower levels describe the groups and widgets that make it up.  Here is
68a simple, "hello world" dialog:
69
70  <PropertyList>
71
72   <name>hello</name>
73
74   <width>150</width>
75   <height>100</height>
76   <modal>false</modal>
77   <draggable>true</draggable>
78   <resizable>true</resizable>
79
80   <text>
81    <x>10</x>
82    <y>50</y>
83    <label>Hello, world</label>
84    <color>
85     <red>1.0</red>
86     <green>0.0</green>
87     <blue>0.0</blue>
88    </color>
89   </text>
90
91   <button>
92    <x>40</x>
93    <y>10</y>
94    <legend>Close</legend>
95    <binding>
96     <command>dialog-close</command>
97    </binding>
98   </button>
99
100  </PropertyList>
101
102The dialog contains two sub-objects: a text field and a button.  The
103button contains one binding, which closes the active dialog when the
104user clicks on the button.
105
106Coordinates are pseudo-pixels.  The screen is always assumed to be
1071024x768, no matter what the actual resolution is.  The origin is the
108bottom left corner of the screen (or parent dialog or group); x goes
109from left to right, and y goes from bottom to top.
110
111All objects, including the top-level dialog, accept the following
112properties, though they will ignore any that are not relevant:
113
114 x - the X position of the bottom left corner of the object, in
115   pseudo-pixels.  The default is to center the dialog.
116
117 y - the Y position of the bottom left corner of the object, in
118   pseudo-pixels.  The default is to center the dialog.
119
120 width - the width of the object, in pseudo-pixels.  The default is
121   the width of the parent container.
122
123 height - the height of the object, in pseudo-pixels.  The default is
124   the width of the parent container.
125
126 border - the border thickness, in pseudo-pixels.  The default is 2.
127
128 color - a subgroup to specify the dialogs color:
129  red   - specify the red color component of the color scheme.
130  green - specify the green color component of the color scheme.
131  blue  - specify the blue color component of the color scheme.
132  alpha - specify the alpha color component of the color scheme.
133
134 font - a subgroup to specify a specific font type
135  name - the name of the font (excluding it's .txf extension)
136  size - size of the font
137  slant -  the slant of the font (in pseudo-pixels)
138
139 legend - the text legend to display in the object.
140
141 label - the text label to display near the object.
142
143 property - the name of the FlightGear property whose value will
144   be displayed in the object (and possibly modified through it).
145
146 binding - a FlightGear command binding that will be fired when the
147   user activates this object (more than one allowed).
148
149 keynum - the key code of a key that can be used to trigger the
150   widget bindings via keyboard (e.g. <keynum>97</keynum> for
151   the "a" key.
152
153 key - like "keynum", but takes a character ("a", "A", "Shift-a",
154   "Shift-A", "Ctrl-a", "%", etc.), or symbolic key name ("Tab",
155   "Return" = "Enter", "Esc" = "Escape", "Space", "&amp;" = "and",
156   "&lt;", "&gt;", "F1" -- "F12", "Left", "Up", "Right", "Down",
157   "PageUp", "PageDn", "Home", "End", "Insert"). Note that you
158   can't use "<", ">", and "&" directly.
159
160 default - true if this is the default object for when the user
161   presses the [RETURN] key.
162
163 visible - if set to false, hides the whole widget that it is used
164   in, along with its children. There's no empty space reserved
165   for such widgets. The "visible" property can also be used to hide
166   other XML groups from the layouter.
167
168Objects may appear nested within the top-level dialog or a "group"
169or a "frame" object.  Here are all the object types allowed, with their
170special properties:
171
172
173dialog
174------
175
176The top-level dialog box; the name does not actually appear in the
177file, since the root element is named PropertyList.
178
179  name - (REQUIRED) the unique name of the dialog for use with the
180    "dialog-show" command.
181
182  modal - true if the dialog is modal (it blocks the rest of the
183    program), false otherwise.  The default is false.
184
185  draggable - false if the dialog is not draggable. The default is true.
186
187  resizable - false if the dialog is not resizable. The default is false.
188
189  nasal - Nasal definition block
190    open - Nasal script to be executed on dialog open
191    close - Nasal script to be executed on dialog close
192
193All Nasal code runs in a dialog namespace. Nasal bindings can
194directly access variables and functions defined in an <open> block.
195settimer() and setlistener() functions have to be removed manually
196in the <close> block if they shouldn't remain active.
197
198
199Example:
200
201<PropertyList>
202
203 <name>sample</name>
204 <width>500</width>
205 <height>210</height>
206 <modal>false</modal>
207
208 <text>
209  ...
210 </text>
211
212 <button>
213  ...
214 </button>
215
216</PropertyList>
217
218
219group and frame
220---------------
221
222A group of subobjects.  This object does not draw anything on the
223screen, but all of its children specify their coordinates relative to
224the group; using groups makes it easy to move parts of a dialog
225around.
226
227A frame is a visual representation of a group and has  a border and an
228adjustable background color.
229
230Example:
231
232  <group>
233   <x>0</x>
234   <y>50</y>
235
236   <text>
237    ...
238   </text>
239
240   <input>
241    ...
242   </input>
243
244   <button>
245    ...
246   </button>
247
248  </group>
249
250
251input
252-----
253
254A simple editable text field.
255
256Example:
257
258  <input>
259   <x>10</x>
260   <y>60</y>
261   <width>200</width>
262   <height>25</height>
263   <label>sea-level temperature (degC)</label>
264   <property>/environment/temperature-sea-level-degc</property>
265  </input>
266
267
268text
269----
270
271A non-editable text label.
272
273Example:
274
275  <text>
276   <x>10</x>
277   <y>200</y>
278   <label>Heading</label>
279  </text>
280
281  <text>
282   <x>10</x>
283   <y>200</y>
284   <label>-9.9999</label> <!-- placeholder for width -->
285   <format>%-0.4f m</format>
286   <property>/foo/altitude</property>
287  </text>
288
289
290checkbox
291--------
292
293A checkbox, useful for linking to boolean properties.
294
295Example:
296
297  <checkbox>
298   <x>150</x>
299   <y>200</y>
300   <width>12</width>
301   <height>12</height>
302   <property>/autopilot/locks/heading</property>
303  </checkbox>
304
305
306
307button
308------
309
310A push button, useful for firing command bindings.
311
312  one-shot - true if the button should pop up again after it is
313    pushed, false otherwise.  The default is true.
314
315  <button>
316   <x>0</x>
317   <y>0</y>
318   <legend>OK</legend>
319   <binding>
320    <command>dialog-apply</command>
321   </binding>
322   <binding>
323    <command>dialog-close</command>
324   </binding>
325   <default>true</default>
326  </button>
327
328
329
330combo
331-----
332
333A pop-up list of selections.
334
335  value - one of the selections available for the combo.  There may be
336  any number of "value" fields.
337
338Example:
339
340  <combo>
341   <x>10</x>
342   <y>50</y>
343   <width>200</width>
344   <height>25</height>
345   <property>/environment/clouds/layer[0]/type</property>
346   <value>clear</value>
347   <value>mostly-sunny</value>
348   <value>mostly-cloudy</value>
349   <value>overcast</value>
350   <value>cirrus</value>
351  </combo>
352
353
354
355list
356----
357
358like "combo", but displays all values in a scrollable list box with
359slider on the right side. Updates the <property> to the selected
360entry. On <dialog-update> re-scans the <value> nodes and updates
361the list.
362
363
364
365airport-list
366------------
367
368like "list", but fills the list automatically with all airports known
369to FlightGear. Calls bindings on airport selection and returns the
370selected entry in <property> on dialog-apply. Interprets <property>
371as search term on dialog-update.
372
373
374
375property-list
376-------------
377
378like "list", but shows a list of properties from the global property
379tree. The widget handles navigation in the property tree. It calls its
380bindings on property selection and returns the path of the selected
381property in <property> on dialog-apply. It's up to the caller to check
382if the path belongs to a dir node or a value node. The widget shows
383the contents of the dir property given in <property> on dialog-apply.
384It does *not* handle setting of property values! Clicking on some
385entries with the "control" or "shift" key pressed has a special meaning:
386
387Ctrl +
388  "."     ->  toggle verbose mode (shows flags, listeners, dir-values)
389  ".."    ->  go to root node
390  (bool)  ->  toggle bool value
391
392Shift +
393  "."     ->  dump contents of that tree level to the terminal
394
395The flags printed after the node type have the following meaning:
396
397  r       ->  read protected
398  w       ->  write protected
399  R       ->  trace read operations    (in the terminal window)
400  W       ->  trace write operations
401  A       ->  archive bit set
402  U       ->  user archive bit set
403  P       ->  preserved bit set (value is preserved on sim-reset)
404  T       ->  property is "tied"
405
406  Ln      ->  number of listeners attached to this node
407
408
409
410select
411------
412
413A box with arrow buttons that cycle through a list of values.
414
415Example:
416
417  <select>
418   <x>10</x>
419   <y>50</y>
420   <width>200</width>
421   <height>25</height>
422   <property>/sim/aircraft</property>
423   <value>bo105</value>
424   <value>ufo</value>
425  </select>
426
427
428
429slider
430------
431
432A horizontal or vertical slider for setting a value.
433
434  vertical - true if the slider should be vertical, false if it should
435    be horizontal.  The default is false.
436
437  min - the minimum value for the slider.  The default is 0.0.
438
439  max - the maximum value for the slider.  The default is 1.0.
440
441  step - set to non-null if slider should move in steps.  The default is 0.0 (off).
442
443  pagestep - set to non-null to enable page-stepping.  The default is 0.0 (off).
444
445  fraction - size of the slider handle. Range: 0..1.  The default is 0.0 (minimum).
446
447Example:
448
449  <slider>
450   <x>10</x>
451   <y>50</y>
452   <width>200</width>
453   <property>/environment/visibility-m</property>
454   <min>5</min>
455   <max>50000</max>
456  </slider>
457
458
459dial
460----
461
462A circular dial for choosing a direction.
463
464  wrap - true if the dial should wrap around, false otherwise.  The
465    default is true.
466
467  min - the minimum value for the dial.  The default is 0.0.
468
469  max - the maximum value for the dial.  The default is 1.0.
470
471Example:
472
473  <dial>
474   <x>10</x>
475   <y>50</y>
476   <width>20</width>
477   <property>/environment/wind-from-direction-deg</property>
478   <min>0</min>
479   <max>360</max>
480  </dial>
481
482
483textbox
484-------
485
486The text will be retrieved/buffered from/within a specified
487property tree, like:
488
489<textbox>
490    <!-- position -->
491    <x>100</x>
492    <y>100</y>
493
494    <!-- dimensions -->
495    <width>200</width>
496    <height>400</height>
497
498    <property>/gui/path-to-text-node/contents</property>
499
500    <slider>15</slider> <!--width for slider -->
501    <wrap>false</wrap> <!-- don't wrap text; default: true -->
502    <top-line>0</top-line <!-- line to show at top, -ve numbers: show last line -->
503
504    <editable>true</editable> <!-- if the puLargeInput is supposed to be editable -->
505</textbox>
506
507
508hrule/vrule
509-----------
510
511Draws a horizontal/vertical line that, by default, expands to full width/height.
512Its thickness can be set with <pref-height>/<pref-width>.
513
514  <hrule>
515    <color>
516      <red>1.0</red>
517      <green>0.0</green>
518      <blue>0.0</blue>
519    </color>
520    <pref-height>2</pref-height>
521  </hrule>
522
523
524
525
526GLOBAL SETTINGS ("THEMES")
527--------------------------
528
529FlightGear reads GUI style information from /sim/gui/, which is by default
530loaded from file $FG_ROOT/gui/style.xml.  This file contains one <font> and
531one <colors> group:
532
533
534global font settings
535--------------------
536
537  <sim>
538    <gui>
539      <font>
540        <name type="string">Helvetica.txf</name>
541        <size type="float">15</size>
542        <slant type="float">0</slant>
543      </font>
544    </gui>
545  <sim>
546
547<name> can either be the name of a built-in bitmap font (one of:
548"FIXED_8x13", "FIXED_9x15", "TIMES_10", "TIMES_24", "HELVETICA_10",
549"HELVETICA_12", "HELVETICA_14", "HELVETICA_18", "SANS_12B"), or the
550name of a texture font in the $FG_FONT directory. $FG_FONT is by
551default set to $FG_ROOT/Fonts/. Properties <size> and <slant> are
552only applied to texture fonts, and otherwise ignored.
553
554
555global color settings
556---------------------
557
558These define the color of the splash screen font, and the color of the
559GUI elements. All colors are in /sim/gui/colors/ and follow the same
560pattern:
561
562  <sim>
563    <gui>
564      <colors>
565        <!-- splash screen font color; ignores <alpha> value -->
566        <splash>
567          <red type="float">1.0</red>
568          <green type="float">0.9</green>
569          <blue type="float">0.0</blue>
570        </splash>
571      </colors>
572    </gui>
573  </sim>
574
575
576
577As listed above, FlightGear implements several GUI elements:
578
579(1)    "dialog"      "group"         "frame"       "hrule"      "vrule"
580       "list"        "airport-list"  "input"       "text"       "checkbox"
581       "radio"       "button"        "combo"       "slider"     "dial"
582       "textbox"     "select"
583
584
585The underlying plib library uses six colors for each GUI element.
586These are:
587
588(2)    "background"  "foreground"    "highlight"
589       "label"       "legend"        "misc"
590
591
592"button", for example, uses the first four colors from (2), while it
593ignores "legend" and "misc" color. "text" only uses "label", and ignores
594the rest. In some cases the use of colors isn't obvious and you have to
595try or look up the plib sources to be sure. GUI colors can be defined
596for each of the categories from (1) and (2), and for combinations of
597them:
598
599(3)    "button-legend"   "input-misc"    etc.
600
601
602FlightGear has default colors for (2) built-in. Let's call them (0).
603And this is how colors for individual GUI elements are determined,
604if, for example, a button is to be drawn:
605
606  For the button's background:
607  a. read the hard-coded default "background" color from (0) as base
608  b. merge the global "background" color from (2) in (if defined)
609  c. merge a global color "button-background" from (3) in (if defined)
610  d. merge a specific <color> from the dialog's XML file in (if defined)
611
612  Repeat the four steps for the button's "foreground", "highlight",
613  etc. color.
614
615
616
617
618If you write a style file, you'll most likely start with the colors
619from (2):
620
621 <sim>
622   <gui>
623     <colors>
624       <background>
625         <red type="float">0.6</red>
626         <green type="float">0.0</green>
627         <blue type="float">0.0</blue>
628         <alpha type="float">1.0</alpha>
629       </background>
630
631       <foreground>
632       ...
633
634This makes all dialogs dark red. But you don't, for example, want buttons
635to be red, but yellow. So you define another color for buttons:
636
637       <button>
638         <red type="float">1.0</red>
639         <green type="float">0.9</green>
640         <blue type="float">0.0</blue>
641         <alpha type="float">1.0</alpha>
642       </button>
643       ...
644
645This sets all of a button's six colors (2) to some shades of red. plib
646does this automatically. The lower and right border ("foreground") will
647be darker, the upper and left border will be lighter ("highlight").
648If you aren't happy with plib's choice, you can set each of the colors
649explicitly. Let's say, we want the text on the button blue (3):
650
651       <button-legend>
652         <red type="float">0.3</red>
653         <green type="float">0.3</green>
654         <blue type="float">1.0</blue>
655         <alpha type="float">1.0</alpha>
656       </button-legend>
657       ...
658
659To set the cursor color from input fields, you'd define "input-misc",
660etc.
661
662
663You can change colors and font at runtime. Just open the property
664browser, go to /sim/gui/colors and change whatever you like. The
665new color will only take effect, though, if you re-init the GUI.
666There's a menu entry for that, and you can define a key binding
667for it:
668
669  <key n="99">
670    <name>c</name>
671    <desc>Re-init GUI</desc>
672    <binding>
673      <command>reinit</command>
674      <subsystem>gui</subsystem>
675    </binding>
676  </key>
677
678Note that this will currently close all open dialogs!
679
680
681__end__
682

README.hud

1This document describes the *new* HUD system that will be first released
2with fgfs >0.9.10. For the old system see $FG_ROOT/Docs/README.xmlhud.
3Note that the old system is scheduled for removal, and that the new system
4is work in progress. So it's up to you to choose the lower risk.  :-)
5
6
7
8
9
10
11###############################################################################
12
13
14A HUD configuration file may contain 3 types of information:
15
16  (1) global settings
17  (2) HUD instrument definitions
18  (3) imports of further HUD config files
19
20
21
22
23
24(1) global settings ===========================================================
25
26These can be used to override settings in the global property tree. Currently
27only bool <enbale-3d> is supported. It allows a HUD to define itself if it is
28a 2D HUD (false) or a 3D HUD (true). 2D HUDs always remain in the screen plane,
29while 3D HUDs always remain in a position relative to the aircraft.
30
31Example:
32
33    <enable-3d>true</enable-3d>
34
35
36
37
38
39(2) HUD instrument definitions ================================================
40
41These define one single HUD "item" (instrument or label), and consist of several
42properties. Some of those are standardized property groups that can be used
43in many places. These shall be explained first.
44
45
46
47(2.1) standardized property groups --------------------------------------------
48
49  1. <condition> group
50  2. input channel group
51  3. <option>s
52
53
54
55(2.1.1) <condition> ...........................................................
56
57These define conditions that are either "true" or "false". They are used to
58hide/unhide whole items, or to set other item states (blinking on/off) etc.
59You find detailed documentation about them in $FG_ROOT/Docs/README.conditions.
60
61
62
63(2.1.2) input channel groups .................................................
64
65These define an input channel to the HUD instrument and serve as interface
66between property system and the instrument. A complete channel definition
67looks like this (defaults in comments):
68
69  <input>
70      <property>/position/altitude-agl-ft</property>  <!-- no default -->
71      <factor>0.3048</factor>                         <!-- 1.0 -->
72      <offset>2.0</offset>                            <!-- 0.0 -->
73      <damp>1.5</damp>                                <!-- 0.0 (no damping) -->
74      <min>0.0</min>                                  <!-- -infinity -->
75      <max>10000</max>                                <!-- +infinity -->
76  </input>
77
78Input channels are only called <input> for instruments that only have one
79channel. Other instruments may have two or more channels, called <bank-input>,
80<pitch-input> etc. All of them will have the same member properties and behave
81the same.
82
83An input channel will preprocess the raw property value for the HUD instrument.
84The property may be of any type (bool, int, long, float, double, string), but
85not all types will make sense in every situation. The HUD instrument will only
86see the final value, which is calculated as:
87
88
89  v = <property> * <factor> + <offset>
90  if (<damp>)     v = EWMA_lowpass(v, <damp>)
91  if (v < <min>)  v = <min>
92  if (v > <max>)  v = <max>
93
94
95The EWMA_lowpass filter (Exponentially Weighted Moving Average) is calculated
96like so:
97
98
99  coeff = 1.0 - 1.0 / 10^<damp>
100  v = average = (average * coeff) + (v * (1.0 - coeff))
101
102
103That is, a <damp> value of 0 will cause no damping. A damping value of 1 will
104make a coefficient of 0.9, which means that the resulting value will be 9/10
105of the average plus 1/10 of the new value. A damping value of 2 will make
106a coefficient of 0.99 and hence result in a value of 99/100 the average plus
1071/100 the new value etc. The higher the <damp> value, the more damped will
108the output value be.
109
110
111
112
1132.1.3 <option> ................................................................
114
115Most HUD instruments accept one or more options from a common set. It will be
116explaind in the respective intrument descriptions which options are actually
117used by that instrument. Possible values are:
118
119  <option> autoticks </option>
120  <option> vertical </option>   \___orientation of <tape>
121  <option> horizontal </option> /
122  <option> top </option>          \
123  <option> left </option>         |___place of numbers in <tape>, <gauge>
124  <option> bottom </option>       |   top/bottom for turn-bank-indicator, etc.
125  <option> right </option>        /
126  <option> both </option>           _left/right for vert. and top/bottom for hor.
127  <option> noticks </option>
128  <option> arithtic </option>
129  <option> decitics </option>
130  <option> notext </option>       ___no numbers on <tape>
131
132
133Example:
134
135  <tape>
136      <option>left</option>
137      <option>vertical</option>
138      ...
139  </tape>
140
141
142
143
144
145
146(2.1) properties common to all instruments ------------------------------------
147
148All HUD instruments will accept the following common properties (shown on
149a <tape> instrument):
150
151
152  <tape>
153      <name>foo tape</name>
154      <x>-100</x>                        <!-- 0 == center -->
155      <y>-60</y>                         <!-- 0 == center -->
156      <width>20</width>                  <!-- 0 -->
157      <height>120</height>               <!-- 0 -->
158      <condition>...</condition>         <!-- see section 2.1.1; default: true -->
159      ...
160  </tape>
161
162The <name> is only a description for the instrument to make reading the config
163easier. It's output in --log-level=info, but not otherwise used. The coordinates
164define the place and size of the instrument. They are relative to the origin of
165their parent, which is the middle of the HUD/screen by default. Positive <x> are
166on the right, positive <y> in the upper half. The <condition> hides/reveals the
167whole instrument.
168
169
170
171
172
173
174(2.2) HUD instruments ---------------------------------------------------------
175
176
177
178
179(2.2.1) <label> ...............................................................
180
181Draws a formatted string or number.
182
183Text:
184  <format>   ... printf-style format with only one % item.  Example:  "%2.3lf ft"
185  <prefix>   ... prefix text  \___ in addition to the <format>
186  <postfix>  ... postfix text /
187  <halign>   ... one of "left", "center" (default), "right".
188
189Box:
190  <box>      ... draw box around label (default: false)
191  <option>   ... one of (left|right|top|bottom)  ... draw arrow on this side
192  <pointer-width>  ... size of pointer base
193  <pointer-lenfth> ... distance of base--peak
194
195  <blinking>
196      <interval>                  ... on/off-time in seconds (default: -1 == off)
197      <condition>...</condition>  ... see secion 2.1.1       (default: true)
198  </blinking>
199
200TODO:
201  <digit>    ... number of insignificant digits (those will be printed smaller)
202
203
204
205Example:
206
207  <label>
208      <name>G Load</name>
209      <x>-40</x>
210      <y>25.5</y>
211      <width>1</width>
212      <height>1</height>
213
214      <input>
215          <property>/accelerations/pilot/z-accel-fps_sec</property>
216          <factor>-0.03108095</factor>
217          <damp>1.3</damp>
218      </input>
219
220      <format>%2.1f</format>
221      <halign>right</halign>
222      <box>true</box>
223      <option>bottom</option>    <!-- pointer on the lower edge -->
224
225      <blinking>
226          <interval>0.25</interval>
227          <condition>
228              <or>
229                  <less-than>      <!-- G load > 2.0 -->
230                      <property>/accelerations/pilot/z-accel-fps_sec</property>
231                      <value>-64.3481</value>
232                  </less-than>
233
234                  <greater-than>   <!-- G load < -1.0 -->
235                      <property>/accelerations/pilot/z-accel-fps_sec</property>
236                      <value>31.17405</value>
237                  </greater-than>
238              </or>
239          </condition>
240      </blinking>
241  </label>
242
243
244
245
246
247
248
249
250
251(2.2.2) <tape> ................................................................
252SCALE:
253    input
254    major-divisions
255    minor-divisions
256    modulo
257    display-span
258
259TAPE:
260    tick-bottom
261    tick-top
262    tick-right
263    tick-left
264    cap-bottom
265    cap-top
266    cap-right
267    cap-left
268    marker-offset
269    enable-pointer
270    zoom
271
272    pointer-type   (moving|fixed)
273    tick-type      (circle|line)
274    tick-length    (constant|variable)
275
276
277
278
279
280
281
282
283
284(2.2.3) <dial> ................................................................
285SCALE:
286    input
287    major-divisions
288    minor-divisions
289    modulo
290    display-span
291
292TAPE:
293    radius
294    divisions
295
296
297
298
299
300
301
302
303(2.2.4) <gauge> ...............................................................
304SCALE:
305    input
306    major-divisions
307    minor-divisions
308    modulo
309    display-span
310
311
312
313
314
315
316(2.2.5) <turn-bank-indicator> .................................................
317    bank-input
318    sideslip-input
319    gap-width
320    bank-scale
321
322
323
324
325
326
327
328
329(2.2.6) <ladder> ..............................................................
330    pitch-input
331    roll-input
332    display-span
333    divisions
334    screen-hole
335    compression-factor
336    enable-fuselage-ref-line
337    enable-target-spot
338    enable-velocity-vector
339    enable-drift-marker
340    enable-alpha-bracket
341    enable-energy-marker
342    enable-climb-dive-marker
343    enable-glide-slope-marker
344    glide-slope
345    enable-energy-marker
346    enable-waypoint-marker
347    enable-zenith
348    enable-nadir
349    enable-hat
350    type       (pitch|climb-dive)
351
352
353
354
355
356
357
358
359
360(2.2.7) <runway> ..............................................................
361    arrow-scale
362    arrow-radius
363    line-scale
364    scale-dist-nm
365    outer_stipple
366    center-stipple
367    arrow-always
368
369reads directly:
370    /position/altitude-agl-ft,
371    /sim/view[0]/config/pitch-pitch-deg
372    /sim/view[0]/config/pitch-heading-deg
373
374
375
376
377
378(2.2.8) <aiming-reticle> ......................................................
379
380Draws MIL-STD-1787B aiming reticle. Size of bullet and inner circle are
381determined from <width>. The outer circle radius is changeable at runtime.
382
383  <active-condition> ... true:  stadiametric (4.2.4.4)  (default)
384                         false: standby (4.2.4.5)
385  <diameter-input>   ... input channel: diameter of outer circle relative to
386                         inner circle; default: 2.0 (= twice as big)
387
388
389
390
391
392
393
394(3) <import> ==================================================================
395
396Imports another HUD config into the current one. This can be a file defining
397a single instrument ($FG_ROOT/Huds/Instruments/*.xml), a set of instruments
398($FG_ROOT/Huds/Sets/*.xml) or a mixture of both (for example a complete HUD
399on its own). The x/y offets moves the reference point for the included items
400relative to the current reference point.
401
402    <import>
403        <path>Huds/Sets/controls.xml</path>
404        <x-offset>-100</x-offset>
405        <y-offset>70</y-offset>
406    </import>
407
408Imported files can import further files. This is allowed for up to 10 levels.
409This is an arbitrary number and can easily be changed in the code if necessary.
410
411When fgfs is called with --log-level=info, then it outputs a graphical trees
412of all loaded/imported files, with the instruments shown as leafs.
413
414

README.introduction

1
2Internals
3---------
4
5The core of FlightGear is the property system. This is a tree like internal
6representation of global variables. The property system is explained more
7in detail later on.
8
9FlightGear' way of doing things is breaking it up into small pieces. There is
10(for example) animation code that reacts on property changes. There is also a
11Flight Dynamics model (FDM) that (amongst other things) updates properties.
12There is a menu system that can display and alter properties. Then we have
13sound code that plays sound based on ... properties.
14
15Maybe you see a pattern evolve by now.
16
17All subsystems are almost self containing. Most of the time they only read the
18values of some properties, and sometimes they alter other properties. This is
19the basic way of communicating between subsystems.
20
21
22Property System
23---------------
24
25The property system is best described as an in-memory LDAP database which holds
26the state of global variables. The system has a tree like hierarchy (like a
27file system) and has a root node, sub nodes (like subdirectories) and end-nodes
28(variables).
29
30All variables are kept internally as raw values and can be converted to any
31other supported type (boolean, int, float double and string).
32
33Like a file system, every node can be accessed relative to the current node, or
34absolute to the root node.
35
36The property system also allows aliasing nodes to other nodes (like symbolic
37linking files or directories to other files or directories) and may be assigned
38read-only or read-write.
39
40If necessary it would be possible for parts of the program to hold it's own
41property tree, which is inaccessible from the global property tree, by keeping
42track of it's own root-node.
43
44Property I/O code allows one to easily read the tree from, or write the tree to
45an XML file.
46
47
48Subsystems
49----------
50
51To add a new subsystem you would have to create a derived class from
52SGSubsystem and define at least a small set of functions:
53
54    class FGFX : public SGSubsystem
55    {
56    public:
57
58      FGFX ();
59      virtual ~FGFX ();
60
61      virtual void init ();
62      virtual void reinit ();
63      virtual void bind ();
64      virtual void unbind ();
65      virtual void update (double dt);
66    }
67
68The init() functions should make sure everything is set and ready so the
69update() function can be run by the main loop. The reinit() function handles
70everything in case of a reset by the user.
71
72The bind() and unbind() functions can be used to tie and untie properties.
73
74After that you can register this class at the subsystem manager:
75
76    globals->add_subsystem("fx", new FGFX);
77
78Now the subsystem manager calls the update() function of this class every
79frame. dt is the time (in seconds) elapsed since the last call.
80
81
82Scripting
83---------
84
85The scripting langage Nasal can also read and modify properties but it can also
86be incorporated into the menu system. The documentation for Nasal can be found
87here:  http://www.plausible.org/nasal/flightgear.html
88
89

README.jsclient

1Start flightgear with
2fgfs --jsclient=socket,in,<hz>,,<port>,udp \
3     --prop:/jsclient/axis[i]="/property/you/want/to/control" \
4     --prop:/jsclient/axis[i+1]="/another/property/you/want/to/control" ...
5eg:
6# fgfs --aircraft=yf23-yasim --airport=KEMT --jsclient=socket,in,5,,16759,udp \
7  --prop:/jsclient/axis[0]="/controls/flight/spoilers" \
8  --prop:/jsclient/axis[1]="/radios/comm/volume"
9
10Start the server on the machine with the remote gameport:
11JsServer <host> <port>
12eg:
13# JsServer 192.168.1.1 16759
14
15(JsServer can be started before or after fgfs)
16

README.layout

1I just commited an implementation of GUI layout management, ported
2over from my game project last year*.  What this means is that you no
3longer need to position your widgets manually in dialogs, and can
4instead lay them out in tables and boxes like the pros do. :) I've
5redone a few of the dialogs using the new scheme (I'm especially proud
6of the autopilot dialog: http://plausible.org/andy/autopilot-new.png),
7so you can see what the possibilities look like.
8
9* FWIW, this is almost the last of my useful code from last spring.
10  Nasal and the Plib vertex splitting code are two other bits that
11  were useful in isolation.  I also had a terrain engine and stencil
12  shadow implementation, but those weren't really production quality.
13
14Basically, the implementation is a preprocessor on top of the existing
15dialog properties, which sets x/y/width/height values based on
16constraints.  The <group> objects, including the top-level one which
17represents the whole dialog, can now have a <layout> property, which
18can be "hbox", "vbox", or "table".
19
20The boxes simply lay out their children in order, either top-to-bottom
21or left-to-right.  The box name comes from Qt and Gtk, but this is
22also the same thing that Java calls a "flow layout", or what the Tk
23"packer" does.  You can set "constraint" properties on the children,
24to give the layout manager hints as to how to place the children.  For
25the boxes, these are:
26
27  equal:   The box manager makes sure that all the widgets with this
28           constraint set to true get equal sizes big enough to fit the
29           largest one.  This is very useful for button boxes to make
30           the "OK" and "Cancel" buttons match, for example.
31  stretch: Cells with "stretch" set to true get all the extra space,
32           if any, the box has to allocate.  These are useful for
33           alignment purposes, especially when combined with <empty>
34           "widgets" (which are ignored by the dialog creation code,
35           but honored by the layout engine).
36
37The table layout will be a little more familiar to anyone with HTML
38experience.  Children of tables get the following constraints:
39
40  row:     The row number containing the upper left corner of the widget.
41           Table rows are zero-indexed.
42  col:     The column number containing the upper left corner of the widget.
43           Table columns are zero-indexed.
44  rowspan: The number of rows spanned by the widget. Defaults to one.
45  colspan: The number of columns spanned by the widget.  Defaults to
46           one.
47
48Inside of each "cell", regardless of parent layout, there are some
49constraints that are used to position the widget within the space
50available:
51
52  halign:      The horizontal alignment.  Can be "left", "right",
53               "center", or "fill" (i.e. stretch to available space).
54  valign:      The vertical alignment.  Can be "top", "bottom",
55               "center", or "fill".
56  padding:     The number of pixels to leave between the edge of the
57               cell and the widget.
58  pref-height:
59  pref-width:  Overrides the default preferred size of the widget.
60               Note that this is the size of the widget only, not the
61               cell (which includes padding).
62
63Also, the padding values for cells in a group can be set to a default
64value with a <default-padding> property on the group widget.
65
66Some will ask why didn't I implement this as part of Pui.  The problem
67is the pui just isn't set up for it.  Not only is there no notion of
68"preferred" size for a widget, there isn't anything remote like a
69"constraint" system for attaching arbitrary values to widgets.  With
70the property system, I have that for free (the original code was
71written to work with Nasal objects, btw).  I can do the layout with
72the properties and on the properties, and our existing dialog code
73hardly needs to change at all.
74
75Anyway, give it a try and see if I've broken anything.  Also, note
76that some of these changes *do* modify the visual appearance of the
77GUI.  I think it looks better, but opinions will no doubt vary.  Shout
78if you hate it.
79
80And finally, the text alignment doesn't quite look right with current
81plib due to some minor rendering bugs.  Bug Steve to apply the patch I
82submitted a week or so ago. :)
83
84Andy
85
86

README.logging

1Logging in FlightGear
2---------------------
3
4[Note: JSBSim also has its own independent logging facilities, which
5are not discussed here.]
6
7FlightGear can log any property values at any interval to one or more
8CSV files (which can be read and graphed using spreadsheets like
9Gnumeric or Excel).  Logging is defined in the '/logging' subbranch of
10the main property tree; under '/logging', each '/log' subbranch
11defines a separate log with its own output file and interval.  Here is
12a simple example that logs the rudder and aileron settings every
13second (1000ms) to the file steering.csv, using a comma (the default,
14anyway) as the field delimiter:
15
16<PropertyList>
17 <logging>
18  <log>
19   <enabled>true</enabled>
20   <filename>steering.csv</filename>
21   <interval-ms>1000</interval-ms>
22   <delimiter>,</delimiter>
23   <entry>
24    <enabled>true</enabled>
25    <title>Rudder</title>
26    <property>/controls/flight/rudder</property>
27   </entry>
28   <entry>
29    <enabled>true</enabled>
30    <title>Ailerons</title>
31    <property>/controls/flight/aileron</property>
32   </entry>
33  </log>
34 </logging>
35</PropertyList>
36
37Each 'log' subbranch contains a required 'enabled' property, an
38optional 'filename' property (defaults to "fg_log.csv"), an optional
39'delimiter' property (defaults to a comma), an optional 'interval-ms'
40property (defaults to 0, which logs every frame), and a series of
41'entry' subbranches.  The 'delimiter' property uses only the first
42character of the property value as the delimiter.  Note that the
43logger does no escaping, so you must choose a delimiter that will not
44appear in the property values (that's not hard, since most of the
45values are numeric, but watch for commas in the titles).
46
47Each 'entry' subbranch contains a required 'enabled' property, a
48'property' property specifying the name of the property to be logged,
49and an optional 'title' property specifying the title to use in the
50CSV file (defaults to the full path of the property).  The elapsed
51time in milliseconds since the start of the simulation is always
52included as the first entry with the title "Time", so there is no need
53to include it explicitly.
54
55Here's a sample of the logging output for the above log:
56
57  Time,Rudder,Ailerons
58  6522,0.000000,0.000000
59  7668,-0.000000,0.000000
60  8702,-0.000000,0.000000
61  9705,-0.000000,0.000000
62  10784,-0.000000,0.000000
63  11792,-0.000000,0.000000
64  12808,-0.000000,-0.210000
65  13826,-0.000000,-0.344000
66  14881,-0.000000,-0.066000
67  15901,-0.000000,-0.806000
68  16943,-0.000000,-0.936000
69  17965,-0.000000,-0.534000
70  19013,-0.000000,-0.294000
71  20044,-0.000000,0.270000
72  21090,-0.000000,-1.000000
73  22097,-0.000000,-0.168000
74
75Note that the requested interval is only a minimum; most of the time,
76the actual interval is slightly longer than the requested one.
77
78The easiest way for an end-user to define logs is to put the log in a
79separate XML file (usually under the user's home directory), then
80refer to it using the --config option, like this:
81
82  fgfs --config=log-config.xml
83
84The output log files are always relative to the current directory.
85
86--
87
88David Megginson, last updated 2002-02-01
89

README.materials

1README.materials
2
3This README describes the materials.xml file format. It is targeted at those
4wanting to change the appearance of the scenery in FlightGear.
5
6The materials file used by FlightGear is set in the /sim/rendering/materials-files
7property.  It is read on startup, and can be reloaded in-sim from the
8"Reload Materials" item in the Debug menu.
9
10The materials file consists of one or more <region> elements.  Each <region>
11contains one or more geographical <area> elements, defining a rectangle
12(lat1/lon1, lat2/lon2), and a set of <material> elements which describes a
13single visually distinct terrain material in the FG world which will be used to
14render one of more scenery landclasses (for example Grass or Town).  When determining
15the material to use for a given landclass at a given lat/lon, the <region> elements
16are checked in order and the <condition> element of the materials evaluated.  The
17_last_ matching material definition is used.  So more specific regions and materials
18definitions should be put towards the bottom of the materials file.
19
20The rest of this document describes the children tags of the <material> entry.
21
22name : Scenery type names that map to this material. These are typically taken
23       from landclass definitions created by TerraGear. Multiple scenery types
24       may map to a single material. This is recommended to minimize texture
25       memory usage.
26
27condition : A condition statement used to activate the material. Note that this
28       if evaluated once at start-up.
29
30texture : A relative path to an SGI RGB, PNG or DDS file containing a texture
31       for the material. RGB and PNG are recommended for platform compatibility.
32       You may define more than one <texture> element, in which case the scenery
33       loader will choose one texture for each contiguous set of scenery
34       triangles.
35
36texture-set : If using an effect (see below), it may be necessary to define more
37       than one texture.  The texture-set element has multiple <texture> element
38       children which may then be referenced by the effect. You may define more
39       than one <texture-set> element, in which case the scenery loader will
40       choose one texture for each contiguous set of scenery triangles.
41
42object-mask : An optional bitmap file used to control random placement of lights,
43       buildings and vegetation on the terrain.  The green channel mask is used
44       for random vegetation placement, the blue channel for buildings and lights.
45       and the red channel controls the rotation of buildings (0.0 is North, 0.5
46       is South). Fractional colour values can be used to give a probability of
47       placement. Multiple object-masks may be defined to match up with <texture>
48       or <texture-set> elements.
49
50effect : The effect to be used for this material. (default:
51       Effects/terrain-default)
52
53       ambient, diffuse, specular, emissive, and shininess are copied into the
54       parameter section of the effect created for this material.
55
56parameters : Additional parameters to be used in the effect. See README.effects
57            for format information.
58
59wrapu : True if the texture should repeat horizontally over a surface, false if
60       it should not repeat (default: true).
61
62wrapv : True if the texture should repeat vertically over a surface, false if
63       it should not repeat (default: true).
64
65mipmap : True if the texture should be mipmapped, false otherwise. (default: true).
66
67xsize : The horizontal size of a single texture repetition, in meters.
68
69ysize : the vertical size of a single texture repetition, in meters
70
71light-coverage : The coverage of a single point of light in m^2. 0 indicates no
72        lights at all. Minimum value is 1000m^2. May be masked by the blue channel
73        of an object-mask. Lights are all generated 3m above the surface, and
74        have random colour (50% yellow, 35% white, 10% orange, 5% red)
75
76ambient : The ambient light colour for the material, specified as separate
77        r, g, b, a components (default: all color components 0.2, alpha 1.0).
78
79diffuse : The diffuse light colour for the material, specified as separate
80        r, g, b, a components (default: all color components 0.8, alpha 1.0).
81
82specular : The specular light colour for the material, specified as separate
83        r, g, b, a components (default: all color components 0.0, alpha 1.0).
84
85emissive : The emissive light colour for the material, specified as separate
86        r, g, b, a components (default: all color components 0.0, alpha 1.0).
87
88solid : Whether the surface is solid from an FDM perspective. If it is not
89        solid, it is assumed that the material models a fluid (water) surface.
90        (default: true).
91
92friction-factor : The friction factor for that material. The normalized
93        factor can be used by a FDM to post-multiply all contact friction forces
94        with that factor. That is the more slippery a material is the smaller
95        this value should be. (default: 1.0 for Dry concrete/Asphalt).
96
97rolling-friction : the gear rolling rolling-friction coefficient for this
98        particular material. (default: 0.02 for Dry concrete/Asphalt).
99
100bumpiness : normalized bumpiness factor for this particular terrain.
101        (default: 0.0 for a smooth surface).
102
103load-resistance : a pressure value how much force per surface area this
104        surface can carry without deformation. The value should be in N/m^2
105        (default: 1e30).
106
107glyph : group that defines one letter/digit/symbol in a font texture
108        sub-entries: name, left (default: 0.0), right (default: 1.0)
109        (left and right describe the horizontal position in the texture.)
110
111wood-coverage : The coverage of trees in areas marked as woodland in
112         m^2. A lower number means a higher density of trees. A value of
113         0 indicates no woods. May be masked by the green channel of an
114         object-mask. (default: 0)
115
116tree-range-m : The range at which trees become visible. Note that this
117         is not absolute, as trees are loaded in blocks. A lower number means
118         trees will not become visible until you are closer.
119
120tree-texture : A texture to use for the trees. Typically this will contain around
121         8 different trees in a row, duplicate 4 times. From bottom to top, the
122         rows contain
123         * summer textures
124         * summer snow texture
125         * winter texture
126         * winter snow texture
127
128         Each tree must have space at the top. For a 512x512 texture sheet, this
129         should be 8 pixels.  Otherwise subsequent rendering results in "top hats"
130         above trees in the distance where the trunk of the tree above in the
131         textures sheet bleeds downwards when the mipmaps are generated.
132
133tree-varieties : The number of different trees defined in the tree-texture
134         horizontally. (default: 1)
135
136tree-height-m : The average height of the trees. Actual tree height will
137         vary by +/- 50%. (default: 0)
138
139tree-width-m : The average width of the tree cover. Actual tree width will
140         vary by +/- 50%. (default 0)
141
142tree-max-density-angle-deg : The slope angle at which trees begin to thin out
143         as the slope is too steep to support the full coverage. Shallower
144         slopes have maximum wood-coverage.  Steeper slopes have fewer trees.
145         (default : 45)
146
147tree-zero-density-angle-deg : The angle at which the slope is too steep to
148         support significant vegetation.  Steeper slopes have no trees.
149         (default : 60)
150
151object-max-density-angle-deg : The angle at which objects and buildings become
152         less dense due to a steep slope. (default : 20)
153
154object-zero-density-angle-deg : The angle at which the slope is too steep to build
155         on.  No object/buildings will be placed on slopes steeper than this.
156         (default : 30)
157
158object-group : A group of random objects to be placed on the surface. Contains
159         <range-m> and one or more <object> children.
160
161range-m : The distance at which objects within this object-group become
162         visible. Note that for realism, 60% of the objects will become visible
163         at <range-m>, 30% at 1.5*<range-m>, and 10% at 2*<range-m>.
164         (default: 2000)
165
166object : A set of random objects to be placed. Contains <coverage-m2>, <path>
167         and <heading> children.
168
169coverage-m2 : The coverage of a single object in m2. Lower values mean a higher
170         density. Minimum value is 1000.
171
172spacing-m : The minimum space between this object and any other on the surface in
173         meters. This helps to avoid objects being placed ontop of each other.
174         (default 20)
175
176path :   Path relative to FG_ROOT to a model definition, usually .ac or .xml file.
177         More than one <path> may be included within the <object> tag, in which
178         case a single <path> is chosen at random for each individual object
179         placement.
180
181heading-type : Indicator of how the heading of the random objects should be
182         determined. Valid values are:
183           fixed     - Objects all point North. Default.
184           random    - Objects are assigned an individual random heading
185           mask      - Rotation is taken from the red channel of the object-mask
186           billboard - Object is always rotated to face camera - expensive
187
188
189Random Buildings
190================
191
192Random Buildings come in three sizes, with individual constraints.
193
194Small buildings.  These have different textures on the sides compared to the front
195and back.  Small buildings are never deeper than they are wide.
196
197Medium buildings, which are never taller than they are wide.
198
199Large buildings. There are no constraints on their width, depth or height.
200
201building-coverage : The coverage of random buildings in areas marked for random
202         objects in m^2. A lower number means a higher density of buildings. A
203         value of 0 indicates no buildings. May be masked by the blue channel of an
204         object-mask. (default: 0)
205
206building-spacing-m : The minimum spacing between random buildings and other buildings
207         or random objects. This helps avoid objects being placed on top of each
208         other. (default: 5)
209
210building-small-ratio: Ratio of small buildings. These buildings are 1-3 stories
211         in height, and may have a pitched roof. Fraction of small buildings is
212         (<building-ratio-small> / (<building-ratio-small> + <building-ratio-medium>
213         + <building-ratio-large>). (default: 0.8)
214
215building-medium-ratio : Ratio of medium buildings. These buildings are 3-6 stories
216         in height, and have a flat roof. (default: 0.15)
217
218building-large-ratio : Ratio of large buildings. These buildings are 5-10 stories in
219         height, and have a flat roof. (default 0.05)
220
221building-small-pitch : Fraction of small buildings with pitched roofs. (default 0.8)
222building-medium-pitch : Fraction of small buildings with pitched roofs. (default 0.2)
223building-large-pitch : Fraction of small buildings with pitched roofs. (default 0.1)
224
225building-small-min-floors : Min. number of floors for a small building. (default 1)
226building-small-max-floors : Max. number of floors for a small building. (default 3)
227
228building-medium-min-floors  : Min. number of floors for a medium building. (default 3)
229building-medium-max-floors  : Max. number of floors for a medium building. (default 8)
230
231building-large-min-floors  : Min. number of floors for a medium building. (default 5)
232building-large-max-floors  : Max. number of floors for a medium building. (default 20)
233
234building-small-min-width-m : Min. width of small buildings. (default 15)
235building-small-max-width-m : Max. width of small buildings. (default 60)
236building-small-min-depth-m : Min. depth of small buildings. (default 10)
237building-small-max-depth-m : Max. depth of small buildings. (default 20)
238
239building-medium-min-width-m : Min. width of medium buildings. (default 25)
240building-medium-max-width-m : Max. width of medium buildings. (default 50)
241building-medium-min-depth-m : Min. depth of medium buildings. (default 20)
242building-medium-max-depth-m : Max. depth of medium buildings. (default 50)
243
244building-large-min-width-m : Min. width of large buildings. (default 50)
245building-large-max-width-m : Max. width of large buildings. (default 75)
246building-large-min-depth-m : Min. depth of large buildings. (default 50)
247building-large-max-depth-m : Max. depth of large buildings. (default 75)
248
249building-texture : The texture used for all buildings. See Docs/buildings.png for
250                   details. (default Texture/buildings.png)
251
252building-lightmap: Emissive texture for all buildings, which is faded in at night to
253                   provide illusion of lit windows.  Same texture coordinates and
254                   format at building-texture above.
255
256building-range-m: Range at which all buildings are visible.  Beyond this point fewer
257                  and fewer buildings are rendered, with no buildings rendered at
258                  2*building-range-m (default 10000)
259

README.mingw

1How to compile FlightGear with mingw
2====================================
3
4
5MinGW & MSYS
6============
7
8You need to install mingw & msys:
9
10http://www.mingw.org
11
12You need at least:
13
14MinGW: binutils, gcc-core, gcc-g++, mingw-runtime, mingw-utils, w32api
15I would recommed the gcc-3.4.4 versions.
16MSYS: msys-1.0.10.exe, msys-autoconf, msys-automake, msys-libtool, msys-DTK.
17
18Please read instructions carefully.
19
20Set the follwing environment variables within msys shell.
21
22export CFLAGS="-I/usr/local/include -O2"
23export CXXFLAGS="-I/usr/local/include -O2"
24export CPPFLAGS=-I/usr/local/include
25export LDFLAGS=-L/usr/local/lib
26
27Pthread-win32
28=============
29
30http://sources.redhat.com/pthreads-win32/
31
32compile:
33make  GCE-inlined
34
35Install:
36cp pthread.h sched.h semaphore.h /usr/local/include
37cp linpthreadGCE2.a  /usr/local/lib/libpthread.a
38cp pthread-GCE.dll /usr/local/bin
39
40patch header:
41
42--- pthread.h   Sat Oct  1 20:56:43 2005
43***************
44*** 210,218 ****
45   * -----------------
46   */
47
48! #if HAVE_CONFIG_H
49! #include "config.h"
50! #endif /* HAVE_CONFIG_H */
51
52  #ifndef NEED_FTIME
53  #include <time.h>
54--- 210,218 ----
55   * -----------------
56   */
57
58! //#if HAVE_CONFIG_H
59! //#include "config.h"
60! //#endif /* HAVE_CONFIG_H */
61
62  #ifndef NEED_FTIME
63  #include <time.h>
64
65GLUT
66====
67
68use precompiled in order to avoid conflicts with glut32.dll already installed.
69
70http://www.xmission.com/~nate/glut.html
71http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip
72
73The header has to be updated with respect to MINGW.
74
75*** glut.h      Tue Dec 12 22:22:52 2000
76--- /local_old/include/GL/glut.h        Thu Aug 18 20:41:15 2005
77***************
78*** 20,26 ****
79     /* XXX This is from Win32's <windef.h> */
80  #  ifndef APIENTRY
81  #   define GLUT_APIENTRY_DEFINED
82! #   if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
83  #    define APIENTRY    __stdcall
84  #   else
85  #    define APIENTRY
86--- 20,26 ----
87     /* XXX This is from Win32's <windef.h> */
88  #  ifndef APIENTRY
89  #   define GLUT_APIENTRY_DEFINED
90! #   if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) || defined(__MINGW32__)
91  #    define APIENTRY    __stdcall
92  #   else
93  #    define APIENTRY
94
95
96install:
97cp glut.h /usr/local/include
98cp glut32.dll /usr/local/bin
99
100reimp glut32.lib
101cp libglut32.a /usr/local/lib
102
103OpenAL
104======
105
106Get OpenAL for instance from Creative
107
108OpenAL win32 package
109install Redist
110
111
112install:
113
114cd libs
115reimp  OpenAL32.lib
116cp libopenal32.a  /usr/local/lib
117cp alut.lib  /usr/local/lib/libalut.a
118cd ..
119mkdir /usr/local/include/AL
120cp Include/* /usr/local/include/AL
121
122
123zlib-1.2.3
124==========
125
126configure --prefix=/usr/local
127make
128make install
129
130plib-1.6.8
131==========
132configure --prefix=/usr/local
133make
134make install
135
136simgear
137=======
138get simgear from CVS
139configure --prefix=/usr/local
140make
141make  install
142
143flightgear
144=========
145configure --prefix=/usr/local --with-threads
146make
147make install
148
149

README.minipanel

1Mini Panels for c172
2
3List of files:
4
5./keyboard.xml - same as release key bindings with "s" added to swap panels.
6./preferences.xml - same as release preferences.xml with "panel2" added.
7./Aircraft/c172/Panels/c172-panel-mini.xml - mini with sacred six, compass,
8	mixture knob, flaps, and control indicators.
9./Aircraft/c172/Panels/c172-panel-trans-mini.xml - same mini panel with
10	plexiglass (transparent) background.
11./Aircraft/c172/Panels/Textures/panel-mini-bg.rgb - grey background.
12./Aircraft/c172/Panels/Textures/panel-trans-mini-bg.rgb - transparent background.
13
14
15USAGE NOTES:
16
17Hitting "s" will switch between the standard panel and the default.
18
19You may choose other panels for the two that get toggled by changing the
20preferences or adding command line parameters.
21
22The property for the panels are:
23Normal (Primary) panel: /sim/panel/path=<path to xml file>
24Mini (Secondary) panel: /sim/panel2/path=<path to xml file>
25
26The new property is /sim/panel2/path,  it does not need to be a mini panel, you
27can use whatever you want.
28
29For example: to use the grey mini panel change preferences.xml or add this to
30your command line:
31
32runfgfs --prop:/sim/panel2/path=Aircraft/c172/Panels/c172-panel-mini.xml
33

README.multiplayer

1The commands are of the form:
2
3--multiplay=in | out,Hz,destination address,destination port
4--callsign=a_unique_name
5
6
7Below are some examples of startup commands that demonstrate the use of the
8multiplayer facilities.
9
10For two players on a local network or across the internet:
11----------------------------------------------------------
12Player1:
13--multiplay=out,10,192.168.0.3,5500 --multiplay=in,10,192.168.0.2,5501
14--callsign=player1
15
16Player2:
17--multiplay=out,10,192.168.0.2,5501 --multiplay=in,10,192.168.0.3,5500
18--callsign=player2
19
20
21For multiple players on a local network:
22----------------------------------------
23Player1:
24--multiplay=out,10,255.255.255.255,5500
25--multiplay=in,10,255.255.255.255,5500 --callsign=player1
26
27Playern:
28--multiplay=out,10,255.255.255.255,5500
29--multiplay=in,10,255.255.255.255,5500 --callsign=playern
30
31Note that the callsign is used to identify each player in a multiplayer game
32so the callsigns must be unique. The multiplayer code ignores packets that
33are sent back to itself, as would occur with broadcasting when the rx and tx
34ports are the same.
35
36
37Multiple players sending to a single player:
38--------------------------------------------
39Player1:
40--multiplay=out,10,192.168.0.2,5500 --callsign=player1
41
42Player2:
43--multiplay=out,10,192.168.0.2,5500 --callsign=player2
44
45Player3:
46--multiplay=out,10,192.168.0.2,5500 --callsign=player3
47
48Player4 (rx only):
49--multiplay=in,10,192.168.0.2,5500 --callsign=player4
50
51This demonstrates that it is possible to have multiple instances of
52Flightgear that send to a single instance that displays all the traffic. This
53is the sort of implementation that we are considering for use as a tower
54visual simulator.
55
56
57For use with a server:
58----------------------
59Oliver Schroeder has created a server for multiplayer flightgear use.
60The server acts as a packet forwarding mechanism. When it
61receives a packet, it sends it to all other active players
62in the vicinity (the server is configured to use 100nm by default).
63
64Check out the server homepage <http://www.o-schroeder.de/fg_server/>
65for the current status. You can either download the server for
66some local use, or join the developers flying at the existing servers.
67As with flightgear, the server is free software, released under GPL.
68
69Pigeon <http://pigeond.net> has created a web page monitoring
70two such servers, showing the traffic in a Google map environment.
71See <http://pigeond.net/flightgear/fg_server_map.html>.
72
73Options needed to enable multiplayer game with a server:
74Player1:
75--multiplay=out,10,serveraddress,5000 --multiplay=in,10,myaddress,5000
76--callsign=player1
77
78Player2:
79--multiplay=out,10,serveraddress,5000 --multiplay=in,10,myaddress,5000
80--callsign=player2
81
82...
83
84PlayerN:
85--multiplay=out,10,serveraddress,5000 --multiplay=in,10,myaddress,5000
86--callsign=playerN
87
88Note that if every player using a particular server, such as one of those
89listed on the Pigeon's page, needs to have a unique callsign, not
90already in use on that server.
91
92If you are sitting behind a NAT'ting firewall, then you need to forward
93the incoming traffic on the firewall outer (visible to the internet)
94address arriving at the UDP port you use (5000 in the case above)
95over to your private LAN address. In this case, use your PRIVATE LAN address
96as <myaddress>. Example (if your private LAN address is 10.0.0.1,
97in order to play on pigeond.net):
98
99fgfs --multiplay=in,10,10.0.0.1,5000 --multiplay=out,10,pigeond.net,5000
100	--callsign=...UNIQUE callsign here...
101
102If you and the server are in the same address space (i.e., both have a public
103IP address or both are on the same private LAN), you hopefully don't need to
104mess with any firewalls.
105
106If you don't see other players playing on the same server in your flightgear,
107check that you have followed the above router configuration guidelines.  Check
108that you don't have any LOCAL firewall running on your computer preventing the
109flightgear network traffic flow.
110
111Finally, use ethereal(1) or tethereal(1) to capture the UDP traffic on the port
112that you are using, and see if you observe both incoming and outgoing packets.
113
114It's a good idea to talk to the IRC channel #flightgear on irc.flightgear.org
115while flying on one of the public servers. Also, it makes sense for every user
116on the same server to use the same weather setup, e.g., the real weather
117METAR feed, selected by setting to true the real-world-weather-fetch and
118control-fdm-atmosphere properties.
119
120Further reading (a must if you have a problem):
121-----------------------------------------------
122[1] The flightgear server homepage <http://fgms.sourceforge.net/>
123[2] The wiki howto <http://wiki.flightgear.org/index.php/Howto:_Multiplayer>
124[3] If everything else fails, ask for help on
125the IRC channel #flightgear on irc.flightgear.org
126

README.multiscreen

1The Open Scene Graph library, which current FlightGear uses for its 3D
2graphics, provides excellent support for multiple views of a
3scene. FlightGear uses the osgViewer::Viewer class, which implements a
4"master" camera with "slave" cameras that are offset from the master's
5position and orientation. FlightGear provides the "camera group"
6abstraction which allows the configuration of slave cameras via the
7property tree.
8
9Slave cameras can be mapped to windows that are open on different
10screens, or all in one window, or a combination of those two schemes,
11according to the video hardware capabilities of a machine. It is not
12advisable to open more than one window on a single graphics card due
13to the added cost of OpenGL context switching between the
14windows. Usually, multiple monitors attached to a single graphics card
15are mapped to different pieces of the same desktop, so a window can be
16opened that spans all the monitors. This is implemented by Nvidia's
17TwinView technology and the Matrox TripleHead2Go hardware.
18
19The camera group is configured by the /sim/rendering/camera-group node
20in the property tree. It can be set up by, among other things, XML in
21preferences.xml or in an XML file specified on the command line with
22the --config option.
23
24Here are the XML tags for defining camera groups.
25
26camera-group
27For the moment there can be only one camera group. It can contain
28window, camera, or gui tags.
29
30 window
31 A window defines a graphics window. It can be at the camera-group
32 level or defined within a camera. The window contains these tags:
33
34  name - string
35  The name of the window which might be displayed in the window's
36  title bar. It is also used to refer to a previously defined
37  window. A window can contain just a name node, in which case
38  the whole window definition refers to a previously defined window.
39
40  host-name - string
41  The name of the host on which the window is opened. Usually this is
42  empty.
43
44  display - int
45  The display number on which the window is opened.
46
47  screen - int
48  The screen number on which the window is opened.
49
50  x, y - int
51  The location on the screen at which the window is opened. This is in
52  the window system coordinates, which usually puts 0,0 at the upper
53  left of the screen XXX check this for Windows.
54
55  width, height - int
56  The dimensions of the window.
57
58  decoration - bool
59  Whether the window manager should decorate the window.
60
61  fullscreen - bool
62  Shorthand for a window that occupies the entire screen with no
63  decoration.
64
65  overrideRedirect - bool
66  Only effective when fullscreen = true.
67  Provides an extra hint for Gnome-based linux systems that we insist that
68  the full screen window span *all* physical displays, not just the current
69  physical display.
70
71 camera
72 The camera node contains viewing parameters.
73
74  window
75  This specifies the window which displays the camera. Either it
76  contains just a name that refers to a previous window definition, or
77  it is a full window definition.
78
79  viewport
80  The viewport positions a camera within a window. It is most useful
81  when several cameras share a window.
82
83   x, y - int
84   The position of the lower left corner of the viewport, in y-up
85   coordinates.
86
87   width, height - int
88   The dimensions of the viewport
89
90  view
91  The view node specifies the origin and direction of the camera in
92  relation to the whole camera group. The coordinate system is +y up,
93  -z forward in the direction of the camera group view. This is the
94  same as the OpenGL viewing coordinates.
95
96   x,y,z - double
97   Coordinates of the view origin.
98
99   heading-deg, pitch-deg, roll-deg - double
100   Orientation of the view in degrees. These are specified using the
101   right-hand rule, so a positive heading turns the view to the left,
102   a positive roll rolls the view to the left.
103
104  perspective
105  This node is one way of specifying the viewing volume camera
106  parameters. It corresponds to the OpenGL gluPerspective function.
107
108   fovy-deg - double
109   The vertical field-of-view
110
111   aspect-ratio - double
112   Aspect ratio of camera rectangle (not the ratio between the
113   vertical and horizontal fields of view).
114
115   near, far - double
116   The near and far planes, in meters from the camera eye point. Note
117   that FlightGear assumes that the far plane is far away, currently
118   120km. The far plane specified here will be respected, but the sky
119   and other background elements may not be drawn if the view plane is
120   closer than 120km.
121
122   offset-x, offset-y - double
123   Offsets of the viewing volume specified by the other parameters in
124   the near plane, in meters.
125
126  frustum
127  This specifies the perspective viewing volume using values for the near
128  and far planes and coordinates of the viewing rectangle in the near
129  plane.
130
131   left, bottom - double
132   right, top - double
133   The coordinates of the viewing rectangle.
134
135   near, far - double
136   The near and far planes, in meters from the camera eye point.
137
138  ortho
139  This specifies an orthographic view. The parameters are the sames as
140  the frustum node's.
141
142 gui
143 This is a special camera node that displays the 2D GUI.
144
145  viewport
146  This specifies the position and dimensions of the GUI within a
147  window, *however* at the moment the origin must be at 0,0.
148
149Here's an example that uses a single window mapped across 3
150displays. The displays are in a video wall configuration in a
151horizontal row.
152
153<PropertyList>
154  <sim>
155    <rendering>
156      <camera-group>
157        <window>
158          <name>wide</name>
159          <host-name type="string"></host-name>
160          <display>0</display>
161          <screen>0</screen>
162          <width>3840</width>
163          <height>1024</height>
164          <decoration type = "bool">false</decoration>
165        </window>
166        <camera>
167          <window>
168            <name>wide</name>
169          </window>
170          <viewport>
171            <x>0</x>
172            <y>0</y>
173            <width>1280</width>
174            <height>1024</height>
175          </viewport>
176          <view>
177            <heading-deg type = "double">0</heading-deg>
178          </view>
179          <frustum>
180            <top>0.133</top>
181            <bottom>-0.133</bottom>
182            <left>-.5004</left>
183            <right>-.1668</right>
184            <near>0.4</near>
185            <far>120000.0</far>
186          </frustum>
187        </camera>
188        <camera>
189          <window>
190            <name type="string">wide</name>
191          </window>
192          <viewport>
193            <x>1280</x>
194            <y>0</y>
195            <width>1280</width>
196            <height>1024</height>
197          </viewport>
198          <view>
199            <heading-deg type = "double">0</heading-deg>
200          </view>
201          <frustum>
202            <top>0.133</top>
203            <bottom>-0.133</bottom>
204            <left>-.1668</left>
205            <right>.1668</right>
206            <near>0.4</near>
207            <far>120000.0</far>
208          </frustum>
209        </camera>
210        <camera>
211          <window>
212            <name>wide</name>
213          </window>
214          <viewport>
215            <x>2560</x>
216            <y>0</y>
217            <width>1280</width>
218            <height>1024</height>
219          </viewport>
220          <view>
221            <heading-deg type = "double">0</heading-deg>
222          </view>
223          <frustum>
224            <top>0.133</top>
225            <bottom>-0.133</bottom>
226            <left>.1668</left>
227            <right>.5004</right>
228            <near>0.4</near>
229            <far>120000.0</far>
230          </frustum>
231        </camera>
232        <gui>
233          <window>
234            <name type="string">wide</name>
235          </window>
236        </gui>
237      </camera-group>
238    </rendering>
239  </sim>
240</PropertyList>
241
242Here's a complete example that uses a seperate window on each
243display. The displays are arranged in a shallow arc with the left and
244right displays at a 45.3 degree angle to the center display because,
245at the assumed screen dimensions, the horizontal field of view of one
246display is 45.3 degrees. Each camera has its own window definition;
247the center window is given the name "main" so that the GUI definition
248can refer to it.  Note that the borders of the displays are not
249accounted for.
250
251<PropertyList>
252  <sim>
253    <rendering>
254      <camera-group>
255        <camera>
256          <window>
257            <host-name type="string"></host-name>
258            <display>0</display>
259            <screen>0</screen>
260            <fullscreen type = "bool">true</fullscreen>
261          </window>
262          <view>
263            <heading-deg type = "double">45.3</heading-deg>
264          </view>
265          <frustum>
266            <top>0.133</top>
267            <bottom>-0.133</bottom>
268            <left>-.1668</left>
269            <right>.1668</right>
270            <near>0.4</near>
271            <far>120000.0</far>
272          </frustum>
273        </camera>
274        <camera>
275          <window>
276            <name type="string">main</name>
277            <host-name type="string"></host-name>
278            <display>0</display>
279            <screen>1</screen>
280            <fullscreen type = "bool">true</fullscreen>
281          </window>
282          <view>
283            <heading-deg type = "double">0</heading-deg>
284          </view>
285          <frustum>
286            <top>0.133</top>
287            <bottom>-0.133</bottom>
288            <left>-.1668</left>
289            <right>.1668</right>
290            <near>0.4</near>
291            <far>120000.0</far>
292          </frustum>
293        </camera>
294        <camera>
295          <window>
296            <host-name type="string"></host-name>
297            <display>0</display>
298            <screen>2</screen>
299            <fullscreen type = "bool">true</fullscreen>
300          </window>
301          <view>
302            <heading-deg type = "double">-45.3</heading-deg>
303          </view>
304          <frustum>
305            <top>0.133</top>
306            <bottom>-0.133</bottom>
307            <left>-.1668</left>
308            <right>.1668</right>
309            <near>0.4</near>
310            <far>120000.0</far>
311          </frustum>
312        </camera>
313        <gui>
314          <window>
315            <name type="string">main</name>
316          </window>
317        </gui>
318      </camera-group>
319    </rendering>
320  </sim>
321</PropertyList>
322

README.osgtext

1This document describes the syntax for text objects in the scene graph.
2Text nodes are configured using XML and may appear within a model description
3file, like other models or the particlesystem.
4
5For the anxious reader, here is a complete example of a text node:
6
7<!-- Must be enclosed by a <text/> node
8<text>
9  <!-- It should have a name. Can be used for other animations -->
10  <name>My first Text</name>
11  <!-- Use offsets for the initial placement -->
12  <offsets>
13    <pitch-deg>0</pitch-deg>
14    <heading-deg>0</heading-deg>
15    <roll-deg>0</roll-deg>
16    <x-m>0</x-m>
17    <y-m>0</y-m>
18    <z-m>0</z-m>
19  </offsets>
20
21  <!-- instead of using pitch/heading/roll offset, one may use
22       axis-alignment -->
23  <!-- remember: x backwards, y right and z up -->
24  <axis-alignment>xy-plane</axis-alignment>
25  <!--
26  <axis-alignment>reversed-xy-plane</axis-alignment>
27  <axis-alignment>xz-plane</axis-alignment>
28  <axis-alignment>reversed-xz-plane</axis-alignment>
29  <axis-alignment>yz-plane</axis-alignment>
30  <axis-alignment>reversed-yz-plane</axis-alignment>
31  <axis-alignment>screen</axis-alignment>
32  -->
33
34  <!-- what type of text to draw, use on of literal, text-value or number-value -->
35  <!-- A simple constant, never changing string -->
36  <type type="string">literal</type>
37  <text type="string">Hello, world!</text>
38
39  <!-- The string value of a property -->
40  <type type="string">text-value</type>
41  <property type="string">some/property</property>
42  <format type="string">%s</format> <!-- the printf() format to display the value -->
43
44  <!-- A number from a property -->
45  <type type="string">number-value</type>
46  <property type="string">position/latitude-deg</property>
47  <factor type="double">1.0</factor> <!-- optional, scale the propertie's value -->
48  <offset type="double">0.0</offset> <!-- optional, shift the propertie's value -->
49  <format type="string">%5.2lf</format> <!-- printf() format to display -->
50  <truncate type="bool">false</truncate> <!-- truncate to an integer value -->
51
52  <layout>left-to-right</layout> <!-- default -->
53  <!--
54  <layout>right-to-left</layout>
55  <layout>vertical</layout>
56  -->
57
58  <draw-text type="bool">true</draw-text> <!-- draw the text itself -->
59  <draw-alignment type="bool">false</draw-alignment> <!-- draw crosshair at object center -->
60  <draw-boundingbox type="bool">false</draw-boundingbox> <!-- draw a bounding box -->
61
62  <font>led.txf</font> <!-- The font file name, relative to data/Fonts -->
63  <character-size type="double">0.01</character-size> <!-- size (height) im meters -->
64  <character-aspect-ratio type="double">1.0</character-aspect-ratio>
65  <max-height>0.012</max-height> <!-- the maximum height of the text -->
66  <max-width>0.040</max-width> <!-- the maximum width of the text -->
67  <font-resolution>
68    <width type="int">32</width>
69    <height type="int">32</height>
70  </font-resolution>
71
72  <!-- chose one of the kerning types or omit for default -->
73  <kerning>default</kerning>
74  <!--
75  <kerning>unfitted</kerning>
76  <kerning>none</kerning>
77  -->
78
79  <alignment>center-center</alignment> <!-- alignment of the text itself -->
80  <!-- possible values are
81  <alignment>left-top</alignment>
82  <alignment>left-center</alignment>
83  <alignment>left-bottom</alignment>
84  <alignment>center-top</alignment>
85  <alignment>center-center</alignment>
86  <alignment>center-bottom</alignment>
87  <alignment>right-top</alignment>
88  <alignment>right-center</alignment>
89  <alignment>right-bottom</alignment>
90  <alignment>left-baseline</alignment>
91  <alignment>center-baseline</alignment>
92  <alignment>right-baseline</alignment>
93  <alignment>baseline</alignment>
94  -->
95
96</text>
97
98The <text/> node may appear within <model/> or <PropertyList/> nodes. If you place
99your text directly within your model file, use <text></text> nodes. You can also put
100your <text> configuration into a separate file using the well known include directive:
101
102Your model.xml file:
103<model>
104  <path>may-fancy-model.ac</path>
105  <text include="HelloWorld.xml"/>
106</model>
107
108Your HelloWorld.xml:
109<PropertyList>
110  <name>Hello World</name>
111  <font>Helvetica.txf</font>
112  <type type="string">literal</type>
113  <text type="string">Hello, world!</text>
114  <!-- etc. - you get the idea -->
115</PropertyList>
116
117Animation can be applied to text nodes like any other object. To give your text some
118color, use the material animation, or translate, rotate, scale or spin your text as
119you like.
120

README.properties

1================================================================================
2CONTROLS
3================================================================================
4
5Flight Controls
6---------------
7/controls/flight/aileron
8/controls/flight/aileron-trim
9/controls/flight/elevator
10/controls/flight/elevator-trim
11/controls/flight/rudder
12/controls/flight/rudder-trim
13/controls/flight/flaps
14/controls/flight/slats
15/controls/flight/BLC			// Boundary Layer Control
16/controls/flight/spoilers
17/controls/flight/speedbrake
18/controls/flight/wing-sweep
19/controls/flight/wing-fold
20/controls/flight/drag-chute
21
22Engines
23-------
24/controls/engines/throttle_idle
25/controls/engines/engine[%d]/throttle
26/controls/engines/engine[%d]/starter
27/controls/engines/engine[%d]/fuel-pump
28/controls/engines/engine[%d]/fire-switch
29/controls/engines/engine[%d]/fire-bottle-discharge
30/controls/engines/engine[%d]/cutoff
31/controls/engines/engine[%d]/mixture
32/controls/engines/engine[%d]/propeller-pitch
33/controls/engines/engine[%d]/magnetos
34/controls/engines/engine[%d]/boost
35/controls/engines/engine[%d]/WEP
36/controls/engines/engine[%d]/cowl-flaps-norm
37/controls/engines/engine[%d]/feather
38/controls/engines/engine[%d]/ignition
39/controls/engines/engine[%d]/augmentation
40/controls/engines/engine[%d]/afterburner
41/controls/engines/engine[%d]/reverser
42/controls/engines/engine[%d]/water-injection
43/controls/engines/engine[%d]/condition
44
45Fuel
46----
47/controls/fuel/dump-valve
48/controls/fuel/tank[%d]/fuel_selector
49/controls/fuel/tank[%d]/to_engine
50/controls/fuel/tank[%d]/to_tank
51/controls/fuel/tank[%d]/boost-pump[%d]
52
53/consumables/fuel/tank[%d]/level-lbs
54/consumables/fuel/tank[%d]/level-gal_us
55/consumables/fuel/tank[%d]/capacity-gal_us
56/consumables/fuel/tank[%d]/density-ppg
57/consumables/fuel/total-fuel-lbs
58/consumables/fuel/total-gal_us
59
60
61Gear
62----
63/controls/gear/brake-left
64/controls/gear/brake-right
65/controls/gear/brake-parking
66/controls/gear/steering
67/controls/gear/gear-down
68/controls/gear/antiskid
69/controls/gear/tailhook
70/controls/gear/tailwheel-lock
71/controls/gear/wheel[%d]/alternate-extension
72
73Anti-Ice
74--------
75/controls/anti-ice/wing-heat
76/controls/anti-ice/pitot-heat
77/controls/anti-ice/wiper
78/controls/anti-ice/window-heat
79/controls/anti-ice/engine[%d]/carb-heat
80/controls/anti-ice/engine[%d]/inlet-heat
81
82Hydraulics
83----------
84/controls/hydraulic/system[%d]/engine-pump
85/controls/hydraulic/system[%d]/electric-pump
86
87Electric
88--------
89/controls/electric/battery-switch
90/controls/electric/external-power
91/controls/electric/APU-generator
92/controls/electric/engine[%d]/generator
93/controls/electric/engine[%d]/bus-tie
94
95Pneumatic
96---------
97/controls/pneumatic/APU-bleed
98/controls/pneumatic/engine[%d]/bleed
99
100Pressurization
101--------------
102/controls/pressurization/mode
103/controls/pressurization/dump
104/controls/pressurization/outflow-valve
105/controls/pressurization/pack[%d]/pack-on
106
107Lights
108------
109/controls/lighting/landing-lights
110/controls/lighting/turn-off-lights
111/controls/lighting/formation-lights
112/controls/lighting/taxi-light
113/controls/lighting/logo-lights
114/controls/lighting/nav-lights
115/controls/lighting/beacon
116/controls/lighting/strobe
117/controls/lighting/panel-norm
118/controls/lighting/instruments-norm
119/controls/lighting/dome-norm
120
121Armament
122--------
123/controls/armament/master-arm
124/controls/armament/station-select
125/controls/armament/release-all
126/controls/armament/station[%d]/stick-size
127/controls/armament/station[%d]/release-stick
128/controls/armament/station[%d]/release-all
129/controls/armament/station[%d]/jettison-all
130
131Seat
132----
133/controls/seat/vertical-adjust
134/controls/seat/fore-aft-adjust
135/controls/seat/cmd_selector_valve
136/controls/seat/eject[%d]/initiate
137/controls/seat/eject[%d]/status
138
139APU
140---
141/controls/APU/off-start-run
142/controls/APU/fire-switch
143
144Autoflight
145----------
146/controls/autoflight/autopilot[%d]/engage
147/controls/autoflight/autothrottle-arm
148/controls/autoflight/autothrottle-engage
149/controls/autoflight/heading-select
150/controls/autoflight/altitude-select
151/controls/autoflight/bank-angle-select
152/controls/autoflight/vertical-speed-select
153/controls/autoflight/speed-select
154/controls/autoflight/mach-select
155/controls/autoflight/vertical-mode
156/controls/autoflight/lateral-mode
157
158================================================================================
159FDM (Aircraft settings)
160================================================================================
161
162Position
163---------------
164/position/latitude-deg
165/position/longitude-deg
166/position/altitude-ft
167
168Orientation
169-----------
170/orientation/roll-deg
171/orientation/pitch-deg
172/orientation/heading-deg
173
174/orientation/roll-rate-degps
175/orientation/pitch-rate-degps
176/orientation/yaw-rate-degps
177
178/orientation/side-slip-rad
179/orientation/side-slip-deg
180/orientation/alpha-deg
181
182Velocities
183----------
184/velocities/airspeed-kt
185/velocities/mach
186/velocities/speed-north-fps
187/velocities/speed-east-fps
188/velocities/speed-down-fps
189
190/velocities/uBody-fps
191/velocities/vBody-fps
192/velocities/wBody-fps
193
194/velocities/vertical-speed-fps
195/velocities/glideslope
196
197Acceleration
198------------
199/accelerations/nlf
200
201/accelerations/ned/north-accel-fps_sec
202/accelerations/ned/east-accel-fps_sec
203/accelerations/ned/down-accel-fps_sec
204
205/accelerations/pilot/x-accel-fps_sec
206/accelerations/pilot/y-accel-fps_sec
207/accelerations/pilot/z-accel-fps_sec
208
209Engines
210-------
211
212common:
213/engines/engine[%d]/fuel-flow-gph
214/engines/engine[%d]/fuel-flow_pph
215/engines/engine[%d]/thrust_lb
216/engines/engine[%d]/running
217/engines/engine[%d]/starter
218/engines/engine[%d]/cranking
219
220piston:
221/engines/engine[%d]/mp-osi
222/engines/engine[%d]/egt-degf
223/engines/engine[%d]/oil-temperature-degf
224/engines/engine[%d]/oil-pressure-psi
225/engines/engine[%d]/cht-degf
226/engines/engine[%d]/rpm
227
228turbine:
229/engines/engine[%d]/n1
230/engines/engine[%d]/n2
231/engines/engine[%d]/epr
232/engines/engine[%d]/augmentation
233/engines/engine[%d]/water-injection
234/engines/engine[%d]/ignition
235/engines/engine[%d]/nozzle-pos-norm
236/engines/engine[%d]/inlet-pos-norm
237/engines/engine[%d]/reversed
238/engines/engine[%d]/cutoff
239
240propeller:
241/engines/engine[%d]/rpm
242/engines/engine[%d]/pitch
243/engines/engine[%d]/torque
244
245
246================================================================================
247LIGHT
248================================================================================
249/sim/time/sun-angle-rad
250/rendering/scene/ambient/red
251/rendering/scene/ambient/ggreen
252/rendering/scene/ambient/blue
253/rendering/scene/diffuse/red
254/rendering/scene/diffuse/green
255/rendering/scene/diffuse/blue
256/rendering/scene/specular/red
257/rendering/scene/specular/green
258/rendering/scene/specular/blue
259

README.protocol

1The generic communication protocol for FlightGear provides a powerful way
2of adding a simple ASCII based or binary input/output protocol, just by
3defining an XML encoded configuration file and placing it in the
4$FG_ROOT/Protocol/ directory.
5
6
7
8
9== file layout ================================================================
10
11A protocol file can contain either or both of <input> and <output>
12definition blocks. Which one is used depends on how the protocol
13is called  (e.g. --generic=file,out,1,/tmp/data.xml,myproto would
14only use the <output> definitions block).
15
16  <?xml version="1.0"?>
17  <PropertyList>
18      <generic>
19
20          <output>
21              <binary_mode>false</binary_mode>
22              <line_separator></line_separator>
23              <var_separator></var_separator>
24              <preamble></preamble>
25              <postamble></postamble>
26
27              <chunk>
28                      ... first chunk spec ...
29              </chunk>
30
31              <chunk>
32                      ... another chunk etc. ...
33              </chunk>
34          </output>
35
36          <input>
37              <line_separator></line_separator>
38              <var_separator></var_separator>
39
40              <chunk>
41                      ... chunk spec ...
42              </chunk>
43          </input>
44
45      </generic>
46  </PropertyList>
47
48
49
50
51== input/output parameters ====================================================
52
53Both <output> and <input> blocks can contain information about
54the data mode (ascii/binary) and about separators between fields
55and data sets, as well as a list of <chunk>s. Each <chunk> defines
56a property that should be written (and how), or a variable and which
57property it should be written to.
58
59--- ASCII protocol parameters ---
60
61output only:
62  <preamble>        STRING  default: ""    file header put on top of the file
63  <postamble>       STRING  default: ""    file footer put at the end of the file
64
65input & output:
66  <binary_mode>	    BOOL    default: false (= ASCII mode)
67  <var_separator>   STRING  default: ""    field separator
68  <line_separator>  STRING  default: ""    separator between data sets
69
70
71<var_separator> are put between every two output properties, while
72<line_separator> is put at the end of each data set. Both can contain
73arbitrary strings or one of the following keywords:
74
75  Name             Character
76
77  newline          '\n'
78  tab              '\t'
79  formfeed         '\f'
80  carriagereturn   '\r'
81  verticaltab      '\v'
82
83
84Typical use could be:
85
86  <var_separator>tab</var_separator>
87  <line_separator>newline</var_separator>
88
89or
90
91  <var_separator>\t</var_separator>
92  <line_separator>\r\n</line_separator>
93
94
95--- Binary protocol parameters ---
96
97To enable binary mode, simply include a <binary_mode>true</binary_mode> tag in
98your XML file. The format of the binary output is tightly packed, with 1 byte
99for bool, 4 bytes for int, and 8 bytes for double. At this time, strings are not
100supported. A configurable footer at the end of each "line" or packet of binary
101output can be added using the <binary_footer> tag. Options include the length
102of the packet, a magic number to simplify decoding. Examples:
103
104  <binary_footer>magic,0x12345678</binary_footer>
105  <binary_footer>length</binary_footer>
106  <binary_footer>none</binary_footer>                 <!-- default -->
107
108
109
110
111== variable parameters (chunk spec) ===========================================
112
113Both <input> and <output> block can contain a list of <chunk> specs,
114each of which describes the properties of on variable to write/read.
115
116
117  <name>        for ease of use (not tranferred)
118  <node>        the property tree node which provides the data
119  <type>        the value type (needed for formatting)
120                one of string, float, bool, int (default: int)
121  <format>      (ASCII protocol only, not used or needed in binary mode)
122                defines the actual piece of text which should be sent.
123                it can include "printf" style formatting options like:
124                                <type>
125                        %s      string
126                        %d      integer (default)
127                        %f      float
128
129  <factor>      an optional multiplication factor which can be used for
130                unit conversion. (for example, radians to degrees).
131  <offset>      an optional offset which can be used for unit conversion.
132                (for example, degrees Celcius to degrees Fahrenheit).
133
134
135Chunks can also consist of a single constant <format>, like in:
136  <format>Data Section</format>
137
138
139== examples ===================================================================
140
141Writes log of this form:
142
143V=16
144H=3.590505
145P=3.59
146V=12
147H=3.589020
148P=3.59
149
150
151
152<?xml version="1.0"?>
153
154<PropertyList>
155  <generic>
156
157    <output>
158      <line_separator>newline</line_separator>
159      <var_separator>newline</var_separator>
160      <binary_mode>false</binary_mode>
161
162      <chunk>
163        <name>speed</name>
164        <format>V=%d</format>
165        <node>/velocities/airspeed-kt</node>
166      </chunk>
167
168      <chunk>
169        <name>heading (rad)</name>
170        <format>H=%.6f</format>
171        <type>float</type>
172        <node>/orientation/heading-deg</node>
173        <factor>0.0174532925199433</factor>  <!-- degrees to radians -->
174      </chunk>
175
176      <chunk>
177        <name>pitch angle (deg)</name>
178        <format>P=%03.2f</format>
179        <node>/orientation/pitch-deg</node>
180      </chunk>
181   </output>
182
183 </generic>
184</PropertyList>
185
186
187
188
189-- writing data in XML syntax -------------------------------------------------
190
191Assuming the file is called $FG_ROOT/Protocol/xmltest.xml, then it could be
192used as   $ fgfs --generic=file,out,1,/tmp/data.xml,xmltest
193
194
195<?xml version="1.0"?>
196
197<PropertyList>
198  <generic>
199    <output>
200      <binary_mode>false</binary_mode>
201      <var_separator>\n</var_separator>
202      <line_separator>\n</line_separator>
203      <preamble>&lt;?xml version="1.0"?&gt;\n\n&lt;data&gt;\n</preamble>
204      <postamble>&lt;/data&gt;\n</postamble>
205
206      <chunk>
207        <format>\t&lt;set&gt;</format>
208      </chunk>
209
210      <chunk>
211        <node>/position/altitude-ft</node>
212        <type>float</type>
213        <format>\t\t&lt;altitude-ft&gt;%.8f&lt;/altitude-ft&gt;</format>
214      </chunk>
215
216      <chunk>
217        <node>/velocities/airspeed-kt</node>
218        <type>float</type>
219        <format>\t\t&lt;airspeed-kt&gt;%.8f&lt;/airspeed-kt&gt;</format>
220      </chunk>
221
222      <chunk>
223        <format>\t&lt;/set&gt;</format>
224      </chunk>
225    </output>
226  </generic>
227</PropertyList>
228
229
230-- Analyzing the resulting binary packet format -------------------------------
231
232A utility called generic-protocol-analyse can be found under
233FlightGear/utils/xmlgrep which can be used to analyze the resulting
234data packet for the binary protocol.
235
236The output would be something like:
237
238bintest.xml
239Generic binary output protocol packet description:
240
241 pos | size |  type  | factor     | description
242-----|------|--------|------------|------------------------
243   0 |    4 |    int |            | indicated speed (kt)
244   4 |    4 |  float |            | pitch att (deg)
245   8 |    4 |  float |            | magnetic heading (deg)
246  12 |    4 |    int |            | outside air temperarure (degF)
247  16 |    1 |   bool |            | autocoord
248
249total package size: 17 bytes
250
251

README.scenery

1This document describes how FlightGear searches and loads scenery, how to
2add static objects to the scenery as well as the syntax of *.stg files.
3
4
5
6
7Contents ----------------------------------------------------------------------
8
91  scenery path
102  terrasync
11
123  stg files
13   3.1  OBJECT_BASE
14   3.2  OBJECT
15   3.4  OBJECT_SHARED / OBJECT_SHARED_AGL
16   3.3  OBJECT_STATIC / OBJECT_STATIC_AGL
17   3.5  OBJECT_SIGN /OBJECT_SIGN_AGL
18   3.6  BUILDING_ROUGH / BUILDING_DETAILED
19   3.7  ROAD_ROUGH / ROAD_DETAILED
20   3.8  RAILWAY_ROUGH / RAILWAY_DETAILED
21   3.9  BUILDING_LIST
22
234  model manager ("/models/model")
24   4.1  static objects
25   4.2  dynamic objects
26   4.3  loading/unloading at runtime
27
285  tools for object placing
29   5.1  calc-tile.pl
30   5.2  ufo scenery object editor
31
326  embedded Nasal
33   6.1  static models
34   6.2  AI models
35
36
37
38
391 scenery path ----------------------------------------------------------------
40
41FlightGear loads scenery by default from the Scenery/ subdirectory of its
42data directory. The path to this data directory can be set via environment
43variable FG_ROOT or the --fg-root option. The scenery path can be set
44independently via environment variable FG_SCENERY or option --fg-scenery.
45The order of precedence is as follows:
46
47  --fg-scenery=/some/dir         ... highest priority
48  $FG_SCENERY
49  $FG_ROOT/Scenery/              ... lowest priority
50
51
52A scenery specification may be a list of paths, separated by the OS-specific
53path separator (colon on Unix/OSX, semicolon on MS Windows). The paths are
54searched in the order from left to right:
55
56  FG_SCENERY=/first/dir:/second/dir:/third/dir
57                                     (likewise with --fg-scenery option)
58
59Each of the scenery paths normally contains a set of directories, each containing
60a particular scenery type :
61
62 Terrain/ containing the terrain mesh and airport data
63 Objects/ containing placed scenery objects such as large landmarks, bridges
64 Pylons/  containing electricity pylon Models
65 Roads/   containing detailed road and railways
66 Buildings/ containing osm2city-generated buildings
67
68The user can control at runtime which of these directories is actually loaded
69via the property tree:
70/sim/rendering/scenery-path-suffix[n]/name      defines the name of the sub-directory
71/sim/rendering/scenery-path-suffix[n]/enabled   indicates whether it is loaded.
72
73hese properties are typically set in the Rendering Options menu.
74
75In turn each of these contains a tree of directories breaking down the world into
7610x10 degree and then 1x1 degree chunks.  E.g. Terrain/w130n30/w123n37/
77
78For backwards compatibility reasons, the top level can alternatively just
79contain 10x10 degree directories.  E.g. w130n30/w123n37/
80
81Note that as soon as any of the scenery-path-suffix directories is found, any
8210x10 directory on the same hierarchy level will be ignored!
83
84This example shows which directories are used to search for scenery:
85
86  $ ls /first/dir
87  w130n30/                   searched
88
89  $ ls /second/dir
90  Objects/                   searched
91  Terrain/                   searched
92  w130n30/                   *not* searched
93
94  $ ls /third/dir
95  Terrain/                   searched
96  w130n30/                   *not* searched
97
98
99Within the 1x1 degree chunks, the ground is further broken up into "tiles" of
100approx 20x20km. If FlightGear searches for a particular "tile" file, let's say for
101"w130n30/w123n37/942050.stg", then (using the above examples) it looks
102into
103
104  /first/dir/w130n30/w123n37/942050.stg             (A)
105
106  /second/dir/Terrain/w130n30/w123n37/942050.stg      (B)\__ same path element
107  /second/dir/Objects/w130n30/w123n37/942050.stg      (C)/      /second/dir
108  /second/dir/Pylons/w130n30/w123n37/942050.stg       (D)/
109  /second/dir/Roads/w130n30/w123n37/942050.stg        (E)/
110  /second/dir/Buildings/w130n30/w123n37/942050.stg    (F)/
111
112  /third/dir/Terrain/w130n30/w123n37/942050.stg       (G)
113
114As soon as it finds an OBJECT_BASE entry it only finishes this
115path element and then stops scanning. So, if (B) contains an entry
116"OBJECT_BASE 942050.btg, then the other directories in /second/dir (C, D, E, F)
117will be read.  But (G) will *not*!
118
119This searching behavior is usually used to collect user-downloaded scenery first,
120then to read automatically downloaded scenery (see terrasync
121below), then standard scenery and objects that came with the distribution.
122So a typical scenery path specification could look like this:
123
124  FG_SCENERY=$HOME/.fgfs/Scenery:$HOME/.fgfs/TerraSync:$FG_ROOT/Scenery
125
126The first path would then be populated by the user with unpacked scenery
127archives downloaded various sources.
128
129Using a private directory for downloaded add-on scenery and adding
130that path to FG_SCENERY is the preferred way. This separates default
131data from locally added data, and makes administration and later updates
132easier.
133
134HINT: if you want to see where FlightGear is searching and finding
135terrain/objects, start it with the --log-level=info option.
136
1372 terrasync -------------------------------------------------------------------
138
139FlightGear can download scenery on-the-fly.  Simply select "Download scenery
140automatically" from the launcher, or use --enable-terrasync from the commandline.
141By default this will add $HOME/.fgfs/TerraSync to the scenery path.
142
143Note, however, that if it downloads scenery for the area around your
144starting location, then you'll only see that after the next start, or
145after you flew or teleported to a distant location and then back.
146
1472.1 .dirindex -----------------------------------------------------------------
148
149To save having to download scenery every time, while allowing updates to
150propagate, terrasync checks for a .dirindex file each time it downloads a
151directory from the server.  This lists files, directories and tarballs that
152should be present in the local directory, along with their size and a sha1sum
153of their contents.  This sha1sum is checked against the local files to
154determine which files are to be downloaded.
155
156The format of the .dirindex is as follows:
157
158version:<version>
159path:<scenery_path>
160<type>:<filename>:<sha1sum>:<size>
161<type>:<filename>:<sha1sum>:<size>
162<type>:<filename>:<sha1sum>:<size>
163.
164.
165.
166
167Where:
168
169<version> is the .dirindex version number
170<scenery_path>  is the path of the current file, e.g. Objects/w010n50/w009n57
171<type>  is the file type - "f" for file, "d" for directory, "t" for tarball
172<filename> is the file name  (e.g. 2811121.stg)
173<sha1sum>  is the sha1sum of the file named (e.g. 9da6ebc1695ed1c3b151cd34263e9c931ee309ea)
174<size>     is the size of the file
175
176Tarballs (labelled with a "t" in the .dirindex) must be <name>.tgz files which
177unpack into a <name>/ sub-directory.  This enables terrasync to clean up
178out of date files by simply deleting the <name>/ subdirectory before unpacking
179the updated file.
180
1813 stg files -------------------------------------------------------------------
182
183stg files ("static terragear") define the static elements of a scenery
184"tile", including the terrain elevation data, airport geometry, and all
185static objects placed on this tile. (See section 5 for how to find out which
186geo coordinates belong to which tile.) Four of the available key words
187are followed by a string and four numbers. The meaning of these numbers
188is always the same and described in section 3.3.
189
1903.1  OBJECT_BASE
191----------------
192
193specifies the terrain elevation data file. These files are generated with
194the TerraGear tools (http://www.terragear.org/) and have file extension
195".btg" ("binary terragear"; there used to be an "*.atg" file, too, where
196the 'a' stood for ASCII).
197
198Example:
199
200  OBJECT_BASE 942050.btg
201
202The entry may be anywhere in the 942050.stg file, on a separate line.
203
2043.2  OBJECT
205-----------
206
207specifies an airport geometry 'drop-in' file. The scenery elevation file
208has cut out holes for airports, that are filled with such objects. They
209are usually called after the airport ICAO id:
210
211Example:
212
213  OBJECT KSFO.btg
214
215These files are, again, created by TerraGear tools and are usually gzipped,
216so you'll find that file stored as KSFO.btg.gz.
217
218
219
220
2213.3  OBJECT_SHARED / OBJECT_SHARED_AGL
222--------------------------------------
223
224add static object to the tile.
225
226Example:
227
228  OBJECT_SHARED Models/Airport/tower.xml -122.501090 37.514830 15.5 0.00 0.00 0.00
229
230Syntax:
231
232  OBJECT_SHARED <object-path> <lon> <lat> <elev-m> <hdg-deg> <pitch-deg> <roll-deg>
233
234The <object-path> is relative to the data directory (FG_ROOT).
235<elev-m> is in meter and relative to mean sea-level (in the fgfs world).
236<hdg-deg> is in degree, counter-clockwise with North being 0.0. Note
237that this differs from about every other place in FlightGear, most notably
238the /orientation/heading-deg entry in the property system, which is clockwise.
239<pitch-deg> and <roll-deg> are in degree and optional.
240OBJECT_SHARED models are cached and reused. They are only once in memory
241and never freed. (See also the next section.)
242
243OBJECT_SHARED_AGL places the object relative to the ground elevation.  Note that
244this is an expensive operation and is strongly discouraged.
245
2463.4  OBJECT_STATIC / OBJECT_STATIC_AGL
247--------------------------------------
248
249add static objects to the tile, just like OBJECT_SHARED. There are three
250differences to OBJECT_SHARED (apart from the name):
251
252(A) the path is relative to the tile directory where the *.stg file with
253    this entry is located. For example, relative to 130n30/w123n37/. This
254    usually means that all 3D object files, textures, and XML animation
255    files are in this tile directory, too.
256
257(B) these objects are *not* cached and kept loaded, but rather freed with
258    the tile (that is, when you leave that area).
259
260(C) the animation XML files may contain Nasal blocks <nasal><load> and
261    <nasal><unload> which are executed on loading/unloading.
262
263Example:
264
265  OBJECT_STATIC ggb-fb.xml -122.4760494 37.81876042 0 105 0.00 0.00
266
267
268OBJECT_STATIC_AGL places the object relative to the ground elevation.  Note that
269this is an expensive operation and is strongly discouraged.
270
271
2723.5 OBJECT_SIGN / OBJECT_SIGN_AGL
273---------------------------------
274
275defines taxiway or runway sign. The syntax is much like that of OBJECT_SHARED
276entries, except that the path is replaced with a sign contents specification
277and that there is an additional size value at the end of the line.
278
279Example:
280
281  OBJECT_SIGN {@R}10L-28R{@L}C -122.35797457 37.61276290 -0.5398 74.0 2
282
283The sign specification defines the sign contents. We try to resemble the
284apt.dat 850 specifications in our implementation.
285In the simplest form it contains just 'normal' text, for example:
286
287  EXIT
288
289This will create a black panel of 1m height with "EXIT" written on it
290in white versal letters. Actually, each of those characters are
291single-letter glyph names that are looked up in the <glyph> map of a
292texture font <material> entry in $FG_ROOT/materials.xml. It just
293happens that the <glyph> entry for <name> 'E' maps to a drawn 'E' in
294the font texture. This isn't true for all ASCII characters. Many aren't
295mapped at all (and thus not available), others are mapped to non-standard
296drawings. The '_', for example, is mapped to an empty black area and can
297therefore be used as a space. (The sign specification must not contain
298real spaces.) The '*' is mapped to a raised period.
299
300Some glyph names consist of more than one character, and can't, thus, be
301used directly. They have to be put in a pair of curly braces:
302
303  {^rd}
304
305This creates an arrow that points to the right and down. Braces can really
306contain a list of glyph names, separated by commas (no space!).
307Single-letter glyph names can be used that way, too, or in any mixture
308of both methods:
309
310  EXIT
311  {E,X,I,T}
312  {E}{X}{I}{T}
313  EX{I,T}
314  E{X,I}T{^lu,^rd}
315  {^u}EXIT{^u}
316
317
318Multi-letter glyph names are usually used for symbols. Arrow symbol names
319always start with a caret ("arrow head") and the left or right direction
320always comes first (like the x in a Cartesian coordinate system). Here's
321a list of some of the available names (see $FG_ROOT/materials.xml for
322more):
323
324
325  ^l       left arrow
326  ^r       right arrow
327  ^u       up arrow
328  ^d       down arrow
329  ^lu      left-up arrow
330  ^ld      left-down arrow
331  ^ru      right-up arrow
332  ^rd      right-down arrow
333  no-entry "no entry" symbol
334  critical runway critical area
335  safety   ils safety area
336  hazard   end of taxiway
337
338
339
340There are commands for pre-defined sign types according to the FAA
341specification (5345-44; see http://www.google.com/search?q=5345-44g).
342
343  @Y   "Direction, Destination, Boundary" sign (black on yellow)
344  @R   "Mandatory Instruction" sign (white on red with black outline)
345  @L   "Location" sign  (yellow text and frame on black)
346  @B   "Runway Distance Remaining" sign  (white on black)
347
348
349Examples:
350
351  {@R}10L-28R{@L}C
352  {@Y,^l}P|{^lu}N{@L}F{@Y}F{^ru}
353  {@Y,^ld}C   ...  same as any of {@Y}{@ld}C  {@Y,@ld,C}
354  {@B}17
355
356
357Syntax errors are reported in --log-level=debug, in the SG_TERRAIN
358group. You can use this command line to filter out such messages:
359
360  $ fgfs --log-level=debug 2>&1|grep OBJECT_SIGN
361
362OBJECT_SIGN_AGL places the sign relative to the ground elevation.  Note that
363this is an expensive operation and is strongly discouraged.
364
3653.6  BUILDING_ROUGH / BUILDING_DETAILED
366---------------------------------------
367
368defines building meshes, typically based on OSM data.
369
370Example:
371
372  BUILDING_ROUGH buildings.ac -122.501090 37.514830 15.5 0.00 0.00 0.00
373
374Syntax:
375
376  BUILDING_ROUGH <object-path> <lon> <lat> <elev-m> <hdg-deg> <pitch-deg> <roll-deg>
377
378Note that only bare .ac files should be referenced. The material definition for
379"OSM_Building" will be used to determine the texture and Effects.
380
381BUILDING_ROUGH uses the "rough" LOD range, while BUILDING_DETAILED uses the
382"detailed" LOD range. Some randomness is applied so that building meshes
383gradually fade in
384
3853.7  ROAD_ROUGH / ROAD_DETAILED
386-------------------------------
387
388Identical to BUILDING_ROUGH / BIULDING_DETAILED above, except used for roads.
389the material definition "OSM_Road" is applied.
390
3913.8  RAILWAY_ROUGH / RAILWAY_DETAILED
392-------------------------------
393
394Identical to BUILDING_ROUGH / BIULDING_DETAILED above, except used for roads.
395the material definition "OSM_Railway" is applied.
396
3973.9  BUILDING_LIST
398------------------
399
400Defines a file containing building coordinates that should be rendered using
401the building shader (aka Random Buildings).
402
403Example:
404
405  BUILDING_LIST buildings.txt OSM_Building -2.72943543 56.00080606 36.1
406
407Syntax
408
409  BUILDING_LIST <filename> <material name> <lon> <lat> <elev>
410
411Where:
412- <filename> is the name of a file containing building positions
413- <material name> is the name of the material that will be referenced to find
414  random building parameters.
415- <lat>, <lon>, <elev> defines the center of the set of buildings, and also
416  the point at which the material definition will be evaluated (for regional
417  materials).
418
419See README.materials for details on configuring the random building parameters.
420
421The referenced <filename> (in the example buildings.txt) contains lines of the form
422
423X Y Z R B W D H P S O F WT RT
424
425Where:
426- X,Y,Z are the cartesian coordinates of the center of the front face. +X is East, +Y is North
427- R is the building rotation in degrees centered on the middle of the front face.
428- B is the building type [0, 1, 2] for SMALL, MEDIUM, LARGE
429- W is the building width in meters
430- D is the building depth in meters
431- H is the building height in meters, excluding any pitched roof
432- P is the pitch height in meters. 0 for a flat roof
433- S is the roof shape (only 0, 2, 4, 6 are implemented, others are approximated to those) :
434    0=flat 1=skillion 2=gabled 3=half-hipped 4=hipped 5=pyramidal 6=gambrel
435    7=mansard 8=dome 9=onion 10=round 11=saltbox
436- O is the roof ridge orientation :
437    0 = parallel to the front face of the building
438    1 = orthogonal to the front face of the building
439- F is the number of floors (integer)
440- WT is the texture index to use for walls (integer). Buildings with the same WT value will have the same wall texture assigned.  There are 6 small, 6 medium and 4 large textures.
441- RT is the texture index to use for roofs (integer). Buildings with the same RT value will have the same roof texture assigned.  There are 6 small, 6 medium and 4 large textures.
442
443<x> <y> <z> <rot> <type>
444
445where :
446- (<x>,<y>,<z>) define the bottom left corner of the building in cartesian space (+X is North, +Y is East, +Z is up), with (0,0,0) being the position referenced above
447- <rot> is the clockwise rotation around the Z-axis in degrees, rotating around the bottom left (SW) corner of the building
448- <type> is {0,1,2} which map to small, medium and large buildings respectively, as per random buildings.
449
450For example, the following entries generates 3 small, 2 medium and 2 large buildings in an easterly line:
451
4520 0 0 0 0
4530 100 0 0 0
4540 200 0 0 0
4550 300 0 0 1
4560 400 0 0 1
4570 500 0 0 2
458
4594 model manager ("/models/model") --------------------------------------------
460
461
4624.1  static objects
463-------------------
464
465Another way to add objects to the scenery is via the "model manager".
466It reads all /models/model entries at startup and places these objects
467in the scenery. Just load a definition like the following into the
468property tree, for example by putting it into $FG_ROOT/preferences.xml, or
469better: an XML file that you load with e.g. --config=$HOME/.fgfs/stuff.xml:
470
471  <models>
472      <model n="0">
473          <name>pony</name>
474          <path>Local/pony.ac</path>
475          <longitude-deg>-115.8352869</longitude-deg>
476          <latitude-deg>37.24302849</latitude-deg>
477          <elevation-ft>4534.691321</elevation-ft>
478          <heading-deg>0</heading-deg>
479          <pitch-deg>0</pitch-deg>
480          <roll-deg>0</roll-deg>
481      </model>
482  </models>
483
484The <path> is relative to $FG_ROOT, the <name> is optional. One can leave the
485heading/pitch/roll entries away, in which case they are set to zero. The values
486are fixed and unchangeable at runtime.
487
488
489
490
4914.2  dynamic objects
492--------------------
493
494Any of the model properties can be made changeable at runtime by appending
495"-prop" and using a property path name instead of the fixed value:
496
497  <local>
498      <pony>
499          <longitude-deg>-115.8352869/<longitude-deg>
500          <latitude-deg>37.24302849</latitude-deg>
501          <elevation-ft>4534.691321</elevation-ft>
502          <heading-deg>0</heading-deg>
503      </pony>
504  </local>
505
506  <models>
507      <model n="1">
508          <name>pony</name>
509          <path>Local/pony.ac</path>
510          <longitude-deg-prop>/local/pony/longitude-deg</longitude-deg-prop>
511          <latitude-deg-prop>/local/pony/latitude-deg</latitude-deg-prop>
512          <elevation-ft-prop>/local/pony/elevation-ft</elevation-ft-prop>
513          <heading-deg-prop>/local/pony/heading-deg</heading-deg-prop>
514          <pitch-deg>1.234</pitch-deg>  <!-- static, just for fun -->
515      </model>
516  </models>
517
518Then one can move the pony around by changing the values in /local/pony/ in
519the property system. One can, of course, use other animals, too.
520
521
522
523
5244.3 loading/unloading at runtime
525--------------------------------
526
527Both dynamic and static model-manager-models can be loaded and unloaded
528at runtime. For loading you first create a new <model> entry under <models>,
529initialize all properties there (<longitude-deg> or <longitude-deg-prop>,
530etc.), and finally you create a child <load> of any type in this group.
531This is the signal for the model manager to load the object. You can
532remove the <load> property after that. It has no further meaning.
533
534To remove a model-manager model at runtime, you simply delete the whole
535<model> group.
536
537
538
539
540
5415 tools for object placing ----------------------------------------------------
542
543
5445.1 calc-tile.pl
545----------------
546
547For finding out the tile number for a given geo coordinate pair there's
548a script "scripts/perl/scenery/calc-tile.pl" in the FlightGear sources.
549You feed longitude and latitude to it and it returns the path to the
550*.stg file where you have to add the object entry.
551
552  $ perl calc-tile.pl 16.1234 48.5678
553  Longitude: 16.1234
554  Latitude:  48.5678
555  Tile:      3220128
556  Path:      "e010n40/e016n48/3220128.stg"
557
558
559
560
5615.2 ufo scenery object editor
562-----------------------------
563
564The ufo has a scenery object editor built-in. It uses the model manager
565described in section 4. To place objects with it, start fgfs, optionally
566with specifying an initial model type ("cursor") and a list of subdirectories
567of $FG_ROOT where the ufo should search for available 3D models ("source"):
568
569  $ fgfs --aircraft=ufo --prop:cursor=Models/Airport/radar.xml  \
570                        --prop:source=Models,Scenery/Objects
571
572Then click anywhere on the terrain to add a model (left mouse button).
573You can open the adjustment dialog (Tab-key) to make adjustments to
574position and orientation. Click as often as you like, choose further
575models from the space-key dialog. You can select an already placed object
576by Ctrl-clicking at its base (not at the object itself, but the surface
577point where it's located!). By also holding the Shift key down, you
578can select several objects or add them to a selection. You can remove
579the selected object(s) with the Backspace-key. (See the ?-key dialog
580for futher available keys.) After clicking on the input field right
581over the status line (invisible if there's no text in it) you can enter
582a comment/legend for the selected object.
583
584And finally, you dump the object data to the terminal (d-key) or export
585them to a file $HOME/.fgfs/ufo-model-export.xml (Unix) or
586%APPDATA%\flightgear.org\ufo-model-export.xml (MS Windows).
587
588You can now put the generated object entries into the specified *.stg
589file to make them permanent. Or load the whole exported *.xml file
590via --config option:
591
592  $ fgfs --config=$HOME/.fgfs/ufo-model-export.xml
593
594If you choose the sign placeholder object from the m-key dialog (first
595entry; "Aircraft/ufo/Models/sign.ac"), then an OBJEC_SIGN *.stg line
596will be generated with the legend used as sign contents. If you didn't
597insert any legend, then the sign text will be: NO CONTENTS and a 4 digits
598random number for later identification in the *.stg file.
599
600Unfortunately, objects added with this method are kept in memory, no
601matter where you are actually flying, so the *.stg method is preferable.
602
603
604
605
606
6076 embedded Nasal in XML files (static objects and AI) -------------------------
608
609
6106.1 static models
611-----------------
612
613Objects loaded via OBJECT_STATIC in *.stg files as well as AI models loaded
614via scenarios may contain embedded Nasal code. This can be used to drive
615more advanced animations. An example is a lighthouse with specific light
616signals, or hangar doors that open when the "player"'s aircraft is nearby.
617The Nasal code is added to the object's XML wrapper/animation file, anywhere
618on the top level, for example:
619
620
621   <PropertyList>
622       <path>lighthouse.ac</path>
623
624       <nasal>
625           <load>
626               var loop_id = 0;
627               var light = aircraft.light.new("
628                       "/models/static/w120n30/w118n35/lighthouse/light",
629                       [2, 1, 2, 1, 2, 1, 2, 5]);
630
631               var loop = func(id) {
632                   id == loop_id or return;
633                   light.switch(getprop("/sim/time/sun-angle-rad") > 1.37);
634                   settimer(func { loop(id) }, 30);
635               }
636               loop(loop_id += 1);
637           </load>
638
639           <unload>loop_id += 1</unload>
640       </nasal>
641
642       <animation>
643           <type>select</type>
644           <object-name>light-halo</object-name>
645           <property>/models/static/w120n30/w118n35/lighthouse/light/state</property>
646       </animation>
647
648       ...
649   </PropertyList>
650
651
652The <load> part is executed when the scenery tile on which the model is placed
653is loaded into memory. It can start timers or listeners that modify properties,
654which are then queried by the <animation>. As a convention developers are requested
655to use "/models/static/" + <tile-path> + <file-basename>. So, in the above example
656file "$FG_ROOT/Scenery/Objects/w120n30/w118n35/lighthouse.xml" all properties
657are stored under "/models/static/w120n30/w118n35/lighthouse/". That way collisions
658with other models are quite unlikely.
659
660An optional <unload> part is executed when the tile and model is removed from
661memory. Note that this is only when the "player" is already far away! To
662cause minimal impact on the framerate it is recommended to do as few
663calculations as possible, to use as large timer intervals as possible, and to
664stop all timers and listeners in the <unload> part, as shown in the example.
665
666All Nasal variables/functions are in a separate namespace, which is named
667after the file name. It's recommended not to access this namespace from
668outside for other than development purposes.
669
670What the above code does: as soon as the model is loaded, an aircraft.light
671is created with a specific light sequence. Then, in half-minute intervals,
672the light is turned on or off depending on the sun angle. On <unload> the
673loop identifier is increased, which makes the loop terminate itself. For
674more info about this technique, see the Nasal wiki.
675
676
677
678
6796.2 AI models
680-------------
681
682Here the syntax is the same like for static models. The only two differences
683are:
684
685- these models are currently only removed at program end, so it's more
686  important to consider effects on performance.
687
688- AI models don't need to store their properties in /models/static/...,
689  but get a separate node under /ai/models/, for example /ai/models/carrier[1].
690  The embedded Nasal code can access this dynamically assigned property
691  via cmdarg() function, which returns a props.Node hash. Example:
692
693     <nasal>
694         <load>print("my data are under ", cmdarg().getPath())</load>
695         <unload>print("Currently I'm only called at fgfs exit!")</unload>
696     </nasal>
697

README.sound

1
2OpenAL setup for general use (Linux)
3-------------------------------------
4As of the July 2004 release of OpenAL it is best to add at least the
5following line to your ~/.openalrc file on Linux because it wil find out
6what audio backend to use, starting with the most appropriate:
7
8(define devices '(native alsa sdl esd arts null))
9
10
11
12ALSA surround sound (5.1) setup
13-------------------------------------
14(taken from http://floam.ascorbic.com/how-to/alsa5.1)
15
16Make a ~/.openalrc, we are telling OpenAL that we want surround sound and
17we want to use ALSA instead of OSS.
18
19(define speaker-num 4)
20(define devices '(alsa))
21(define alsa-out-device "surround40:0,0")
22
23
24
25IRIX surround sound (5.1) setup
26-------------------------------------
27To add 4 channel surround sound on IRIX hardware that supports in
28directly you can just add the following line to your ~/.openalrc file:
29
30(define speaker-num 4)
31
32To add 4 channel surround sound to IRIX systems that have more than one
33stereo output you can add the following section to your ~/.openalrc file
34(for a typical O2 configuration):
35
36(define speaker-num 4)
37(define native-out-device "Analog Out")
38(define native-rear-out-device "Analog Out 2")
39
40or alternatively:
41
42(define speaker-num 4)
43(define native-out-device "A3.Speaker")
44(define native-rear-out-device "A3.LineOut2")
45
46
47
48(Note the following section is obsolete as of the July 2004 release of
49OpenAL, since your could command OpenAL to use ALSA or Arts directly)
50
51ALSA and Arts
52-------------------------------------
53
54I'm using kernel 2.6.5 with alsa, my sound module is snd-intel8x0. When I ran
55fgfs, I'd get quite 'choppy' sound (wasn't smooth, there'd be a couple of
56breaks in the sound every second or so). Running arts, and starting fgfs with
57"artsdsp fgfs" (from the artsdsp website: "When an application is run under
58artsdsp all accesses to the /dev/dsp audio device are intercepted and mapped
59into aRts API calls. While the device emulation is not perfect, most
60applications work this way, albeit with some degradation in performance and
61latency.") would improve the situation, but it seemed to still be choppy.
62
63This command:
64echo "fgfs 0 0 direct" >/proc/asound/card0/pcm0p/oss
65
66(from the alsa kernel OSS emulation website:
67  "The direct option is used, as mentioned above, to bypass the automatic
68   conversion and useful for MMAP-applications")
69
70made my sound work beautifully when fgfs was run with artsdsp. Running without
71artsdsp however (with artsd suspended or killed), would give me no sound at all
72(which I find a bit strange)
73
74The following websites might help people with similar troubles:
75http://www.alsa-project.org/~iwai/OSS-Emulation.html
76http://www.arts-project.org/doc/handbook/artsdsp.html
77
78Computer info:
79
80kernel 2.6.5
81
82flightgear 0.9.4
83simgear 0.3.5
84plib 1.8.3
85
86soundcard is onboard an asus p4p800-e deluxe mobo (using snd-intel8x0), alsa,
87related modules from lsmod:
88Module                  Size  Used by
89snd_pcm_oss            53252  1
90snd_mixer_oss          19968  1 snd_pcm_oss
91snd_intel8x0           33476  1
92snd_ac97_codec         63492  1 snd_intel8x0
93snd_pcm                97408  2 snd_pcm_oss,snd_intel8x0
94snd_timer              26112  1 snd_pcm
95snd_page_alloc         11396  2 snd_intel8x0,snd_pcm
96snd_mpu401_uart         7936  1 snd_intel8x0
97snd_rawmidi            24832  1 snd_mpu401_uart
98snd_seq_device          8324  1 snd_rawmidi
99snd                    53892  9 snd_pcm_oss,snd_mixer_oss,snd_intel8x0,
100                                snd_ac97_codec,snd_pcm,snd_timer,snd_mpu401_uart,
101                                snd_rawmidi,snd_seq_device
102soundcore              10208  2 snd
103

README.submodels

1<?xml version="1.0"?>
2
3<!--
4
5Submodels are objects which can be dropped or launched from the user
6aircraft. The trigger is a boolean property, which you define, which when
7"true" causes the submodel to be released/launched.
8
9A submodel will create an AIBallistic object which will follow a ballistic
10path. By default one submodel will be released when the corresponding
11trigger is "true".
12
13Notes:
14   1.  This utility is intended for ballistic objects which align to the
15   trajectory. Drag is applied based on this assumption: no allowance is
16   for changes in drag for objects which do not conform to this asumption.
17   made
18
19  2.  While Inertia is calculated properly, Moment of Inertia and rotational
20  aerodynamic damping are simulated. It is assumed that the object is a cylinder
21  of uniform density - if your object does not conform to this, there will be
22  inaccuracies.
23
24  3.  The program does not calculate windage for ballistic objects well. While
25  adequate for smoke effects, etc., for bullets, bombs, droptanks this is probably
26  best left at "False". Since the effects of wind on various ballistic objects is
27  uncertain, there is no plan to change this situation.
28
29  4. Submodels can be ensted to any depth, thus a submodel on expiry or impact etc,
30  can launch a child submodel, which in turn can launch a submodel. and so on. This
31  is the basis for Persistent Contrails, but any use is possible.
32
33The initial conditions (IC) define the object's starting point (relative
34to the user aircraft's "reported position"), and its initial speed and
35direction (relative to the user aircraft).  If you want to release many
36similar objects with similar IC, then you may use the <repeat>, <delay>
37and <count> properties to define this.  The allowed properties are:
38
39<name>         The name of the submodel.
40<model>        The path to the visual model.
41<trigger>      The property which will act as the trigger. If this tag is not
42               included, the submodels will be released continuously, provided
43               <count> is set to -1.
44<speed>        Initial speed, in feet/sec, relative to user aircraft.
45<speed-prop>   The property containing the Initial speed, in feet/sec, relative to
46               user aircraft. If this path is found, <speed> will be overwritten.
47<repeat>       Set "true" if you want multiple releases of this submodel.
48<delay>        Time, in seconds, between repeated releases.
49<count>        Number of submodels available for multiple release.
50               -1 defines an unlimited number.
51<slaved>       If true, the submodel is slaved to the parent model.
52<x-offset>     Submodel's initial fore/aft position (in feet), relative to user
53               aircraft.  Fore is positive.
54<y-offset>     Submodel's initial left/right position (in feet), relative to user
55               aircraft.  Right is positive.
56<z-offset>     Submodel's initial up/down position (in feet), relative to user
57               aircraft.  Up is positive.
58<yaw-offset>   Submodel's initial azimuth, in degrees, relative to user
59               aircraft'snose. Right is positive.
60<pitch-offset> Submodel's initial elevation, in degrees, relative to user aircraft's
61               pitch. Up is positive.
62<life>         Life span in seconds.
63               Default is 900.0.
64<buoyancy>     In ft/sec/sec.  Works opposite acceleration of gravity.
65               For example, if set to 32 the submodel will feel no
66               gravity. If greater than 32 the object will rise.
67               Default is 0.
68<wind>         Set to true if you want the submodel to react to the wind. Default
69               is "false".
70<cd>           The Coeffient of Drag. Varies with submodel shape - 0.295 for a
71               bullet, 0.045 for an airfoil. Enter an appropriate value. Defaults to
72               0.295.
73<random>       When this is true the Cd is varied by +- 5%. Useful for smoke or
74               contrails.
75<eda>          Effective drag area (sq ft). Usually the cross-sectional area of the
76               submodel normal to the airflow.
77<weight>       The weight of the submodel (lbs). NOT set to 0 on submodel release.
78               You may wish to set this value to 0 by means of key bindings or Nasal
79               script. Defaults to 0.25.
80<contents>     The path to the contents of a submodel. The contents must be in lbs.
81               Intended for use with drop tanks. The property value will be set to
82               0 on release of the submodel: do not also set to 0 elsewhere e.g. in
83               key bindings. Defaults to 0.
84<random>       Varies CD by +- 10%, initial azimuth by +- 10 degs, and life by
85               <randomness>
86<randomness>   If <random> is true, <randomness> is applied to <life>. 0 > Value < 1
87               are valid. Defaults to 0.5.
88<no-roll>      If true the submodel does not roll.
89<impact>       If true, the impact location (lat/lon) on the terrain is calculated.
90               The Material (e.g Grass)of the terrain, load resistance, and impact
91               velocity. Altitude agl is calculated.
92<collision>    If true, collisions with other objects is tested. If a collision is
93               detected then the position data are written to the "Report Node".
94<fuze-range>   Used in detecting collisions. The distance in feet between an object
95               and a submodel at which a collision is deemed to have occurred.
96<expiry>       If true, the current position of the submodel is written to the
97               "Report Node" when the submodel life expires.
98<impact-reports> Defines a "Report Node". When an impact happens, then the path of
99               the submodel will be written to this node. An attached listener
100               function can evaluate the impact properties. If unset, reports go to
101               /ai/models/model-impact.
102
103***** experimental ****
104
105<external-force> If true the submodel is subjected to an external force
106<force-path> A string describing the property where the magnitude, azimuth and
107             elevation of the external force are to be found. The following child
108              properties are instantiated:
109               ~/force-lb
110              ~/force-azimuth-deg
111              ~/force-elevation-deg
112
113You will have to set these values by some means (Nasal script etc.) to make use of this
114utility.
115
116<PropertyList>
117
118  <submodel>
119    <name>left gun</name>
120    <model>Models/Geometry/tracer.ac</model>
121    <trigger>ai/submodels/submodel[0]/trigger</trigger>
122    <speed>2750.0</speed>
123    <repeat>true</repeat>
124    <delay>0.25</delay>
125    <count>100</count>
126    <x-offset>1.0</x-offset>
127    <y-offset>-7.0</y-offset>
128    <z-offset>-2.0</z-offset>
129    <yaw-offset>0.4</yaw-offset>
130    <pitch-offset>1.8</pitch-offset>
131    <life>2.0</life>
132  </submodel>
133
134  <submodel>
135    <name>right gun</name>
136    <model>Models/Geometry/tracer.ac</model>
137    <trigger>ai/submodels/submodel[0]/trigger</trigger>
138    <speed>2750.0</speed>
139    <repeat>true</repeat>
140    <delay>0.25</delay>
141    <count>100</count>
142    <x-offset>1.0</x-offset>
143    <y-offset>7.0</y-offset>
144    <z-offset>-2.0</z-offset>
145    <yaw-offset>-0.4</yaw-offset>
146    <pitch-offset>1.8</pitch-offset>
147    <life>2.0</life>
148  </submodel>
149
150  <submodel>
151    <name>droptank-l</name>
152    <model>Aircraft/Hunter/Models/droptank-100gal.ac</model>
153    <trigger>controls/armament/station[0]/jettison-all</trigger>
154    <speed>0</speed>
155    <repeat>false</repeat>
156    <count>1</count>
157    <x-offset>0.820</x-offset>
158    <y-offset>-9.61</y-offset>
159    <z-offset>-2.39</z-offset>
160    <yaw-offset>0</yaw-offset>
161    <pitch-offset>0</pitch-offset>
162    <wind>false</wind>
163    <eda>2.11348887</eda>
164    <weight>170</weight>
165    <cd>0.045</cd>
166    <contents>consumables/fuel/tank[2]/level-lbs</contents>
167  </submodel>
168
169  <submodel>
170    <name>droptank-r</name>
171    <model>Aircraft/Hunter/Models/droptank-100gal.ac</model>
172    <trigger>controls/armament/station[1]/jettison-all</trigger>
173    <speed>0</speed>
174    <repeat>false</repeat>
175    <count>1</count>
176    <x-offset>0.820</x-offset>
177    <y-offset>9.61</y-offset>
178    <z-offset>-2.39</z-offset>
179    <yaw-offset>0</yaw-offset>
180    <pitch-offset>0</pitch-offset>
181    <wind>false</wind>
182    <eda>2.11348887</eda>
183    <weight>170</weight>
184    <cd>0.045</cd>
185    <contents>consumables/fuel/tank[3]/level-lbs</contents>
186  </submodel>
187
188  <submodel>
189    <name>engine exhaust r</name>
190    <model>Aircraft/seahawk/Models/exhaust_s.xml</model>
191    <trigger>sim/ai/aircraft/exhaust</trigger>
192    <speed-node>engines/engine/n1</speed-node>
193    <speed>10</speed>
194    <repeat>true</repeat>
195    <delay>0.1</delay>
196    <count>-1</count>
197    <x-offset>-3.5</x-offset>
198    <y-offset>2.6768</y-offset>
199    <z-offset>-0.3937</z-offset>
200    <yaw-offset>170</yaw-offset>
201    <life>10</life>
202    <buoyancy>128</buoyancy>
203    <aero-stabilised>0</aero-stabilised>
204    <wind>true</wind>
205    <eda>1</eda>
206    <cd>0.95</cd>
207    <weight>1</weight>
208    <random>1</random>
209  </submodel>
210
211</PropertyList>
212
213-->
214

README.systems

1By Default systems are initialized by the Aircraft/generic/generic-system.xml
2This initializes the following:
3- The generic electrical system
4- 1 pitot system, index [0]
5- 1 static system index [0]
6- 2 vacuum systems [0] and [1], depending on engine rpm of engine[0] and
7  engine[1] respectfully
8
9If you want to define more systems, copy the generic-system file to your
10aircraft-name/Systems folder and rename it systems.xml
11
12In your aircraft -set file add the path to the system.xml file:
13<sim>
14    ....
15    <systems>
16        ....
17        <path>Aircraft/aircraft-name/Systems/systems.xml</path>
18        ....
19    </systems>
20    ....
21</sim>
22
23
24** Adding a second pitot system.
25In your systems.xml, you should already have
26
27  <pitot>
28    <name>pitot</name>
29    <number>0</number>
30    <stall-deg>60</stall-deg>           # optionnal, default to 60 degrees
31  </pitot>
32
33and you need to add for a pitot system with index 1:
34
35  <pitot>
36    <name>pitot</name>
37    <number>1</number>
38    <stall-deg>60</stall-deg>  #optionnal
39  </pitot>
40
41For the any pitot system except for the first (with index 0)
42add in the aircraft -set file (below for index 1):
43
44<systems>
45      <pitot n="1">
46                <serviceable>1</serviceable>
47      </pitot>
48</systems>
49
50Of course you can add a third or fourth etc.
51
52
53** Adding a second static system
54Absolutely analog with the pitot system. So add in systems.xml:
55
56  <static>
57    <name>static</name>
58    <number>1</number>
59    <tau>1</tau>
60    <type>0</type>                          #optionnal: 0,1 or 2 default is 0
61    <error-factor>0.5</error-factor>        #optionnal see below default = 0
62  </static>
63
64and in the aircraft -set file:
65
66<systems>
67      <static n="1">
68                <serviceable>1</serviceable>
69      </static>
70</systems>
71
72Now you can source your instrumentation relying on static and pitot
73pressure (airspeed, altimeter, vertical speed indicator) from different
74and independent systems
75
76
77** The PITOT System
78
79The pitot system measures impact pressure and is basically a tube pointing forward.
80Small aircraft have one, small IFR aircraft have one or two (of which at least
81one is heated) and larger commercial aircraft have three or even more. In those large
82aircraft the left pitot serves the pilot instruments, the right the co-pilot and
83the third system the back-up instruments. This might be different for each type
84of aircraft of course.
85In Flightgear the pitot system outputs the total pressure to the following property:
86/systems/pitot[n]/total-pressure-inhg and
87/systems/pitot[n]/measured-total-pressure-inhg
88which are the same except at supersonic speeds. For supersonic aircraft use the "measured"
89property. See also the README.airspeed-indicator.
90However it is advised for every aircraft to use the measured property. In future
91this will be the property where all the measurement faults are reflected.
92the following "measurement failures" are currently applied:
931) decrease of total and measured pressure due to side-slip and angle of attack
942) at 60 deg the pitot tube will stall and the value will fall back to static pressure
953) for the "measured" property only: at Mach>1, a shock wave is assumed in front of the
96  pitot tube, decreasing the total pressure.
97
98The stall angle may be (optionally) set to any angle between 0 and 90 deg
99(default = 60 deg) like so:
100  <pitot>
101    <name>pitot</name>
102    <number>0</number>
103    <stall-deg>45</stall-deg>
104  </pitot>
105
106Both the decrease of the pitot pressure and the default stall angle are based on a measurement
107on an AN5812 pitot tube.
108
109
110** The STATIC system
111
112The static system measures the static pressure. So all influences of airspeed are eliminated.
113In real life this is however not always easy. Effects from angle of attack, side-slip, flap defection,
114gear extension, engine power setting and airspeed are present and for the aircraft
115designer it is not alway easy to find a good position for the static port.
116Usually the number of static systems are equal to the number of pitot systems.
117In Flightgear there are 3 types of static systems modelled.
118Type 0 (default): the perfect sensor. No measurement failures.
119Type 1: Dual static ports on the fuselage sides. Side-slip angle influence only. this model the whole pair.
120Type 2: Static port on the pitot tube. Both angle of attack and side-slip influence.
121If you want to use type 1 or 2:
122  <static>
123    <name>static</name>
124    <number>0</number>
125    <tau>0.1</tau>
126    <type>1</type>
127    <error-factor>0.5</error-factor>
128  </static>
129The output property /systems/static[n]/pressure-inhg is filtered. Therefore, if you want to see
130the effect of the measurement failure, "tau" should be 0.1 or smaller.
131The "error-factor" should be between 0.2 and 0.7. Setting it to 0 equals a "perfect sensor".
132A setting of 1 means the whole (projected on static port face) impact pressure is applied.
133This is not realistic as usually there are more than one static pick-up points
134and so the pressure increase gets "flattened".
135

README.tutorials

1== README.tutorials ===========================================================
2
3FlightGear offers a flexible tutorial system, entirely written in the Nasal
4language. Tutorials can be started and stopped from the "Help" menu. They are
5defined in XML files. Each of them has to be loaded into /sim/tutorials/ under
6a separate tutorial[n]/ branch:
7
8  <sim>
9      <tutorials>
10          <tutorial include="Tutorials/take-off.xml"/>
11          <tutorial include="Tutorials/landing.xml"/>
12      </tutorial>
13  </sim>
14
15Alternatively, all tutorials can be defined in one file, with <tutorial> tags
16around each tutorial. This is then included like so:
17
18  <sim>
19      <tutorials include="foo-tutorials.xml"/>
20  </sim>
21
22Finally, tutorials are automatically generated from any valid checklists
23on startup.  See README.checklists for details.
24
25
26== TUTORIAL STRUCTURE =========================================================
27
28
29A tutorial has this structure, where some of the elements are described
30in detail below:
31
32
33<tutorial>
34  <name>...</name>            mandatory; short identifier, also shown in the
35                                         tutorial selection dialog
36  <description>...</description> mandatory; longer description for the dialog
37  <audio-dir>...</audio-dir>  optional; defines where to load sound samples
38  <timeofday>noon</timeofday> optional; defines daytime; any of "dawn",
39                                        "morning", "noon", "afternoon",
40                                        "evening", "dusk", "midnight", "real"
41
42  <step-time>                 optional; period between each step being executed.
43                              Default 5
44  <exit-time>                 optional; period between exit/abort conditions being
45                              checked. Default 1
46
47  <nasal>
48      ...                     optional; initial Nasal code; see below
49  </nasal>
50
51  <models>
52      ...                     optional; scenery objects; see below
53  </models>
54
55  <targets>
56      ...                     optional; targets; see below
57  </targets>
58
59  <presets>
60      ...                     optional; initial simulator state; see below
61  </presets>
62
63
64  <init>                      optional; initial settings; see below
65    <set>
66        ...                     optional; property settings; allowed multiple
67    </set>                      times
68    <view>
69        ...                     optional; view settings
70    </view>
71    <marker>
72        ...                     optional; marker coordinates
73    </marker>
74    <nasal>
75        ...                     optional; Nasal code
76    </nasal>
77  </init>
78
79  <step>                      mandatory; well, not really, but if there's not
80                              at least one <step>, then the whole tutorial
81                              won't do anything; see below for details
82
83    <message>...</message>      optional; message to be displayed/spoken when
84                                <step> is entered; allowed multiple times, in
85                                which case one is chosen at random
86
87    <message-param>             optional; allowed up to 4 times.
88      <property>...</property>  property to substitute into the <message> string
89    </message-param>            using sprintf() formatting.  E.g. %d, %.2f
90
91    <audio>...</audio>          optional; file name of *.wav sample to be played;
92                                          may be used multiple times (random)
93    <set>
94        ...                     optional; allowed several times
95    </set>
96    <view>
97        ...                     optional
98    </view>
99    <marker>
100        ...                     optional
101    </marker>
102    <nasal>
103        ...                     optional; Nasal code that is executed when the
104    </nasal>                              step is entered
105
106    <wait>10</wait>             optional; wait period after initial messages etc.
107
108    <error>                     optional; allowed several times
109        <message>..</message>       optional; text displayed/spoken
110        <audio>...</audio>          optional; name of *.wav sample to be played
111
112        <condition>
113            ...                     optional, but one should be there to make sense
114        </condition>                          see $FG_ROOT/Docs/README.conditions
115
116        <nasal>
117            ...                     optional; Nasal code that is executed when the
118        </nasal>                              error condition was fulfilled
119    </error>
120
121    <exit>                      optional; defines when to leave this <step>
122        <condition>                       see $FG_ROOT/Docs/README.conditions
123            ...
124        </condition>
125
126        <nasal>
127            ...                     optional; Nasal code that is executed when the
128        </nasal>                              exit condition was met
129    </exit>
130  </step>
131
132
133  <end>                           optional; final settings & actions; see below
134      <message>...</message>          optional; multiple times (random)
135      <audio>...</audio>              optional; multiple times (random)
136      <set>
137          ...                         optional
138      </set>
139      <view>
140          ...                         optional
141      </view>
142      <nasal>
143          ...                         optional
144      </nasal>
145  </end>
146</tutorial>
147
148
149
150After the tutorial has finished initialization, it goes through all <steps>.
151For each it outputs the <message> or <audio>, optionally sets a <marker> and/or
152a <view>, then it checks all <error>s and, if an <error><condition> is fulfilled,
153outputs the respective <error><message>. If none of the <error>s occurred, then
154it checks if the <exit><condition> is true, and if so, it jumps to the next
155<step>. Otherwise the current <step> is endlessly repeated. Finally, after all
156<step>s were processed, the <end> group is executed.
157
158
159
160
161
162
163
164
165== ELEMENTS ===================================================================
166
167
168-- <nasal> --------------------------------------------------------------------
169
170Embedded Nasal is supported on the top level, in <init> in each <step>, in a
171<step>'s <error> and <exit>, and in <end>. All Nasal runs in a separate
172namespace __tutorial, so it's possible to define a function in the <init>'s
173Nasal block, and to use this function in other blocks without prefix. The
174namespace is preloaded with some functions:
175
176
177  next([n=1])      ... to switch n <step>s forward
178  previous([n=1])  ... to switch n <step>s backwards
179
180  say(what [, who="copilot [, delay=0]])
181                   ... says 'what' with voice 'copilot' after 'delay' seconds
182
183
184A Nasal group looks like this:
185
186  <nasal>
187      <script>
188          say("Hi, I'm the pilot!", "pilot");
189      </script>
190      <module>__tutorial</module>           optional; preset with __tutorial
191  </nasal>
192
193
194
195
196
197-- <models> -------------------------------------------------------------------
198
199This loads models into the scenery. It can be used to place, for example,
200a helicopter landing pad at an airport where normally none is, so that the
201tutorial can train landing. The layout is the following, with <path> being
202relative to $FG_ROOT:
203
204  <models>
205      <model>
206          <path>Models/Airport/supacat_winch.ac</path>     mandatory
207          <longitude-deg>-122.4950109</longitude-deg>      mandatory
208          <latitude-deg>37.51403798</latitude-deg>         mandatory
209          <elevation-ft>51</elevation-ft>                  mandatory
210          <heading-deg>2.488888979</heading-deg>           optional (default: 0)
211          <pitch-deg>0</pitch-deg>                         optional (default: 0)
212          <roll-deg>0</roll-deg>                           optional (default: 0)
213      </model>
214
215      <model>
216          ...                      another model
217      </model>
218  </models>
219
220The models are only removed before a new tutorial is loaded. Otherwise they
221remain in the scenery for the whole FlightGear session. They aren't permanently
222added.
223
224
225
226
227
228-- <targets> ------------------------------------------------------------------
229
230These are simple pairs of longitude/latitude under an arbitrary name (here
231"hospital" and "helipad"):
232
233  <targets>
234      <hospital>
235          <longitude-deg>-122.4950109</longitude-deg>      mandatory
236          <latitude-deg>37.51403798</latitude-deg>         mandatory
237      </hospital>
238
239      <helipad>
240          ...
241      </helipad>
242  </targets>
243
244
245The tutorial system will for each calculate how the user's aircraft is positioned
246relative to the respective target, and offer the information in this structure:
247
248  <sim>
249      <tutorials>
250          <targets>
251              <hospital>
252                  <direction-deg>12.345</direction-deg>
253                  <heading-deg>33.333</heading-deg>
254                  <distance-m>12404.932</distance-m>
255                  <eta-min>39.2358</eta-min>
256              </hospital>
257
258              <helipad>
259                  ...
260              </helipad>
261          </targets>
262      </tutorials>
263  </sim>
264
265
266Where:
267  <direction-deg> is an angle between the aircraft's velocity vector and the
268                  azimuth to the target. 0 means that the aircraft is moving
269                  right towards the target. 10 means that the target is slightly
270                  to the right, -90 means that it's exactly left, and -180 or
271                  179.9999 that it's right behind.
272
273  <heading-deg>   is the absolute heading that the aircraft would currently
274                  have to fly with in a straight line to reach the target
275
276  <distance-m>    is the distance in meters
277
278  <eta-min>       is the "Estimated Time of Arrival" given the aircraft's
279                  current speed towards the target. Positive times mean that
280                  the aircraft is getting nearer to the target and can arrive
281                  there in this time given the current speed. It will, of course,
282                  only arrive there, if <direction-deg> is zero. A negative
283                  number means that the aircraft moves away, or in other words:
284                  that in this number of minutes it will be away twice as far.
285
286
287
288
289
290-- <presets> ------------------------------------------------------------------
291
292These set the initial simulator state. All properties are optional.
293The last three entries are to define the position relative to the
294airport/runway or the longitude/latitude.
295
296  <presets>
297      <airport-id>KHAF</airport-id>
298      <on-ground>1</on-ground>
299      <runway>12</runway>
300    <!--
301      <altitude-ft>122.333</altitude-ft>
302      <latitude-deg>37.555</latitude-deg>
303      <longitude-deg>1000</longitude-deg>
304    -->
305      <heading-deg>0</heading-deg>
306      <airspeed-kt>0</airspeed-kt>
307      <glideslope-deg>0</glideslope-deg>
308      <offset-azimuth>0</offset-azimuth>
309      <offset-distance>0</offset-distance>
310  </presets>
311
312
313
314
315
316-- <set> ----------------------------------------------------------------------
317
318<set> groups can be used in <init>, <step>, and <end>. They set a <property>
319to a given <value> or to the value that a second <property> points to. They
320can also reset values that were only temporarily changed for the duration
321of the tutorial. This is desirable for properties that are saved to the
322aircraft config file or to ~/.fgfs/autosave.xml.
323
324  <set>
325      <property>/foo/bar</property>        set /foo/bar to 123
326      <value>123</value>
327  </set>
328
329  <set>
330      <property>/foo/bar</property>        set /foo/bar to value of /test
331      <property>/test</property>
332  </set>
333
334
335
336
337
338-- <view> ---------------------------------------------------------------------
339
340These groups can be used in <init>, <step>, and <end>. They smoothly move the
341view to a new view position/direction. All parameters are optional. If, for
342example, only <field-of-view> is set, then the view will only zoom in -- the
343direction and position will remain the same. This feature is meant for cockpit
344tutorials, where the pilot's view is directed to some switch or instrument.
345view-number can be used to switch between different views, i.e. to tower-view,
346copilot view etc. Default view-number is 0 (captain's view).
347
348  <view>
349      <view-number>0</view-number>                 0=captain's view, 1=copilot,...
350      <heading-offset-deg>20</heading-offset-deg>  positive is left
351      <pitch-offset-deg>-4</pitch-offset-deg>      positive is up
352      <roll-offset-deg>0</roll-offset-deg>         positive is roll right
353      <x-offset-m>0.2</x-offset-m>                 positive is move right
354      <y-offset-m>0.2</y-offset-m>                 positive is move up
355      <z-offset-m>0.2</z-offset-m>                 positive is move back
356      <field-of-view>55</field-of-view>            default: 55; smaller zooms in
357  </view>                                                       bigger zooms out
358
359
360
361
362
363-- <marker> -------------------------------------------------------------------
364
365These are supported in <init>, <step>, and <end>. They show a magenta colored
366circle at given position (relative to aircraft origin) in given size. See the
367last section for how to conveniently find the proper coordinates.
368
369  <marker>
370      <x-m>1.3</x-m>                               positive is back
371      <y-m>0.3</y-m>                               positive is to the right
372      <z-m>0.1</z-m>                               positive is up
373      <scale>1.3</scale>                           optional; default: 1
374  </marker>
375
376
377For this to work, the aircraft model needs to include the tutorial marker
378model in its animation xml file:
379
380  <PropertyList>
381      <path>lightning-f1a.ac</path>
382
383      <model>
384          <path>Aircraft/Generic/marker.xml</path>
385      </model>
386
387      ...
388  </PropertyList>
389
390
391
392
393
394-- <message>/<audio> ----------------------------------------------------------
395
396Groups <step> and <end> can have one or more <message> entries, and one or
397more <audio> entries. If more are used of a kind, then the tutorial chooses
398one at random. If <audio> are available, then the contents are interpreted as
399file name of a *.wav sample, which is appended to the <audio-dir> path defined
400at the <tutorial> top level (default: "") and played by the tutorial system.
401Otherwise the <message> is handed over to the voice system, and synthesized
402to speech by the Festival speech synthesizer (if installed). In either
403case the chosen <message> is displayed on top of the screen. Neither <message>
404nor <audio> are mandatory.
405
406Because one and the same <message> string can be displayed *and* be synthesized,
407which can be problematic in some cases, there is a way to specify parts for
408either display *or* voice synthesizer:  "{<display part>|<voice part}".
409Example:
410
411  <message>Press the {No1|number one} button!</message>
412
413Here, "No1" would be displayed on the screen, but "number one" would be
414sent to the speech synthesis system. This can also be used to add
415invisible but audible exclamation marks:   "Press the button{|!}"
416
417
418
419
420
421-- <condition> ----------------------------------------------------------------
422
423These are explained in detail in $FG_ROOT/Docs/README.conditions. Here's just
424one example:
425
426  <condition>
427      <less-than>
428          <property>/foo/bar</property>
429          <value>12</value>
430      </less-than>
431  </condition>
432
433This condition is true when the value of /foo/bar is less than 12, and false
434otherwise.
435
436
437
438
439
440
441
442
443== FINDING MARKER COORDINATES =================================================
444
445If an aircraft tutorial wants to use the marker, then the aircraft animation
446file needs to include the marker model (see above). If this is done, then one
447can use the "marker-adjust" dialog to find the respective <marker> coordinates.
448Just type this into the "Help->Nasal Console" dialog:
449
450  tutorial.dialog()
451
452
453Or temporarily add a key binding to the *-set.xml file:
454
455  <key n="96">
456      <name>Backtick</name>
457      <desc>Open marker adjust dialog</desc>
458      <binding>
459          <command>dialog-show</command>
460          <dialog-name>marker-adjust</dialog-name>
461      </binding>
462  </key>
463
464
465The dialog allows to move a red cross around, which has the blinking marker
466circle in the middle. Note that ctrl- and shift-modifiers modulate the slider
467movements. Ctrl makes positioning coarser, and shift finer. The [Reset]
468button moves the marker back to aircraft origin, the [Center] button centers
469the sliders, and the [Dump] button dumps the marker coordinates to the
470terminal, for example:
471
472  <marker>
473      <x-m>1.1425</x-m>
474      <y-m>0.1994</y-m>
475      <z-m>-0.0844</z-m>
476      <scale>2.0489</scale>
477  </marker>
478
479This just needs to be copied to the tutorial XML file.
480

README.wildfire

1Cellular Automata based wildfire for FlightGear/CVS
2---------------------------------------------------
3
4Copyright (C) 2008 - 2009  Anders Gidenstam
5
6 *  These programs are free software; you can redistribute them and/or modify
7 *  them under the terms of the GNU General Public License as published by
8 *  the Free Software Foundation; either version 2 of the License, or
9 *  (at your option) any later version.
10 *
11 *  This program is distributed in the hope that it will be useful,
12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *  GNU General Public License for more details.
15 *
16 *  You should have received a copy of the GNU General Public License
17 *  along with this program; if not, write to the Free Software
18 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20Usage
21-----
22
23A fire is started by calling wild_fire.ignite(pos) where pos is a
24valid geo.Coord instance.
25
26Example: starting fires by ctrl+shift+click:
27
28Put this Nasal fragment somewhere where it is run at startup.
29(E.g. in a <nasal><MyStuff><script>...</script></MyStuff></nasal>
30block in preferences.xml.)
31
32setlistener("/sim/signals/click", func {
33  if (__kbd.shift.getBoolValue()) {
34    if (__kbd.ctrl.getBoolValue()) {
35      var click_pos = geo.click_position();
36      wildfire.ignite(click_pos);
37    }
38  }
39});
40
41
42Configuration properties
43-----------------------
44
45These properties can be set at runtime, in preferences.xml or in any
46other way supported by FlightGear.
47
48/environment/wildfire/enabled : bool
49  Enables/disables the whole WildFire module.
50  On disable the current state is lost. Can be used to reset WildFire.
51
52/environment/wildfire/share-events : bool
53  Enables/disables sending and receiving of fire events over the
54  multiplayer network.
55
56/environment/wildfire/fire-on-crash : bool
57  If true a fire will start if the aircraft crashes.
58
59/environment/wildfire/report-score : bool
60  Report the result of fire fighting.
61
62/environment/wildfire/models/enabled : bool
63  Enables/disables rendering of the 3d models.
64  (That is, fire, smoke, soot and foam.)
65
66/environment/wildfire/save-on-exit : bool
67  If set the current log of Wildfire events is saved in
68  ~/.fgfs/Wildfire/fire_log.xml .
69
70/environment/wildfire/restore-on-startup : bool
71  If set Wildfire will load and execute the events in
72  ~/.fgfs/Wildfire/fire_log.xml . This recreates the fire state
73  as it where when the log was saved.
74  NOTE: A long event log or one that covers a long period of time will take
75  a a lot of time to recreate.
76  Storing and reloading of the CA state, as opposed to the event log, is not
77  supported yet.
78
79
80API
81---
82
83ignite : func (pos, source=1)
84     pos    - fire location    : geo.Coord
85     source - broadcast event? : {0, 1}
86
87   Start a fire.
88
89
90resolve_water_drop : func (pos, radius, volume, source=1)
91     pos    - drop location    : geo.Coord
92     radius - drop radius m    : double
93     volume - Not used         : double
94     source - broadcast event? : {0, 1}
95
96  Extinguishes any fires in the cells within r of pos and
97  makes the cells nonflammable.
98
99resolve_retardant_drop : func (pos, radius, volume, source=1) {
100     pos    - drop location    : geo.Coord
101     radius - drop radius m    : double
102     volume - Not used         : double
103     source - broadcast event? : {0, 1}
104
105  Identical to resolve_water_drop.
106
107resolve_foam_drop : func (pos, radius, volume, source=1) {
108     pos    - drop location    : geo.Coord
109     radius - drop radius m    : double
110     volume - Not used         : double
111     source - broadcast?       : {0, 1}
112
113  Extinguishes any fires in the cells within r of pos and
114  makes the cells nonflammable and foamy.
115
116load_event_log : func (filename, skip_ahead_until=-1)
117     filename         - getprop("/sim/fg-home") ~ "/Wildfire/" ~ filename
118     skip_ahead_until - skip from last event to this time : double (epoch)
119                        fast forward from skip_ahead_until
120                        to current time.
121       x < last event   - fast forward all the way to current time (use 0).
122                          NOTE: Can be VERY time consuming.
123       -1               - skip to current time.
124
125  Loads an event log.
126  The skip_ahead_until argument can be used for synchronizing a restored
127  fire state among multiple players.
128
129save_event_log : func (filename)
130     filename         - getprop("/sim/fg-home") ~ "/Wildfire/" ~ filename
131
132  Saves an event log.
133
134print_score = func
135  Print a summary of the current wildfire state.
136
137
138/Anders
139

README.xmlhud

1Users' Guide to FlightGear Hud configuration
2December 22 2000
3Neetha Girish <neetha@ada.ernet.in>
4
5This document describes the reconfigurable HUD of
6FlightGear implemented through XML config files.
7The present reconfigurable HUD code uses most of the code
8of version 0.6.1 vintage and I have adapted the same to provide
9a reconfigurable HUD for fgfs.
10Corrections and additions are welcome.
11
12Some History:
13
14Older versions of FGFS had a hard coded display of HUD.
15This was a less than ideal state of affairs when it came to
16using different aircraft Huds. I remember, somewhere in the 0.6.1 HUD code
17it was written that the HUD code is 'presently' hard coded but ideally should
18be moved into the aircraft configuration dataset, so that when you choose
19an aircraft, its HUD loads.
20This implementation make that possible, all you have to do is to
21create appropriate 'my_aircraft.xml' files in the HUD directory and
22without re-compiling the code you could have 'your_aircraft' HUD, by choosing that
23in the .fgfsrc file or as a command line option as described later. Of course,
24as of now, I have only implemented those HUD instruments in .xml readable form
25as was available in version 0.7.6 + few more used by ADA, Bangalore for our
26aircraft carrier take-off/landing simulation studies <www.flightgear.org/projects/ADA>.
27To use the ADA specific reticles/HUD objects, please contact me/ you can figure it out
28yourself by studying the code. All of them are relevant 'only' if you use the conformal
29climb/dive ladder, since they are all referenced to it.
30The rewrite of Hud display code was done using pre and post release v0.7.6 code
31allowing for configuration of the hud via XML.
32
33The present Configurable Hud implements the entire functionality of
34fgfs HUD (called default HUD) till this date.
35
36Using Default/Custom Hud:
37
38The default HUD location is $FG_ROOT/Huds/Default.
39$FG_ROOT is the place on your filesystem where you installed FG
40data files. Alternate huds can be specified on the command line
41or set as the default in the $HOME/.fgfsrc or $FG_ROOT/preferences.xml
42using a property specification. The command line format is as follows:
43
44--prop:/sim/hud/path=Huds/Default/default.xml
45
46The path description shown is relative to $FG_ROOT. An absolute
47path may also be used for locations outside $FG_ROOT.
48For the custom Hud the path will be Huds/Custom/default.xml
49
50
51Hud - Implementation:
52
53All of the hud configuration files are XML-encoded property lists.
54The root element of each file is always named <PropertyList>. Tags are
55always found in pairs, with the closing tag having a slash prefixing
56the tag name, i.e </PropertyList>. The top level panel configuration
57file is composed of a <name> and zero or more <instruments>.
58Instruments are used by including a <"unique_name"> and a <path> to the
59instruments configuration file.
60Comments are bracketed with <!-- -->.
61
62    Example Top Level Hud Config
63
64<PropertyList>
65 <name>Default Aircraft Hud</name>
66 <instruments>
67
68  <hudladder>                   <!--unique name -->
69   <path>Huds/Instruments/Default/hudladder.xml</path>
70  </hudladder>
71
72  <hudcard>
73   <path>Huds/Instruments/Default/hudcard.xml</path>
74  </hudcard>
75
76  <instrlabel>
77   <path>Huds/Instruments/Default/instrlabel.xml</path>
78  </instrlabel>
79
80  <fgTBI>
81   <path>Huds/Instruments/Default/fgtbi.xml</path>
82  </fgTBI>
83
84 </instruments>
85</PropertyList>
86
87
88The default location for instrument files is $FG_ROOT/Huds/Instruments/Default.
89The location for custom instrument files is  $FG_ROOT/Huds/Instruments/Custom.
90The location for minimal instrument files is $FG_ROOT/Huds/Instruments/Minimal.
91Alternate locations may be specified in the hud configuration, paths
92must be absolute to use files outside $FG_ROOT.
93
94About Instrument Placement:
95
96For the sake of simplicity the FGFS HUD overlay is always 640 x 480 res.
97so all x/y values for instrument placement should fall within these bounds.
98Being an OpenGL program, 0,0 represents the lower left hand corner of the
99screen.
100
101Instrument Implementation:
102
103Instruments are defined in separate configuration files.
104The Instruments are basically classified into 4 types( Each of them an xml file) :
105The Hud Ladder,
106The Hud Card,
107The Hud Label and
108The Turn Bank Indicator
109.... (Note that that the earlier HUD classes/objects have been retained)
110Newer objects may be instantiated using the above classes, Unless a totally
111new object is required).
112
113The Default as well as the Custom directory have the same (in terms of properties)
114set of configuration files (but with different values to suit the aircraft).
115
116We have a Base class - Hud Instrument Item.
117We derive two more base classes - Instrument Scale and Dual Instrument Item from this.
118(This implementation owes its existence to all those who wrote the HUD code for 0.6.1)
119
120The Hud Instrument Label is an instantiable class derived from Hud Instrument Item -
121for displaying alphanumeric labels (altitude, velocity, Mach no and/or anything else
122as long you have a call back function to pass the value using the property
123'data_source').
124
125The Hud Card is an instantiable class derived from Instrument scale - for displaying
126tapes and gauges (single variable display, for displaying aoa, g's, vsi,
127elevator_posn, etc.).
128
129The Hud Ladder is an instantiable class derived from Dual Instrument Item - for
130displaying pitch reference ladder or climb/dive ladder (two variable display, for
131displaying two types of ladders, the pitch reference ladder or the climb/dive ladder
132as defined by MIL-1787b).
133
134The fgTBI Instrument is an instantiable class derived from Dual Instrument scale
135again - for display of Bank angle and Sideslip (two variable display, for display
136of TSI info, kept different from the two variable ladder object basically because
137of its totally different draw member function).
138
139Most Hud instruments may be instantiated using above. It is proposed to provide all
140Hud objects as defined in MIL-STD-1797A, soon.
141
142Here is how you position 'any' object:
143
144x ____________ x+width
145  |          |
146  |          |
147y ------------ y+height
148
149this defines the objects position centered about the centroid of above rectangle
150in HUD overlay plane (640x480) coordinates with 0,0 at bottom-left corner.
151
152One more, pixels per degree in the ladder class represents the compression factor of
153the pitch ladder. In case of conformal HUD (climb/dive ladder) it is
154<640/horizontal_fov> or <480/vertical_fov>. In case of pitch reference ladder it is
155<your_no_of vertical_pixels/your_no_of_ladder_degrees>.
156
157Example of Hud Ladder xml file.
158
159<PropertyList>
160
161 <ladders>
162
163  <l1>
164  <name>Pitch Ladder</name>     <!-- Name can be Pitch Ladder or Climb/Dive Ladder  -->
165  <x>260</x>                    <!-- x start -->
166  <y>150</y>                    <!-- y start -->
167  <width>120</width>            <!-- x start + width = x end -->
168  <height>180</height>          <!-- y start + height = y end -->
169  <compression_factor>2.68</compression_factor>    <!-- Pixels per degree -->
170  <loadfn>roll</loadfn>         <!-- Name of the function to be called, here
171                                     get_roll() is called provision made in Hud.cxx -->
172  <loadfn1>pitch</loadfn1>      <!-- Name of the function to be called, here get_pitch()
173                                     is called -->
174  <span_units>45.0</span_units>         <!-- Range of the Ladder seen at any instant -->
175  <division_units>10.0</division_units> <!-- Divisions -->
176  <screen_hole>70</screen_hole>         <!-- Hole b/w the Ladder Bars -->
177  <lbl_pos>0</lbl_pos>                  <!-- Label Position to indicate pitch angle on bar -->
178  <enable_frl>false</enable_frl>        <!-- To Enable Pitch Reference Symbol (used by us) -->
179  <enable_target_spot>true</enable_target_spot>                <!-- To Enable Target Spot Symbol (fgfs uses this) -->
180  <enable_velocity_vector>false</enable_velocity_vector>       <!-- To Enable Velocity Vector Symbol (use only with climb/dive ladder) -->
181  <enable_drift_marker>false</enable_drift_marker>             <!-- To Enable Drift Marker Symbol (used by us) -->
182  <enable_alpha_bracket>false</enable_alpha_bracket>           <!-- To Enable Alpha Bracket Symbol (used by us, presently hard coded bracket values, alpha values will be moved to xml file) -->
183  <enable_energy_marker>false</enable_energy_marker>           <!-- To Enable Energy Marker Symbol (used by us) -->
184  <enable_climb_dive_marker>false</enable_climb_dive_marker>   <!-- To Enable Climb/Dive Marker (used by us) -->
185  <enable_glide_slope_marker>false</enable_glide_slope_marker> <!-- To Enable Glide/Slope Marker (tied to climb/dive ladder only) -->
186  <glide_slope>0.0</glide_slope>                               <!-- Glide slope angle (specify the angle for drawing the reference bar) -->
187  <enable_energy_worm>false</enable_energy_worm>               <!-- To Enable Energy worm (used by us) -->
188  <enable_waypoint_marker>false</enable_waypoint_marker>       <!-- To Enable Way point Marker (bearing marker) -->
189  <working>true</working>                                      <!-- use this to enable or disable whole object -->
190  </l1>
191
192 </ladders>
193
194</PropertyList>
195
196Before you read this, _____ this is tick_top        |                  |
197                           |                        |                  |
198                           |                        |__________________|
199                           | this is cap_right,tick_left  cap_bottom    tick_right
200                           |
201                      _____| this is tick_bottom
202
203Example of Hud Card xml file.
204
205<PropertyList>
206
207 <cards>
208
209  <c1>
210   <name>Gyrocompass</name>
211   <x>220</x>
212   <y>430</y>
213   <width>200</width>
214   <height>28</height>
215   <loadfn>heading</loadfn>     <!-- Name of the function to be called, here get_Heading() is called -->
216   <options>4</options>         <!--  Read Tape Options Below or Hud.hxx file for details -->
217   <maxValue>360.0</maxValue>   <!-- Maximum scale value -->
218   <minValue>0.0</minValue>     <!-- Minimum Scale Value -->
219   <disp_scaling>1.0</disp_scaling> <!-- Multiply by this to get numbers shown on scale -->
220   <major_divs>5</major_divs>       <!-- major division marker units -->
221   <minor_divs>1</minor_divs>       <!-- minor division marker units -->
222   <modulator>360</modulator>       <!-- Its a rose, Roll Over Point -->
223   <value_span>25.0</value_span>    <!-- Range Shown  -->
224   <type>tape</type>                <!-- Card type can be "tape" or "gauge" -->
225   <tick_bottom>false</tick_bottom> <!-- Read Ticks and Caps below -->
226   <tick_top>false</tick_top>
227   <tick_right>true</tick_right>
228   <tick_left>true</tick_left>
229   <cap_bottom>true</cap_bottom>
230   <cap_top>false</cap_top>
231   <cap_right>false</cap_right>
232   <cap_left>false</cap_left>
233   <marker_offset>0.0</marker_offset>    <!-- Read Marker offset below -->
234   <enable_pointer>true</enable_pointer> <!-- To draw a pointer -->
235   <pointer_type>fixed</pointer_type>    <!-- Type of pointer, Fixed or Moving (yet to be implemented) -->
236   <working>true</working>
237  </c1>
238
239 </cards>
240
241</PropertyList>
242
243Tape Options:
244
245HUDS_AUTOTICKS    =     0x0001
246HUDS_VERT         =     0x0002
247HUDS_HORZ         =     0x0000
248HUDS_TOP          =     0x0004
249HUDS_BOTTOM       =     0x0008
250HUDS_LEFT         =     HUDS_TOP
251HUDS_RIGHT        =     HUDS_BOTTOM
252HUDS_BOTH         =     (HUDS_LEFT | HUDS_RIGHT)
253HUDS_NOTICKS      =     0x0010
254HUDS_ARITHTIC     =     0x0020
255HUDS_DECITICS     =     0x0040
256HUDS_NOTEXT       =     0x0080
257HUDS_LEFT | HUDS_VERT   = 0x0006
258HUDS_RIGHT | HUDS_VERT  = 0x0010
259HUDS_TOP | HUDS_NOTEXT  = 0x0084
260HUDS_BOTTOM | HUDS_NOTEXT = 0x0088
261HUDS_VERT | HUDS_LEFT | HUDS_NOTEXT  = 0x0086
262HUDS_RIGHT | HUDS_VERT | HUDS_NOTEXT = 0x0090
263
264
265For clarity, I repeat, Ticks and Caps :
266
267
2681. Left Tick ->|_____|<- Right Tick
269                  |
270                  v
271             Bottom Cap
272
2732.    Top Cap
274         |
275         v
276       _____
277      |     |
278
279
2803.    Top Tick
281         |
282         v
283        ---
284           |
285           |<- Right Cap
286           |
287        ---
288         |
289         v
290       Bottom Tick
291
2924.            ---
293              |
294  Left Cap -> |
295              |
296              ---
297
298Marker Offset :
299
300To Draw pointer on the scale markings. In the case of a our hud with offset 10.0
301The pointer is away from the scale and points at the markings.
302
303        -|                      -
304        -|                      -
305        <|                      -<
306        -|                      -
307        -|                      -
308Marker offset = 0.0     Marker offset = 10.0
309
310This should be useful when I implement the fixed tape/moving pointer.
311
312
313Example of a Label xml file.
314
315<PropertyList>
316
317 <labels>
318
319  <i1>
320   <name>machno</name>
321   <x>25</x>
322   <y>130</y>
323   <width>40</width>
324   <height>30</height>
325   <data_source>mach</data_source>    <!-- Name of the function to be called, here get_Heading() is called -->
326   <label_format>%4.2f</label_format> <!-- The Label Format -->
327   <pre_label_string>blank</pre_label_string>  <!-- String to be written Pre Label -->
328   <post_label_string>NULL</post_label_string> <!-- String to be written Post Label -->
329   <scale_data>1.0</scale_data>
330   <options>4</options>               <!-- Read Tape options or Hud.hxx -->
331   <justification>2</justification>   <!-- Justify the label, 0=LEFT_JUSTIFY, 1=CENTER_JUSTIFY, 2=RIGHT_JUSTIFY -->
332   <blinking>0</blinking>             <!-- Yet to be implemented -->
333   <working>true</working>
334   <latitude>false</latitude>         <!-- True if the label is to display Latitude (special label, displays deg.min.sec) -->
335   <longitude>false</longitude>       <!-- True if the label is to display Longitude (special label, displays deg.min.sec) -->
336  </i1>
337
338 </labels>
339
340</PropertyList>
341
342
343Example of a Turn Bank Indicator xml file.
344
345<PropertyList>
346
347 <tbis>
348
349  <f1>
350  <name>fgTBI_Instrument</name>
351  <x>290</x>
352  <y>45</y>
353  <width>60</width>
354  <height>10</height>
355  <loadfn>roll</loadfn>       <!-- Name of the function to be called, get_roll() is called here. -->
356  <loadfn1>sideslip</loadfn1> <!-- Name of the function to be called, get_sideslip() is called here. -->
357  <maxBankAngle>45.0</maxBankAngle> <!-- Maximum Angle of Bank -->
358  <maxSlipAngle>5.0</maxSlipAngle>  <!-- Maximum Angle of Slip -->
359  <gap_width>5</gap_width>          <!-- Screen Hole -->
360  <working>true</working>
361  </f1>
362
363 </tbis>
364
365</PropertyList>
366
367I have still got to implement dials (as in MIL-STD-1787b).
368
369REMEMBER IF YOU NEED TO INDICATE ANY OTHER PARAMETER ON THE HUD OTHER THAN WHAT IS PROVIDED AS
370CALLBACK FUNCTIONS (PROPERTY NAMES LISTED BELOW) YOU HAVE TO FIDDLE WITH THE CODE, AS YET. LET ME
371KNOW AND I SHALL INCLUDE THAT.
372
373<loadfn>anzg</loadfn>             <!-- Here get_anzg() is called -->
374<loadfn>heading</loadfn>          <!-- Here get_heading() is called -->
375<loadfn>aoa</loadfn>              <!-- Here get_aoa() is called -->
376<loadfn>climb</loadfn>            <!-- Here get_climb() is called -->
377<loadfn>altitude</loadfn>         <!-- Here get_altitude() is called -->
378<loadfn>agl</loadfn>              <!-- Here get_agl() is called -->
379<loadfn>speed</loadfn>            <!-- Here get_speed() is called -->
380<loadfn>view_direction</loadfn>   <!-- Here get_view_direction() is called -->
381<loadfn>aileronval</loadfn>       <!-- Here get_aileronval() is called -->
382<loadfn>elevatorval</loadfn>      <!-- Here get_elevatorval() is called -->
383<loadfn>rudderval</loadfn>        <!-- Here get_rudderval() is called -->
384<loadfn>throttleval</loadfn>      <!-- Here get_throttleval() is called -->
385<loadfn>aux16</loadfn>            <!-- Here get_aux16() is called -->
386<loadfn>aux17</loadfn>            <!-- Here get_aux17() is called -->
387<loadfn>aux9</loadfn>             <!-- Here get_aux9() is called -->
388<loadfn>aux11</loadfn>            <!-- Here get_aux11() is called -->
389<loadfn>aux12</loadfn>            <!-- Here get_aux12() is called -->
390<loadfn>aux10</loadfn>            <!-- Here get_aux10() is called -->
391<loadfn>aux13</loadfn>            <!-- Here get_aux13() is called -->
392<loadfn>aux14</loadfn>            <!-- Here get_aux14() is called -->
393<loadfn>aux15</loadfn>            <!-- Here get_aux15() is called -->
394<loadfn>aux8</loadfn>             <!-- Here get_aux8() is called -->
395<loadfn>ax</loadfn>               <!-- Here get_Ax() is called -->
396<loadfn>mach</loadfn>             <!-- Here get_mach() is called -->
397<loadfn>framerate</loadfn>        <!-- Here get_frame_rate() is called -->
398<loadfn>fov</loadfn>              <!-- Here get_fov() is called -->
399<loadfn>vfc_tris_culled</loadfn>  <!-- Here get_vfc_tris_culled() is called -->
400<loadfn>vfc_tris_drawn</loadfn>   <!-- Here get_vfc_tris_drawn() is called -->
401<loadfn>latitude</loadfn>         <!-- Here get_latitude() is called -->
402<loadfn>longitude</loadfn>        <!-- Here get_longitude() is called -->
403
404
405
406
407
408
409
410
411
412
413
414
415

README.xmlpanel

1Users Guide to FlightGear panel configuration
2Version 0.7.7, May 16 2001
3Author: John Check <j4strngs@rockfish.net>
4
5This document is an attempt to describe the configuration of
6FlightGear flight simulator's aircraft panel display via XML.  The
7information was culled from the fgfs-devel@flightgear.org mailing list
8and my experiences making alternate panels.  Corrections and additions
9are encouraged.
10
11Some History:
12------------
13Older versions of FGFS had a hard coded display of instruments.  This
14was a less than ideal state of affairs due to FGFS ability to use
15different aircraft models. Being primarily developed on UNIX type
16systems, a modular approach is taken towards the simulation. To date,
17most alternatives to the default Cessna 172 aircraft are the product
18of research institutions interested in the flight characteristics and
19not cosmetics.  The result of this was that one could fly the X-15 or
20a Boeing 747 but be limited to C172 instrumentation.
21
22A rewrite of the panel display code was done around v0.7.5 by
23developer David Megginson allowing for configuration of the panel via
24XML to address this limitation. Some major changes and additions were
25made during the course of version 0.7.7 necessitating a rewrite and
26expansion of this document.
27
28
29About The Property Manager:
30--------------------------
31While not absolutely necessary in order to create aircraft panels,
32some familiarity with the property manager is beneficial....
33FlightGear provides a hierarchical representation of all aspects of
34the state of the running simulation that is known as the property
35tree.  Some properties, such as velocities are read only. Others such
36as the frequencies to which the navcom radios are tuned or the
37position of control surfaces can be set by various means.  FlightGear
38can optionally provide an interface to these properties for external
39applications such as Atlas, the moving map program, or even lowly
40telnet, via a network socket. Data can even be placed on a serial port
41and connected to, say a GPS receiver.  Aside from its usefulness in a
42flight training context, being able to manipulate the property tree on
43a running copy of FG allows for switching components on the fly, a
44positive boon for panel authors.  To see the property tree start FG
45with the following command line:
46
47fgfs --props=socket,bi,5,localhost,5500,tcp
48
49Then use telnet to connect to localhost on port 5500. You can browse
50the tree as you would a filesystem.
51
52XML and the Property Manager:
53----------------------------
54Panel instruments interface with the property tree to get/set values
55as appropriate. Properties for which FG doesn't yet provide a value
56can be created by simply making them up. Values can be adjusted using
57the telnet interface allowing for creation and testing of instruments
58while code to drive them is being developed.
59
60If fact, the XML configuration system allows a user to combine
61components such as flight data model, aircraft exterior model, heads
62up display, and of course control panel. Furthermore, such a
63preconfigured aircraft.xml can be included into a scenario with
64specific flight conditions. These can be manually specified or a FG
65session can be saved and/or edited and reloaded later. Options
66specified in these files can be overridden on the command line. For
67example:
68
69--prop:/sim/panel/path=Aircraft/c172/Panels/c172-panel.xml
70
71passed as an option, would override a panel specified elsewhere.
72Property tree options all have the same format, specify the node and
73supply it a value.
74
75The order of precedence for options is thus:
76
77Source          Location                Format
78------          --------                ------
79command line
80.fgfsrc         Users home directory.   command line options
81system.fgfsrc   $FG_ROOT                ""      ""
82preferences.xml $FG_ROOT                XML property list
83
84
85Loading Panels on the fly:
86-------------------------
87When editing a panel configuration, pressing Shift +F3 will reload the
88panel. If your changes don't seem to be taking effect, check the
89console output.  It will report the success or failure of the panel
90reload*. Editing textures requires restarting FGFS so the new textures
91can be loaded. Panels can be switched on the fly by setting the
92/sim/panel/path property value and reloading.
93
94Regarding Window Geometry:
95-------------------------
96For the sake of simplicity the FGFS window is always considered to be
971024x768 so all x/y values for instrument placement should relative to
98these dimensions.  Since FG uses OpenGL 0,0 represents the lower left
99hand corner of the screen. Panels may have a virtual size larger than
1001024x768. Vertical scrolling is accomplished with
101Shift+F5/F6. Horizontal scrolling is via Shift+F7/F8. An offset should
102be supplied to set the default visible area. It is possible to place
103items to overlap the 3D viewport.
104
105Panel Architecture:
106-------------------
107All of the panel configuration files are XML-encoded* property lists.
108The root element of each file is always named <PropertyList>. Tags are
109almost always found in pairs, with the closing tag having a slash
110prefixing the tag name, i.e </PropertyList>. The exception is the tag
111representing an aliased property. In this case a slash is prepended to
112the closing angle bracket.  (see section Aliasing)
113
114The top level panel configuration file is composed of a <name>, a
115<background> texture and zero or more <instruments>.Earlier versions
116required instruments to have a unique name and a path specification
117pointing to the instruments configuration file.
118
119[ Paths are relative to $FG_ROOT (the installed location of FGFS data files.) ]
120[ Absolute paths may be used.Comments are bracketed with <!-- -->.            ]
121
122Old style instrument call in top level panel.xml:
123------------------------------------------------
124  <clock>         <!-- required "unique_name" -->
125   <path>Aircraft/c172/Instruments/clock.xml</path>
126   <x>110</x>     <!-- required horizontal placement -->
127   <y>320</y>     <!-- required vertical placement -->
128   <w>72</w>      <!-- optional width specification -->
129   <h>72</h>      <!-- optional height specification -->
130  </clock>
131
132The difference between the old and new styles, while subtle, is rather
133drastic.  The old and new methods are indeed incompatible. I cover the
134old style only to acknowledge the incompatibility. This section will
135be removed after the next official FGFS release.
136
137New Style Example Top Level Panel Config:
138----------------------------------------
139<PropertyList>
140 <name>Example Panel</name>
141 <background>Aircraft/c172/Panels/Textures/panel-bg.rgb</background>
142 <w>1024</w>                      <!-- virtual width -->
143 <h>768</h>                       <!-- virtual height -->
144 <y-offset>-305</y-offset>        <!-- hides the bottom part -->
145 <view-height>172</view-height>   <!-- amount of overlap between 2D panel
146                                       and 3D viewport -->
147
148 <instruments>                    <!-- from here down is where old and new
149                                       styles break compatibility -->
150
151  <instrument include="../Instruments/clock.xml">
152   <name>Chronometer</name>   <!-- currently optional but strongly recommended -->
153   <x>150</x>                 <!-- required horizontal placement -->
154   <y>645</y>                 <!-- required vertical placement -->
155   <w>72</w>                  <!-- optional width specification -->
156   <h>72</h>                  <!-- optional height specification -->
157  </instrument>
158
159 </instruments>
160
161</PropertyList>
162
163
164Indexed Properties
165------------------
166This is a lot to do with the compatibility break so lets get it out of
167the way.  The property manager now assigns incremental indices to
168repeated properties with the same parent node, so that
169
170 <PropertyList>
171 <x>1</x>
172 <x>2</x>
173 <x>3</x>
174 </PropertyList>
175
176shows up as
177
178 /x[0] = 1
179 /x[1] = 2
180 /x[2] = 3
181
182This means that property files no longer need to make up a separate
183name for each item in a list of instruments, layers, actions,
184transformations, or text chunks. In fact, the new panel I/O code now
185insists that every instrument have the XML element name "instrument",
186every layer have the name "layer", every text chunk have the name
187"chunk", every action have the name "action", and every transformation
188have the name "transformation" -- this makes the XML more regular (so
189that it can be created in a DTD-driven tool) and also allows us to
190include other kinds of information (such as doc strings) in the lists
191without causing confusion.
192
193Inclusion:
194----------
195The property manager now supports file inclusion and aliasing.
196Inclusion means that a node can include another property file as if it
197were a part of the current file.  To clarify how inclusion works,
198consider the following examples:
199
200If bar.xml contains
201
202 <PropertyList>
203 <a>1</a>
204 <b>
205 <c>2</c>
206 </b>
207 </PropertyList>
208
209then the declaration
210
211 <foo include="../bar.xml">
212 </foo>
213
214is exactly equivalent to
215
216 <foo>
217 <a>1</a>
218 <b>
219 <c>2</c>
220 </b>
221 </foo>
222
223However, it is also possible to selectively override properties in the
224included file. For example, if the declaration were
225
226 <foo include="../bar.xml">
227 <a>3</a>
228 </foo>
229
230then the property manager would see
231
232 <foo>
233 <a>3</a>
234 <b>
235 <c>2</c>
236 </b>
237 </foo>
238
239with the original 'a' property's value replaced with 3.
240
241This new inclusion feature allows property files to be broken up and
242reused arbitrarily -- for example, there might be separate cropping
243property lists for commonly-used textures or layers, to avoid
244repeating the information in each instrument file.
245
246
247Aliasing
248--------
249Properties can now alias other properties, similar to a symbolic link
250in Unix. When the target property changes value, the new value will
251show up in the aliased property as well. For example,
252
253 <PropertyList>
254 <foo>3</foo>
255 <bar alias="/foo"/>
256 </PropertyList>
257
258will look the same to the application as
259
260 <PropertyList>
261 <foo>3</foo>
262 <bar>3</bar>
263 </PropertyList>
264
265except that when foo changes value, bar will change too.
266
267
268The combination of inclusions and aliases is very powerful, because it
269allows for parameterized property files. For example, the XML file for
270the NAVCOM radio can include a parameter subtree at the start, like
271this:
272
273 <PropertyList>
274 <params>
275 <comm-freq-prop>/radios/comm1/frequencies/selected</comm-freq-prop>
276 <nav-freq-prop>/radios/nav1/frequencies/selected</comm-freq-prop>
277 </params>
278
279 ...
280
281 <chunk>
282 <type>number-value</type>
283 <property alias="/params/nav-freq-prop"/>
284 </chunk>
285
286 ...
287 </PropertyList>
288
289Now, the same instrument file can be used for navcomm1 and navcomm2,
290for example, simply by overriding the parameters at inclusion:
291
292 <instrument include="../Instruments/navcomm.xml">
293 <params>
294 <comm-freq-prop>/radios/comm1/frequencies/selected</comm-freq-prop>
295 <nav-freq-prop>/radios/nav1/frequencies/selected</comm-freq-prop>
296 </params>
297 </instrument>
298
299 <instrument include="../Instruments/navcomm.xml">
300 <params>
301 <comm-freq-prop>/radios/comm2/frequencies/selected</comm-freq-prop>
302 <nav-freq-prop>/radios/nav2/frequencies/selected</comm-freq-prop>
303 </params>
304 </instrument>
305
306Instrument Architecture:
307-----------------------
308Instruments are defined in separate configuration files. An instrument
309consists of a base width and height, one or more stacked layers, and
310zero or more actions. Base dimensions are specified as follows:
311
312<PropertyList>                   <!-- remember, all xml files start like this -->
313 <name>Airspeed Indicator</name> <!-- names are good -->
314 <w-base>128</w-base>            <!-- required width spec-->
315 <h-base>128</h-base>            <!-- required height spec-->
316  <layers>                       <!-- begins layers section -->
317
318Height and width can be overriden in the top level panel.xml by
319specifying <w> and <h>. Transformations are caculated against the base
320size regardless of the display size. This ensures that instruments
321remain calibrated
322
323Textures:
324--------
325FG uses red/green/blue/alpha .rgba files for textures. Dimensions for
326texture files should be power of 2 with a maximum 8:1 aspect ratio.
327The lowest common denominator for maximum texture size is 256 pixels.
328This is due to the limitations of certain video accelerators, most
329notably those with 3Dfx chipset such as the Voodoo2.
330
331Instrument Layers**:
332-------------------
333The simplest layer is a <texture>. These can be combined in <switch> layers
334
335<texture>
336A texture layer looks like this:
337
338  <layer>                      <!-- creates a layer -->
339   <name>face</name>
340   <texture>                   <!-- defines it as a texture layer -->
341    <path>Aircraft/c172/Instruments/Textures/faces-2.rgb</path>
342    <x1>0</x1>                 <!-- lower boundary for texture cropping-->
343    <y1>0.51</y1>              <!-- left boundary  for texture cropping-->
344    <x2>0.49</x2>              <!-- upper boundary  for texture cropping-->
345    <y2>1.0</y2>               <!-- right boundary  for texture cropping-->
346   </texture>                  <!-- closing texure tag -->
347  </layer>                     <!-- closing layer tag -->
348
349The texture cropping specification is represented as a decimal. There
350is a table at the end of this document for converting from pixel
351coordinates to percentages.
352
353This particular layer, being a gauge face has no transformations
354applied to it.  Layers with that aren't static *must* include <w> and
355<h> parameters to be visible.
356
357<type> May be either text or switch..
358
359<type>switch</type>
360A switch layer is composed of two or more nested layers and will
361display one of the nested layers based on a boolean property. For a
362simple example of a switch see
363$FG_ROOT/Aircraft/c172/Instruments/brake.xml.
364
365  <layer>
366   <name>Brake light</name>
367   <type>switch</type>                    <!-- define layer as a switch -->
368   <property>/controls/brakes</property>  <!-- tie it to a property -->
369    <layer1>                              <!-- layer for true state -->
370     <name>on</name>                      <!-- label to make life easy -->
371     <texture>                            <!-- layer1 of switch is a texture layer -->
372     <path>Aircraft/c172/Instruments/Textures/brake.rgb</path>
373     <x1>0.25</x1>
374     <y1>0.0</y1>
375     <x2>0.5</x2>
376     <y2>0.095</y2>
377     </texture>
378     <w>64</w>                          <!-- required width - layer isn't static -->
379     <h>24</h>                          <!-- required height - layer isn't static -->
380    </layer1>                           <!-- close layer1 of switch -->
381    <layer2>                            <!-- layer for false state -->
382     <name>off</name>
383     <texture>
384     <path>Aircraft/c172/Instruments/Textures/brake.rgb</path>
385     <x1>0.0</x1>
386     <y1>0.0</y1>
387     <x2>0.25</x2>
388     <y2>0.095</y2>
389     </texture>
390     <w>64</w>
391     <h>24</h>
392   </layer2>
393  </layer>
394
395Switches can have more than 2 states. This requires nesting one switch
396inside another.  One could make, for example, a 3 color LED by nesting
397switch layers.
398
399<type>text</type>
400A text layer may be static, as in a label, generated from a property
401or a combination of both.  This example is a switch that contains both
402static and dynamic text:
403
404 <layer1>                         <!-- switch layer -->
405  <name>display</name>
406  <type>text</type>               <!-- type == text -->
407  <point-size>12</point-size>     <!-- font size -->
408  <color>                         <!-- specify rgb values to color text -->
409   <red>1.0</red>
410   <green>0.5</green>
411   <blue>0.0</blue>
412  </color>                        <!-- close color section -->
413  <chunks>                        <!-- sections of text are referred to as chunks -->
414   <chunk>                        <!-- first chunk of text -->
415    <type>number-value</type>     <!-- value defines it as dynamic -->
416    <property>/radios/nav1/dme/distance</property>    <!-- ties it to a property -->
417    <scale>0.00053995680</scale>  <!-- convert between statute and nautical miles? -->
418    <format>%5.1f</format>        <!-- define format -->
419   </chunk>
420  </chunks>
421 </layer1>
422 <layer2>                         <!-- switch layer -->
423  <name>display</name>
424  <type>text</type>               <!-- type == text -->
425  <point-size>10</point-size>     <!-- font size -->
426  <color>                         <!-- specify rgb values to color text -->
427   <red>1.0</red>
428   <green>0.5</green>
429   <blue>0.0</blue>
430  </color>                        <!-- close color section -->
431  <chunks>                        <!-- sections of text are referred to as chunks -->
432   <chunk>                        <!-- first chunk of text -->
433    <type>literal</type>          <!-- static text -->
434    <text>---.--</text>           <!-- fixed value -->
435   </chunk>
436  </chunks>
437 </layer2>
438
439
440Transformations:
441---------------
442A transformation is a rotation, an x-shift, or a
443y-shift. Transformations can be static or they can be based on
444properties. Static rotations are useful for flipping textures
445horizontally or vertically. Transformations based on properties are
446useful for driving instrument needles. I.E. rotate the number of
447degrees equal to the airspeed. X and y shifts are relative to the
448center of the instrument. Each specified transformation type takes an
449<offset>.  Offsets are relative to the center of the instrument. A
450shift without an offset has no effect. For example, let's say we have
451a texure that is a circle. If we use this texture in two layers, one
452defined as having a size of 128x128 and the second layer is defined as
45364x64 and neither is supplied a shift and offset the net result
454appears as 2 concentric circles.
455
456
457About Transformations and Needle Placement:
458------------------------------------------
459
460When describing placement of instrument needles, a transformation
461offset must be applied to shift the needles fulcrum or else the needle
462will rotate around it's middle. The offset will be of <type> x-shift
463or y-shift depending on the orientation of the needle section in the
464cropped texture.
465
466This example comes from the altimeter.xml
467
468  <layer>
469   <name>long needle (hundreds)</name>  <!-- the altimeter has more than one needle -->
470   <texture>
471    <path>Aircraft/c172/Instruments/Textures/misc-1.rgb</path>
472    <x1>0.8</x1>
473    <y1>0.78125</y1>
474    <x2>0.8375</x2>
475    <y2>1.0</y2>
476   </texture>
477   <w>8</w>
478   <h>56</h>
479   <transformations>                    <!-- begin defining transformations -->
480    <transformation>                    <!-- start definition of
481                                             transformation that drives the needle -->
482     <type>rotation</type>
483     <property>/steam/altitude</property>  <!-- bind it to a property -->
484     <max>100000.0</max>                <!-- upper limit of instrument -->
485     <scale>0.36</scale>                <!-- once around == 1000 ft -->
486    </transformation>                   <!-- close this transformation -->
487    <transformation>                    <!-- shift the fulcrum of the needle -->
488     <type>y-shift</type>               <!-- y-shift relative to needle -->
489     <offset>24.0</offset>              <!-- amount of shift -->
490    </transformation>
491   </transformations>
492  </layer>
493
494This needles has its origin in the center of the instrument. If the
495needles fulcrum was towards the edge of the instrument, the
496transformations to place the pivot point must precede those which
497drive the needle,
498
499Interpolation
500-------------
501Non linear transformations are now possible via the use of
502interpolation tables.
503
504 <transformation>
505 ...
506 <interpolation>
507 <entry>
508 <ind>0.0</ind>            <!-- raw value -->
509 <dep>0.0</dep>            <!-- displayed value -->
510 </entry>
511 <entry>
512 <ind>10.0</ind>
513 <dep>100.0</dep>
514 </entry>
515 <entry>
516 <ind>20.0</ind>
517 <dep>-5.0</dep>
518 </entry>
519 <entry>
520 <ind>30.0</ind>
521 <dep>1000.0</dep>
522 </entry>
523 </interpolation>
524 </transformation>
525
526Of course, interpolation tables are useful for non-linear stuff, as in
527the above example, but I kind-of like the idea of using them for
528pretty much everything, including non-trivial linear movement -- many
529instrument markings aren't evenly spaced, and the interpolation tables
530are much nicer than the older min/max/scale/offset stuff and should
531allow for a more realistic panel without adding a full equation parser
532to the property manager.
533
534If you want to try this out, look at the airspeed.xml file in the base
535package, and uncomment the interpolation table in it for a very funky,
536non-linear and totally unreliable airspeed indicator.
537
538
539Actions:
540-------
541An action is a hotspot on an instrument where something will happen
542when the user clicks the left or center mouse button.  Actions are
543always tied to properties: they can toggle a boolean property, adjust
544the value of a numeric property, or swap the values of two properties.
545The x/y placement for actions specifies the origin of the lower left
546corner.  In the following example the first action sets up a hotspot
54732 pixels wide and 16 pixels high. It lower left corner is placed 96
548pixels (relative to the defined base size of the instrument) to the
549right of the center of the instrument. It is also 32 pixels below the
550centerline of the instrument.  The actual knob texture over which the
551action is superimposed is 32x32.  Omitted here is a second action,
552bound to the same property, with a positive increment value. This
553second action is placed to cover the other half of the knob. The
554result is that clicking on the left half of the knob texture decreases
555the value and clicking the right half increases the value. Also
556omitted here is a second pair of actions with the same coordinates but
557a larger increment value. This second pair is bound to a different
558mouse button. The net result is that we have both fine and coarse
559adjustments in the same hotspot, each bound to a different mouse
560button.
561
562These examples come from the radio stack:
563<actions>                              <!-- open the actions section -->
564  <action>                             <!- first action -->
565   <name>small nav frequency decrease</name>
566   <type>adjust</type>
567   <button>0</button>                  <!-- bind it to a mouse button -->
568   <x>96</x>                           <!-- placement relative to instrument center -->
569   <y>-32</y>
570   <w>16</w>                           <!-- size of hotspot -->
571   <h>32</h>
572   <property>/radios/nav1/frequencies/standby</property>    <!-- bind to a property -->
573   <increment>-0.05</increment>        <!-- amount of adjustment per mouse click -->
574   <min>108.0</min>                    <!-- lower range -->
575   <max>117.95</max>                   <!-- upper range -->
576   <wrap>1</wrap>                      <!-- value wraps around when it hits bounds -->
577  </action>
578  <action>
579   <name>swap nav frequencies</name>
580   <type>swap</type>                   <!-- define type of action -->
581   <button>0</button>
582   <x>48</x>
583   <y>-32</y>
584   <w>32</w>
585   <h>32</h>
586   <property1>/radios/nav1/frequencies/selected</property1>   <!-- properties to
587   <property2>/radios/nav1/frequencies/standby</property2>         toggle between -->
588  </action>
589  <action>
590   <name>ident volume on/off</name>
591   <type>adjust</type>
592   <button>1</button>
593   <x>40</x>
594   <y>-24</y>
595   <w>16</w>
596   <h>16</h>
597   <property>/radios/nav1/ident</property>  <!-- Morse code ID of nav beacons -->
598   <increment>1.0</increment>          <!-- the increment equals the max value
599                                            so this toggles on/off -->
600   <min>0</min>
601   <max>1</max>
602   <wrap>1</wrap>                      <!-- a shortcut to avoid having separate
603                                            actions for on/off -->
604  </action>
605</actions>
606
607More About Textures:
608-------------------
609As previously stated, the usual size instrument texture files in FGFS
610are 256x256 pixels, red/green/blue/alpha format. However the mechanism
611for specifying texture cropping coordinates is decimal in nature. When
612calling a section of a texture file the 0,0 lower left convention is
613used.  There is a pair of x/y coordinates defining which section of
614the texture to use.
615
616The following table can be used to calculate texture cropping
617specifications.
618
619# of divisions | width in pixels | decimal specification
620per axis
621        1   =   256 pixels              1
622        2   =   128 pixels,             0.5
623        4   =   64 pixels,              0.25
624        8   =   32 pixels,              0.125
625        16  =   16 pixels,              0.0625
626        32  =   8 pixels,               0.03125
627        64  =   4 pixels,               0.015625
628        128 =   2 pixels,               0.0078125
629
630A common procedure for generating gauge faces is to use a vector
631graphics package such as xfig, exporting the result as a postscript
632file. 3D modeling tools may also be used and I prefer them for pretty
633items such as levers, switches, bezels and so forth.  Ideally, the
634size of the item in the final render should be of proportions that fit
635into the recommended pixel widths.  The resulting files can be
636imported into a graphics manipulation package such as GIMP, et al for
637final processing.
638
639How do I get my panels/instruments into the base package?
640-------------------------------------------------------
641Cash bribes always help ;) Seriously though, there are two main
642considerations.  Firstly, original artwork is a major plus since you
643as the creator can dictate the terms of distribution.  All Artwork must
644have a license compatible with the GPL.  Artwork of unverifiable
645origin is not acceptable.  Secondly, texture sizes must meet the
646lowest common denominator of 256e2 pixels.  Artwork from third parties
647may be acceptable if it meets these criteria.
648
649*  If there are *any* XML parsing errors, the panel will fail to load,
650   so it's worth downloading a parser like Expat (http://www.jclark.com/xml/)
651   for checking your XML. FlightGear will print the location of errors, but
652   the messages are a little cryptic right now.
653
654** NOTE: There is one built-in layer -- for the mag compass ribbon --
655   and all other layers are defined in the XML files.  In the future,
656   there may also be built-in layers for special things like a
657   weather-radar display or a GPS (though the GPS could be handled with
658   text properties).
659
660

README.xmlparticles

1Document started 27/01/2008 by Tiago Gusmão
2Updated 02/02/2008 to reflect syntax changes
3Updated 03/02/2008 to add trails (connected particles)
4
5This is a short specification/tutorial to define particle systems in
6FlightGear using XML
7
8Meaningless example (what i had accumulated due to tests):
9
10  <particlesystem>
11    <name>fuel</name>
12<!--     <texture>particle.rgb</texture> -->
13    <emissive>false</emissive>
14    <lighting>true</lighting>
15
16    <offsets>
17      <x-m>35</x-m>
18      <y-m>-0.3</y-m>
19      <z-m>0</z-m>
20      <!--<pitch-deg>90</pitch-deg>-->
21    </offsets>
22
23    <!--<condition>
24      <and>
25        <equals>
26          <property>engines/engine/smoking</property>
27          <value>true</value>
28        </equals>
29        <less-than>
30          <property>position/altitude-agl-ft</property>
31          <value>12000</value>
32        </less-than>
33      </and>
34    </condition>-->
35
36    <attach>world</attach>
37
38    <placer>
39      <type>point</type>
40    </placer>
41
42    <shooter>
43      <theta-min-deg>84</theta-min-deg>
44      <theta-max-deg>86</theta-max-deg>
45      <phi-min-deg>-1.5</phi-min-deg>
46      <phi-max-deg>1.5</phi-max-deg>
47      <speed>
48        <value>10</value>
49        <spread>2.5</spread>
50      </speed>
51      <rotation-speed>
52        <x-min-deg-sec>0</x-min-deg-sec>
53        <y-min-deg-sec>0</y-min-deg-sec>
54        <z-min-deg-sec>0</z-min-deg-sec>
55        <x-max-deg-sec>0</x-max-deg-sec>
56        <y-max-deg-sec>0</y-max-deg-sec>
57        <z-max-deg-sec>0</z-max-deg-sec>
58      </rotation-speed>
59    </shooter>
60
61    <counter>
62      <particles-per-sec>
63        <value>1</value>
64        <spread>0</spread>
65      </particles-per-sec>
66    </counter>
67
68    <align>billboard</align>
69
70    <particle>
71      <start>
72        <color>
73          <red>
74            <value>0.9</value>
75          </red>
76          <green>
77            <value>0.09</value>
78          </green>
79          <blue>
80            <value>0.09</value>
81          </blue>
82          <alpha>
83            <value>1.0</value>
84          </alpha>
85        </color>
86        <size>
87          <value>0.25</value>
88        </size>
89      </start>
90
91      <end>
92        <color>
93          <red>
94            <value>1</value>
95          </red>
96          <green>
97            <value>0.1</value>
98          </green>
99          <blue>
100            <value>0.1</value>
101          </blue>
102          <alpha>
103            <value>0.0</value>
104          </alpha>
105        </color>
106        <size>
107          <value>4</value>
108        </size>
109      </end>
110
111      <life-sec>
112        <value>10</value>
113      </life-sec>
114
115      <mass-kg>0.25</mass-kg>
116      <radius-m>0.1</radius-m>
117    </particle>
118
119    <program>
120      <fluid>air</fluid>
121      <gravity type="bool">true</gravity>
122      <wind type="bool">true</wind>
123    </program>
124</particlesystem>
125
126Stick this inside any model XML like it was an animation and it should
127work (notice the condition requires wheel on the ground)
128
129Specification:
130
131Note:
132<VALUEORPROP/> means you can either specify a property with factor and
133offset (result = (prop*factor)+offset ) in the usual way
134
135
136<particlesystem>  = the base tag
137  <type>string</type> = can be "normal" or "trail", normal is the usual quad
138                        particles, trail is a string of connected line shapes
139                        by default.
140  <offsets>  = this places the source of the particles (the emitter) in relation
141               to the perhaps already offset model (see model-howto.html for details)
142    <x-m>float</x-m>
143    <y-m>float</y-m>
144    <z-m>float</z-m>
145    <pitch-deg>float</pitch-deg>
146    <roll-deg>float</roll-deg>
147    <heading-deg>float</heading-deg>
148  </offsets>
149  <condition> = a typical condition that if not true stops particles from being
150    ....        emitted (PPS=0)
151  </condition>
152  <name>string</name> = the name of the particle system (so it can be referenced
153                        by normal animations)
154  <attach>string</attach> = can be "world" or "local". "world means the particles
155                            aren't "physically linked" to the model (necessary for
156                            use outside moving models), "local" means the opposite
157                            (can be used for static objects or inside moving objects)
158  <texture>string</texture> = the texture path relative to the XML file location
159  <emissive>bool</emissive> = self-explanatory
160  <lighting>bool</lighting> = yet to be tested, but seems obvious
161  <align>string</align> = can be "billboard" or "fixed"
162  <placer> = where particles are born
163    <type>string</type> = can be "sector" (inside a circle), "segments"(user-defined
164                          segments) and "point" (default)
165    *<radius-min-m>float</radius-min-m> = only for sector, inner radius at which
166                                          particles appear
167    *<radius-max-m>float</radius-max-m> = only for sector, outer radius at which
168                                          particles appear
169    *<phi-min-deg>float</phi-min-deg> = only for sector, starting angle of the
170                                        slide at which particles appear
171    *<phi-max-deg>float</phi-max-deg> = only for sector, ending angle of the slide
172                                        at which particles appear
173    <segments> = only for segments, encloses sequential points that form segments
174      <vertex> = specifies one point, put as many as you want
175        <x-m>float</x-m>
176        <y-m>float</y-m>
177        <z-m>float</z-m>
178      </vertex>
179      ....
180      <vertex>
181      ...
182      </vertex>
183    </segments>
184  </placer>
185  <shooter> = the shooter defines the initial velocity vector for your particles
186    *<theta-min-deg>float</theta-min-deg> = horizontal angle limits of the particle cone
187    *<theta-max-deg>float</theta-max-deg>
188    *<phi-min-deg>float</phi-min-deg> = vertical angle limits of the particle cone
189    *<phi-max-deg>float</phi-max-deg>   for an illustration of theta/phi see
190    http://www.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/particles/particles.html
191    <speed-mps> = the scalar velocity (meter per second)
192     <VALUEORPROP/> = see note
193     *<spread> = the "tolerance" in each direction so values are in the range
194                 [value-spread, value+spread]
195    </speed-mps>
196    <rotation-speed> = the range of initial rotational speed of the particles
197      *<x-min-deg-sec>float</x-min-deg-sec>
198      *<y-min-deg-sec>float</y-min-deg-sec>
199      *<z-min-deg-sec>float</z-min-deg-sec>
200      *<x-max-deg-sec>float</x-max-deg-sec>
201      *<y-max-deg-sec>float</y-max-deg-sec>
202      *<z-max-deg-sec>float</z-max-deg-sec>
203    </rotation-speed>
204  </shooter>
205  <counter>
206    <particles-per-sec>
207      <VALUEORPROP/> = see note
208      *<spread> = the "tolerance" in each direction so values are in the range
209                  [value-spread, value+spread]
210    </particles-per-sec>
211  </counter>
212  <particle> = defines the particle properties
213    <start>
214      <color> = initial color (at time of emission)
215        <red><VALUEORPROP/></red> = color component in normalized value [0,1]
216        <green><VALUEORPROP/></green>
217        <blue><VALUEORPROP/></blue>
218        <alpha><VALUEORPROP/></alpha>
219      </color>
220      <size> = as above, but for size
221        <VALUEORPROP/>
222      </size>
223    </start>
224    <end>
225      <color> = final color (at the end of the particle life)
226        <red><VALUEORPROP/></red>
227        <green><VALUEORPROP/></green>
228        <blue><VALUEORPROP/></blue>
229        <alpha><VALUEORPROP/></alpha>
230      </color>
231      <size>
232        <VALUEORPROP/>
233      </size>
234    </end>
235    *<life-sec> = the time the particles will be alive, in seconds
236      <VALUEORPROP/>
237    *</life-sec>
238    *<radius-m>float</radius-m> = each particles is physically treated as a sphere
239                                  with this radius
240    *<mass-kg>float</mass-kg> = mass in KG
241  </particle>
242  <program> = defines external forces acting upon a particle
243    <fluid>string<fluid> = can be "air" or "water"
244    <gravity>bool</gravity> = can be "true" or "false". uses standard gravity
245    <wind>bool</wind> = can be "true" or "false". uses user position wind (not the
246                        model position, but shouldn't be noticeable, you want to
247                        disabled it when using local attach)
248  </program>
249</particles>
250
251Remarks:
252* Don't forget you can use existing animations with particles, so if you want to
253  direct or translate the emitter, just use translate, rotate, spin and so on
254  (other animations might have interesting effects too I guess)
255
256* Particle XML should be compatible with plib, as the tags will be ignored (you
257  might get some warning if you attach them to animations though)
258
259* Try not to use a lot of particles in a way that fills the screen, that will demand
260  lots of fill rate and hurt FPS
261
262* If you don't use any properties nor conditions, your particle system doesn't need
263  to use a callback a so it's slightly better on the CPU (mostly useful for static models)
264
265* If your particle lifetime is too big you might run out of particles temporarily
266  (still being investigated)
267
268* Use mass and size(radius) to adjust the reaction to gravity and wind
269  (mass/size = density)
270
271* Although at the moment severe graphical bugs can be seen in the trails,
272  they are usable.
273
274* Consider your options correctly! You should consider giving them no initial
275  velocity and most important, no spread, otherwise particles will race and the
276  trail will fold. Start simple (no velocities and forces) and work your way up.
277

README.xmlsound

1Users Guide to FlightGear sound configuration
2Version 0.9.8, October 30, 2005
3Author: Erik Hofman <erik at ehofman dot com>
4
5This document is an attempt to describe the configuration of
6FlightGear flight simulator's aircraft sound in XML.
7
8Sound Architecture:
9------------------
10All of the sound configuration files are XML-encoded* property lists.
11The root element of each file is always named <PropertyList>. Tags are
12almost always found in pairs, with the closing tag having a slash
13prefixing the tag name, i.e </PropertyList>. The exception is the tag
14representing an aliased property. In this case a slash is prepended to
15the closing angle bracket.  (see section Aliasing)
16
17The top level sound configuration file is composed of a <fx>, a
18<name>, a <path> sound file and zero or more <volume> and/or <pitch>
19definitions.
20
21[ Paths are relative to $FG_ROOT (the root of the installed base package .) ]
22[ Absolute paths may be used. Comments are bracketed with <!-- -->.         ]
23
24A limited sound configuration file would look something like this:
25
26<PropertyList>
27 <fx>
28  <engine>
29   <name>engine</name>
30   <path>Sounds/wasp.wav</path>
31   <mode>looped</mode>
32   <condition>
33    <property>/engines/engine/running</property>
34   </condition>
35   <volume>
36    <property>/engines/engine/mp-osi</property>
37    <factor>0.005</factor>
38    <min>0.15</min>
39    <max>0.5</max>
40    <offset>0.15</offset>
41   </volume>
42   <pitch>
43    <property>/engines/engine/rpm</property>
44    <factor>0.0012</factor>
45    <min>0.3</min>
46    <max>5.0</max>
47    <offset>0.3</offset>
48   </pitch>
49  </engine>
50 </fx>
51</PropertyList>
52
53This would define an engine sound event handler for a piston engine driven
54aeroplane. The sound representing the engine is located in $FG_ROOT/Sounds
55and is named wasp.wav. The event is started when the property
56/engines/engine/running becomes non zero.
57
58When that happens, the sound will be played looped (see <mode>) until the
59property returns zero again. As you can see the volume is mp-osi dependent,
60and the pitch of the sound depends on the engine rpm.
61
62Configuration description:
63-------------------------
64
65<fx>
66        Named FX subtree living under /sim/sound
67
68 < ... >
69        This is the event separator. The text inside the brackets
70        can be anything. Bit it is advised to give it a meaningful name
71        like: crank, engine, rumble, gear, squeal, flap, wind or stall
72
73        The value can be defined multiple times, thus anything which is
74        related may have the same name (grouping them together).
75
76   <name>
77        This defines the name of the event. This name is used internally
78        and, although it can me defined multiple times in the same file,
79        should normally have an unique value.
80
81        Multiple definitions of the same name will allow multiple sections
82        to interfere in the starting and stopping of the sample.
83
84        This method can't be used to control the pitch or volume of the
85        sample, but instead multiple volume or pitch section should be
86        included inside the same event.
87
88        The types "raise" and "fall" will stop the playback of the sample
89        regardless of any other event. This means that when the type "raise"
90        is supplied, sample playback will stop when the event turns false.
91        Using the type "fall" will stop playback when the event turns true.
92
93        IMPORTANT:
94        If the trigger is used for anything else but stopping the sound
95         at a certain event, all sections with the same name *should* have
96        exactly the same sections for everything but property and type.
97
98        In the case of just stopping the sample at a certain event, the
99        sections for path, volume and pitch may be omitted.
100
101   <path>
102        This defined th path to the sound file. The path is relative to the
103        FlightGear root directory but could be specified absolute.
104
105   <condition>
106        Define a condition that triggers the event.
107        For a complete description of the FlightGear conditions,
108        please read docs-mini/README.conditions
109
110        An event should define either a condition or a property.
111
112   <property>
113        Define which property triggers the event, and refers to a node
114        in the FlightGear property tree. Action is taken when the property
115        is non zero.
116
117        A more sophisticated mechanism to trigger the event is described
118        in <condition>
119
120   <mode>
121        This defines how the sample should be played:
122
123        once:           the sample is played once.
124                        this is the default.
125
126        looped:         the sample plays continuously,
127                        until the event turns false.
128
129        in-transit:     the sample plays continuously,
130                        while the property is changing its value.
131
132  <type>
133        This defines the type os this sample:
134
135        fx:             this is the default type and doesn't need to be defined.
136
137        avionics:       sounds set to this time don't have a position and
138                        orientation but are treated as if it's mounted to
139                        the aircraft panel. it's up to the user to define
140                        if it can always be heard or only when in cockpit
141                        view.
142
143   <volume> / <pitch>
144        Volume or Pitch definition. Currently there may be up to 5
145        volume and up to 5 pitch definitions defined within one sound
146        event.
147
148        The volume elements are processed as follows
149
150          total_offset = 0
151          total_volume = 1.0
152
153          for each <volume> element:
154
155            (a) Use either <property> or <internal> as the base value
156            (b) apply any <type> function to the value
157            (c) value = value * factor
158            (d) value = max(value, <max>)
159            (e) value = min(value, <min>)
160            (f) if <factor> was originally negative then use
161                offset-mode otherwise use normal mode
162
163                (normal-mode)
164                  total_offset = total_offset + offset
165                  total_volume = total_volume * value
166
167                (offset-mode)
168                  value = value + offset
169                  total_volume = total_volume * value
170
171        Then after processing all of the <volume> blocks the total
172        volume will be determined by
173
174           volume  = total_offset + total_volume;
175
176     <expression>
177        Defines the AN SGExpression to be used to calculate the volume
178        or pitch. When an expression is used all other tags in the
179        volume block are ignored.
180        Refs: README.expressions
181              http://wiki.flightgear.org/Expressions
182
183     <property>
184        Property to use for the base value for the calculation.
185
186     <factor>
187        Defines the multiplication factor for the property value.
188
189        If factor is negative then it will cause the calculation for
190        this element to use the offset-mode as defined above. The
191        negative value for the factor will be converted to positive
192
193     <offset>
194        The offset elements will be summed and added to the to the
195        calculated volume from all of the volume blocks, except when
196        using offset-mode in which case the offset is directly added
197        to the calculated volume within each volume block
198
199     <internal>
200        Defines which internal variable should be used for the calculation.
201
202        The value is treated as a floating point number.
203
204        The following internals are available at this time:
205
206        dt_play:        the number of seconds since the sound started playing.
207
208        dt_stop:        the number of seconds after the sound has stopped.
209
210     <delay-sec>
211        Defines the delay after the volume block becomes active.
212
213        An example would be to have two sounds that relate to a single
214        property and the delay-sec element can be used to allow one
215        sound to start after the end of the first one simply by
216        setting the delay-sec to the duration of the sample.
217
218     <type>
219        Defines the function that should be used upon the property
220        before it is used for calculating the net result:
221
222        lin:            linear handling of the property value.
223                        this is the default.
224
225        ln:             convert the property value to a natural logarithmic
226                        value before scaling it. Anything below 1 will return
227                        zero.
228
229        log:            convert the property value to a true logarithmic
230                        value before scaling it. Anything below 1 will return
231                        zero.
232
233        inv:            inverse linear handling (1/x).
234
235        abs:            absolute handling of the value (always positive).
236
237        sqrt:           calculate the square root of the absolute value
238                        before scaling it.
239
240     <random>
241        Add a bit of randomness to the offset. Only used for pitch.
242
243     <min>
244        Minimum allowed value.
245        This is useful if sounds start to sound funny. Anything lower
246        will be truncated to this value.
247
248     <max>
249        Maximum allowed value.
250        This is useful if sounds gets to loud. Anything higher will be
251        truncated to this value.
252
253   <position>
254        Specify the position of the sounds source relative to the
255        aircraft center.  The coordinate system used is a left hand
256        coordinate system where +Y = left, -Y = right, -Z = down, +Z =
257        up, -X = forward, +X = aft.  Distances are in meters.
258        The volume calculation due to distance and orientation of the
259        sounds source ONLY work on mono samples!
260
261     <x>
262        X dimension offset
263
264     <y>
265        Y dimension offset
266
267     <z>
268        Z dimension offset
269
270
271   <orientation>
272        Specify the orientation of the sounds source.
273
274        The zero vector is default, indicating that a Source is not directional.
275        Specifying a non-zero vector will make the Source directional in
276        the X,Y,Z direction
277
278     <x>
279        X dimension
280
281     <y>
282        Y dimension
283
284     <z>
285        Z dimension
286
287     <inner-angle>
288        The inner edge of the audio cone in degrees (0.0 - 180.0).
289        Any sound withing that angle will be played at the current gain.
290
291     <outer-angle>
292        The outer edge of the audio cone in degrees (0.0 - 180.0).
293        Any sound beyond the outer cone will be played at "outer-gain" volume.
294
295     <outer-gain>
296        The gain at the outer edge of the cone.
297
298
299   <reference-dist>
300        Set a reference distance of sound in meters. This is the
301        distance where the volume is at its maximum.
302        Volume is clamped to this maximum for any distance below.
303        Volume is attenuated for any distance above.
304        Attenuation depends on reference and maximum distance. See
305        OpenAL specification on "AL_INVERSE_DISTANCE_CLAMPED" mode
306        for details on exact computation.
307
308   <max-dist>
309        Set the maximum audible distance for the sound in meters.
310        Sound is cut-off above this distance.
311
312
313Creating a configuration file:
314------------------------------
315
316To make things easy, there is a default value for most entries to allow a
317sane configuration when a certain entry is omitted.
318
319Default values are:
320
321type:   lin
322factor: 1.0
323offset: 0.0 for volume, 1.0 for pitch
324min:    0.0
325max:    0.0 (don't check)
326
327
328
329Calculations are made the following way (for both pitch and volume):
330
331   value = 0;
332   offs = 0;
333
334   for (n = 0;  n < max; n++) {
335      if (factor < 0)
336      {
337         value += offset[n] - abs(factor[n]) * function(property[n]);
338      }
339      else
340      {
341          value += factor[n] * function(property[n]);
342          offs += offset[n];
343      }
344   }
345
346   volume = offs + value;
347
348where function can be one of: lin, ln, log, inv, abs or sqrt
349

README.xmlsyntax

1XML IN FIFTEEN MINUTES OR LESS
2
3Written by David Megginson, david@megginson.com
4Last modified: $Date$
5
6This document is in the Public Domain and comes with NO WARRANTY!
7
8
91. Introduction
10---------------
11
12FlightGear uses XML for much of its configuration.  This document
13provides a minimal introduction to XML syntax, concentrating only on
14the parts necessary for writing and understanding FlightGear
15configuration files.  For a full description, read the XML
16Recommendation at
17
18  http://www.w3.org/TR/
19
20This document describes general XML syntax.  Most of the XML
21configuration files in FlightGear use a special format called
22"Property Lists" -- a separate document will describe the specific
23features of the property-list format.
24
25
262. Elements and Attributes
27--------------------------
28
29An XML document is a tree structure with a single root, much like a
30file system or a recursive, nested list structure (for LISP fans).
31Every node in the tree is called an _element_: the start and end of
32every element is marked by a _tag_: the _start tag_ appears at the
33beginning of the element, and the _end tag_ appears at the end.
34
35Here is an example of a start tag:
36
37  <foo>
38
39Here is an example of an end tag:
40
41  </foo>
42
43Here is an example of an element:
44
45  <foo>Hello, world!</foo>
46
47The element in this example contains only data element, so it is a
48leaf node in the tree.  Elements may also contain other elements, as
49in this example:
50
51  <bar>
52   <foo>Hello, world!</foo>
53   <foo>Goodbye, world!</foo>
54  </bar>
55
56This time, the 'bar' element is a branch that contains other, nested
57elements, while the 'foo' elements are leaf elements that contain only
58data.  Here's the tree in ASCII art (make sure you're not using a
59proportional font):
60
61  bar +-- foo -- "Hello, world!"
62      |
63      +-- foo -- "Goodbye, world!"
64
65There is always one single element at the top level: it is called the
66_root element_.  Elements may never overlap, so something like this is
67always wrong (try to draw it as a tree diagram, and you'll understand
68why):
69
70  <a><b></a></b>
71
72Every element may have variables, called _attributes_, attached to
73it.  The attribute consists of a simple name=value pair in the start
74tag:
75
76  <foo type="greeting">Hello, world!</foo>
77
78Attribute values must be quoted with '"' or "'" (unlike in HTML), and
79no two attributes may have the same name.
80
81There are rules governing what can be used as an element or attribute
82name.  The first character of a name must be an alphabetic character
83or '_'; subsequent characters may be '_', '-', '.', an alphabetic
84character, or a numeric character.  Note especially that names may not
85begin with a number.
86
87
883. Data
89-------
90
91Some characters in XML documents have special meanings, and must
92always be escaped when used literally:
93
94  <  &lt;
95  &  &amp;
96
97Other characters have special meanings only in certain contexts, but
98it still doesn't hurt to escape them:
99
100  >  &gt;
101  '  &apos;
102  "  &quot;
103
104Here is how you would escape "x < 3 && y > 6" in XML data:
105
106  x &lt; 3 &amp;&amp; y &gt; 6
107
108Most control characters are forbidden in XML documents: only tab,
109newline, and carriage return are allowed (that means no ^L, for
110example).  Any other character can be included in an XML document as a
111character reference, by using its Unicode value; for example, the
112following represents the French word "cafe" with an accent on the
113final 'e':
114
115  caf&#233;
116
117By default, 8-bit XML documents use UTF-8, **NOT** ISO 8859-1 (Latin
1181), so it's safest always to use character references for characters
119above position 127 (i.e. for non-ASCII).
120
121Whitespace always counts in XML documents, though some specific
122applications (like property lists) have rules for ignoring it in some
123contexts.
124
125
1264. Comments
127-----------
128
129You can add a comment anywhere in an XML document except inside a tag
130or declaration using the following syntax:
131
132  <!-- comment -->
133
134The comment text must not contain "--", so be careful about using
135dashes.
136
137
1385. XML Declaration
139------------------
140
141Every XML document may begin with an XML declaration, starting with
142"<?xml" and ending with "?>".  Here is an example:
143
144  <?xml version="1.0" encoding="UTF-8"?>
145
146The XML declaration must always give the XML version, and it may also
147specify the encoding (and other information, not discussed here).
148UTF-8 is the default encoding for 8-bit documents; you could also try
149
150  <?xml version="1.0" encoding="ISO-8859-1"?>
151
152to get ISO Latin 1, but some XML parsers might not support that
153(FlightGear's does, for what it's worth).
154
155
1566. Other Stuff
157--------------
158
159There are other kinds of things allowed in XML documents.  You don't
160need to use them for FlightGear, but in case anyone leaves one lying
161around, it would be useful to be able to recognize it.
162
163XML documents may contain different kinds of declarations starting
164with "<!" and ending with ">":
165
166  <!DOCTYPE html SYSTEM "html.dtd">
167
168  <!ELEMENT foo (#PCDATA)>
169
170  <!ENTITY myname "John Smith">
171
172and so on.  They may also contain processing instructions, which look
173a bit like the XML declaration:
174
175  <?foo processing instruction?>
176
177Finally, they may contain references to _entities_, like the ones used
178for escaping special characters, but with different names (we're
179trying to avoid these in FlightGear):
180
181  &chapter1;
182
183  &myname;
184
185
186Enjoy.
187

README.yasim

1Coordinate system notes: All positions specified are in meters (which
2is weird, since all other units in the file are English).  The X axis
3points forward, Y is left, and Z is up.  Take your right hand, and
4hold it like a gun.  Your first and second fingers are the X and Y
5axes, and your upwards-pointing thumb is the Z.  This is slightly
6different from the coordinate system used by JSBSim.  Sorry.  The
7origin can be placed anywhere, so long as you are consistent.  I use
8the nose of the aircraft.
9
10XML Elements
11------------
12
13airplane: The top-level element for the file.  It contains only one
14          attribute:
15          mass: The empty (no fuel) weight, in pounds.
16
17approach: The approach parameters for the aircraft.  The solver will
18          generate an aircraft that matches these settings.  The element
19          can (and should) contain <control> elements indicating pilot
20          input settings, such as flaps and throttle, for the
21          approach.
22          speed: The approach airspeed, in knots TAS.
23          aoa:   The approach angle of attack, in degrees
24          fuel:  Fraction (0-1) of fuel in the tanks.  Default is 0.2.
25
26cruise:   The cruise speed and altitude for the solver to match.  As
27          above, this should contain <control> elements indicating
28          aircraft configuration.  Especially, make sure the engines
29          are generating enough thrust at cruise!
30          speed: The cruise speed, in knots TAS.
31          alt:   The cruise altitude, in feet MSL.
32          fuel:  Fraction (0-1) of fuel in the tanks.  Default is 0.2.
33
34cockpit:  The location of the cockpit (pilot eyepoint).
35          x,y,z: eyepoint location (see coordinates note)
36
37fuselage: This defines a tubelike structure.  It will be given an even
38          mass and aerodynamic force distribution by the solver.  You
39          can have as many as you like, in any orientation you please.
40          ax,ay,az: One end of the tube (typically the front)
41          bx,by,bz: The other ("back") end.
42          width:    The width of the tube, in meters.
43          taper:    The approximate radius at the "tips" of the fuselage
44                    expressed as a fraction (0-1) of the width value.
45          midpoint: The location of the widest part of the fuselage,
46                    expressed as a fraction of the distance between A and B.
47          idrag:    Multiplier for the "induced drag" generated by this
48                    object. Default is one. With idrag=0 the fuselage
49                    generates only drag.
50          cx,cy,cz: Factors for the generated drag in the fuselages "local
51                    coordinate system" with x pointing from end to front,
52                    z perpendicular to x with y=0 in the aircraft coordinate
53                    system. E.g. for a fuselage of a height of 2 times the
54                    width you can define cy=2 and (due to the doubled front
55                    surface) cx=2.
56
57wing:     This defines the main wing of the aircraft.  You can have
58          only one (but see below about using vstab objects for extra
59          lifting surfaces).  The wing should have a <stall> subelement to
60          indicate stall behavior, control surface subelements (flap0,
61          flap1, spoiler, slat) to indicate what and where the control
62          surfaces are, and <control> subelements to map user input
63          properties to the control surfaces.
64          x,y,z:     The "base" of the wing, specified as the location of
65                     the mid-chord (not leading edge, trailing edge, or
66                     aerodynamic center) point at the root of the LEFT
67                     (!)  wing.
68          length:    The length from the base of the wing to the midchord
69                     point at the tip.  Note that this is not the same
70                     thing as span.
71          chord:     The chord of the wing at its base, along the X axis
72                     (not normal to the leading edge, as it is
73                     sometimes defined).
74          incidence: The incidence angle at the wing root, in degrees.
75                     Zero is level with the fuselage (as in an
76                     aerobatic plane), positive means that the leading
77                     edge is higher than the trailing edge (as in a
78                     trainer).
79          twist:     The difference between the incidence angle at the
80                     wing root and the incidence angle at the wing
81                     tip.  Typically, this is a negative number so
82                     that the wing tips have a lower angle of attack
83                     and stall after the wing root (washout).
84          taper:     The taper fraction, expressed as the tip chord
85                     divided by the root chord.  A taper of one is a
86                     hershey bar wing, and zero would be a wing ending
87                     at a point.  Defaults to one.
88          sweep:     The sweep angle of the wing, in degrees.  Zero is
89                     no sweep, positive angles are swept back.
90                     Defaults to zero.
91          dihedral:  The dihedral angle of the wing.  Positive angles
92                     are upward dihedral.  Defaults to zero.
93          idrag:     Multiplier for the "induced drag" generated by this
94                     surface.  In general, low aspect wings will
95                     generate less induced drag per-AoA than high
96                     aspect (glider) wings.  This value isn't
97                     constrained well by the solution process, and may
98                     require tuning to get throttle settings correct in
99                     high AoA (approach) situations.
100          camber:    The lift produced by the wing at zero angle of
101                     attack, expressed as a fraction of the maximum
102                     lift produced at the stall AoA.
103
104hstab:    These defines the horizontal stabilizer of the aircraft.
105          Internally, it is just a wing object and therefore works the
106          same in XML.  You are allowed only one hstab object; the
107          solver needs to know which wing's incidence to play with to
108          get the aircraft trimmed correctly.
109
110vstab:    A "vertical" stabilizer.  Like hstab, this is just another
111          wing, with a few special properties.  The surface is not
112          "mirrored" as are wing and hstab objects.  If you define a
113          left wing only, you'll only get a left wing.  The default
114          dihedral, if unspecified, is 90 degrees instead of zero.
115          But all parameters are equally settable, so there's no
116          requirement that this object be "vertical" at all.  You can
117          use it for anything you like, such as extra wings for
118          biplanes.  Most importantly, these surfaces are not involved
119          with the solver computation, so you can have none, or as
120          many as you like.
121
122mstab:    A mirrored horizontal stabilizer. Exactly the same as wing, but
123          not involved with the solver computation, so you can have none,
124          or as many as you like.
125
126stall:    A subelement of a wing (or hstab/vstab/mstab) that specifies the
127          stall behavior.
128          aoa:   The stall angle (maximum lift) in degrees.  Note that
129                 this is relative to the wing, not the fuselage (since
130                 the wing may have a non-zero incidence angle).
131          width: The "width" of the stall, in degrees.  A high value
132                 indicates a gentle stall.  Low values are viscious
133                 for a non-twisted wing, but are acceptable for a
134                 twisted one (since the whole wing will not stall at
135                 the same time).
136          peak:  The height of the lift peak, relative to the
137                 post-stall secondary lift peak at 45 degrees.
138                 Defaults to 1.5.  This one is deep voodoo, and
139                 probably doesn't need to change much.  Bug me for an
140                 explanation if you're curious.
141
142flap0, flap1, slat, spoiler:
143          These are subelements of wing/hstab/vstab objects, and specify
144          the location and effectiveness of the control surfaces.
145          start:  The position along the wing where the control
146                  surface begins.  Zero is the root, one is the tip.
147          end:    The position where the surface ends, as above.
148          lift:   The lift multiplier for a flap or slat at full
149                  extension.  One is a no-op, a typical aileron might
150                  be 1.2 or so, a giant jetliner flap 2.0, and a
151                  spoiler 0.0.  For spoilers, the interpretation is a
152                  little different -- they spoil only "prestall" lift.
153                  Lift due purely to "flat plate" effects isn't
154                  affected.  For typical wings that stall at low AoA's
155                  essentially all lift is pre-stall and you don't have
156                  to care.  Jet fighters tend not to have wing
157                  spoilers, for exactly this reason.  This value is
158                  not applicable to slats, which affect stall AoA
159                  only.
160          drag:   The drag multiplier, as above.  Typically should be
161                  higher than the lift multiplier for flaps.
162          aoa:    Applicable only to slats.  This indicates the
163                  angle by which the stall AoA is translated by the
164                  slat extension.
165
166thruster: A very simple "thrust only" engine object.  Useful for
167          things like thrust vectoring nozzles.  All it does is map
168          its THROTTLE input axis to its output thrust rating.  Does
169          not consume fuel, etc...
170          thrust:   Maximum thrust in pounds
171          x,y,z:    The point on the airframe where thrust will be
172                    applied.
173          vx,vy,vy: The direction of the thrust in airframe
174                    coordinates.  The vector will be normalized
175                    automatically, so any non-zero vector will work
176                    fine.
177
178jet:      A turbojet/fan engine.  It accepts a <control> subelement to map a
179          property to its throttle setting, and an <actionpt> subelement
180          to place the action point of the thrust at a different
181          position than the mass of the engine.
182          x,y,z:          The location of the engine, as a point mass.
183                          If no actionpt is specified, this will also
184                          be the point of application of thrust.
185          mass:           The mass of the engine, in pounds.
186          thrust:         The maximum sea-level thrust, in pounds.
187          afterburner:    Maximum total thrust with afterburner/reheat,
188                          in pounds [defaults to "no additional
189                          thrust"].
190          rotate:         Vector angle of the thrust in degrees about the
191                          Y axis [0].
192          n1-idle:        Idling rotor speed [55].
193          n1-max:         Maximum rotor speed [102].
194          n2-idle:        Idling compressor speed [73].
195          n2-max:         Maximum compressor speed [103].
196          tsfc:           Thrust-specific fuel consumption [0.8].
197                          This should be considerably lower for modern
198                          turbofans.
199          egt:            Exhaust gas temperature at takeoff [1050].
200          epr:            Engine pressure ratio at takeoff [3.0].
201          exhaust-speed:  The maximum exhaust speed in knots [~1555].
202          spool-time:     Time, in seconds, for the engine to respond to
203                          90% of a commanded power setting.
204
205propeller: A propeller.  This element requires an engine subtag.
206           Currently <piston-engine> and <turbine-engine> are
207           supported.
208           x,y,z:         The position of the mass (!) of the
209                          engine/propeller combination.  If the point
210                          of force application is different (and it
211                          will be) it should be set with an <actionpt>
212                          subelement.
213           mass:          The mass of the engine/propeller, in pounds.
214           moment:        The moment, in kg-meters^2.  This has to be
215                          hand calculated and guessed at for now.  A
216                          more automated system will be forthcoming.
217                          Use a negative moment value for
218                          counter-rotating ("European" -- CCW as seen
219                          from behind the prop) propellers.
220                          A good guess for this value is the radius of
221                          the prop (in meters) squared times the mass
222                          (kg) divided by three; that is the moment of
223                          a plain "stick" bolted to the prop shaft.
224           radius:        The radius, in meters, or the propeller.
225           cruise-speed:  The max efficiency cruise speed of the
226                          propeller.  Generally not the same as the
227                          aircraft's cruise speed.
228           cruise-rpm:    The RPM of the propeller at max-eff. cruise.
229           cruise-power:  The power sunk by the prop at cruise, in horsepower.
230           cruise-alt:    The reference cruise altitude in feet.
231           takeoff-power: The takeoff power required by the propeller...
232           takeoff-rpm:   ...at the given takeoff RPM.
233           min-rpm:       The minimum operational RPM for a constant speed
234                          propeller.  This is the speed to which the
235                          prop governor will seek when the blue lever
236                          is at minimum.  The coarse-stop attribute
237                          limits how far the governor can go into trying
238                          to reach this RPM.
239           max-rpm:       The maximum operational RPM for a constant speed
240                          propeller.  See above.  The fine-stop attribute
241                          limits how far the governor can go in trying
242                          to reach this RPM.
243           fine-stop:     The minimum pitch of the propeller (high RPM) as a
244                          ratio of ideal cruise pitch.  This is set to 0.25
245                          by default -- a higher value will result in a
246                          lower RPM at low power settings (e.g. idle, taxi,
247                          and approach).
248           coarse-stop:   The maximum pitch of the propeller (low RPM) as
249                          a ratio of ideal cruise pitch.  This is set to
250                          4.0 by default -- a lower value may result in a
251                          higher RPM at high power settings.
252           gear-ratio:    The factor by which the engine RPM is multiplied
253                          to produce the propeller RPM.  Optional (defaults
254                          to 1.0).
255           contra:        When set (contra="1"), this indicates that the
256                          propeller is a contra-rotating pair.  It
257                          will not contribute to the aircraft's net
258                          gyroscopic moment, nor will it produce
259                          asymmetric torque on the aircraft body.
260                          Asymmetric slipstream effects, when
261                          implemented, will also be zero when this is
262                          set.
263
264piston-engine: A piston engine definition.  This must be a subelement
265               of an enclosing <propeller> tag.
266               eng-power:    Maximum BHP of the engine at sea level.
267               eng-rpm:      The engine RPM at which eng-power is developed
268               displacement: The engine displacement in cubic inches.
269               compression:  The engine compression ratio.
270               turbo-mul:    The turbo/super-charger pressure multiplier.
271                             Static pressure will be multiplied by this
272                             value to get the manifold pressure.
273               wastegate-mp: The maximum manifold pressure.  Beyond
274                             this, the gate will release to keep the
275                             MP below this number. (inHG).  This value
276                             can be changed at runtime using the
277                             WASTEGATE control axis, which is a
278                             multiplier in the range [0:1].
279               turbo-lag:    Time lag, in seconds, for 90% of a power change
280                             to be reflected in the turbocharger boost
281                             pressure.
282
283turbine-engine: A turbine engine definition.  This must be a subelement
284                of an enclosing <propeller> tag.
285                eng-power:   Maximum BHP of the engine at a suitable
286                             cruise altitude.
287                eng-rpm:     The engine RPM at which eng-power is
288                             developed.  Note that this is "shaft" RPM
289                             as seen by the propeller.  Don't use a
290                             gear-ratio on the enclosing propeller, or
291                             else you'll get confused. :)
292                alt:         The altitude at which eng-power is developed.
293                             This should be high enough to be lower (!)
294                             than the flat-rating power.
295                flat-rating: The maximum allowed power developed by
296                             the engine.  Most turboprops are flat
297                             rated below a certain altitude and
298                             temperature range to prevent engine
299                             damage.
300                min-n2:      N2 (percent) turbine speed at zero throttle.
301                max-n2:      N2 (percent) turbine speed at max throttle.
302                bsfc:        Specific fuel consumption, in lbs/hr per
303                             horsepower.
304
305
306actionpt: Defines an "action point" for an enclosing jet or propeller
307          element.  This is the location where the force from the thruster
308          will be applied.
309          x,y,z:  The location of force application.
310
311gear:     Defines a landing gear.  Accepts <control> subelements to map
312          properties to steering and braking. Can also be used to simulate
313          floats. Although the coefficients are still called ..fric, it
314          is calculated in fluids as a drag (proportional to the square
315          of the speed). In fluids gears are not considered to detect
316          crashes (as on ground).
317          x,y,z:  The location of the fully-extended gear tip.
318          compression:  The distance in meters along the "up" axis that
319                        the gear will compress.
320          initial-load: The initial load of the spring in multiples of
321                        compression. Defaults to 0. (With this parameter
322                        a lower spring-constants will be used for the
323                        gear-> can reduce numerical problems (jitter))
324                        Note: the spring-constant is varied from 0%
325                        compression to 20% compression to get continuous
326                        behavior around 0 compression. (could be physically
327                        explained by wheel deformation)
328          upx/upy/upz:  The direction of compression, defaults to
329                        vertical (0,0,1) if unspecified.  These are
330                        used only for a direction -- the vector need
331                        not be normalized, as the length is specified
332                        by "compression".
333          sfric:        Static (non-skidding) coefficient of
334                        friction.  Defaults to 0.8.
335          dfric:        Dynamic friction.  Defaults to 0.7.
336          spring:       A dimensionless multiplier for the automatically
337                        generated spring constant.  Increase to make
338                        the gear stiffer, decrease to make it
339                        squishier.
340          damp:         A dimensionless multiplier for the automatically
341                        generated damping coefficient.  Decrease to
342                        make the gear "bouncier", increase to make it
343                        "slower".  Beware of increasing this too far:
344                        very high damping forces can make the numerics
345                        unstable.  If you can't make the gear stop
346                        bouncing with this number, try increasing the
347                        compression length instead.
348          on-water:     if this is set to "0" the gear will be ignored if
349                        on water. Defaults to "0"
350          on-solid:     if this set to "0" the gear will be ignored if
351                        not on water. Defaults to "1"
352          speed-planing:
353          spring-factor-not-planing:
354                        At zero speed the spring factor is multiplied by
355                        spring-factor-not-planing. Above speed-planing this
356                        factor is equal to 1. The idea is, to use this for
357                        floats simulating the transition from swimming to
358                        planing. speed-planing defaults to 0,
359                        spring-factor-not-planing defaults to 1.
360          reduce-friction-by-extension: at full extension the friction is
361                        reduced by this relative value. 0.7 means 30% friction
362                        at full extension. If you specify a value greater
363                        than one, the friction will be zero before reaching
364                        full extension. Defaults to "0"
365          ignored-by-solver: with the on-water/on-solid tags you can have more
366                        than one set of gears in one aircraft, If the solver
367                        (who automatically generates the spring constants)
368                        would take all gears into account, the result would be
369                        wrong. E. G. set this tag to "1" for all gears, which
370                        are not active on runways. Defaults to "0". You can
371                        not exclude all gears in the solving process.
372
373launchbar: Defines a catapult launchbar or strop. The default acceleration
374            provided by the catapult is 25m/s^2. This can be
375            modified by the use of the control axis LACCEL.
376           x,y,z:      The location of the mount point of the launch bar or
377                       strop on the aircraft.
378           length:     The length of the launch bar from mount point to tip
379           down-angle: The max angle below the horizontal the
380                       launchbar can achieve.
381           up-angle:   The max angle above the horizontal the launchbar
382                       can achieve.
383           holdback-{x,y,z}: The location of the holdback mount point
384                             on the aircraft.
385           holdback-length: The length of the holdback from mount
386                            point to tip.  Note: holdback up-angle and
387                            down-angle are the same as those defined
388                            for the launchbar and are not specified in
389                            the configuration.
390
391tank:     A fuel tank.  Tanks in the aircraft are identified
392          numerically (starting from zero), in the order they are
393          defined in the file.  If the left tank is first, "tank[0]"
394          will be the left tank.
395          x,y,z:    The location of the tank.
396          capacity: The maximum contents of the tank, in pounds.  Not
397                    gallons -- YASim supports fuels of varying
398                    densities.
399          jet:      A boolean.  If present, this causes the fuel
400                    density to be treated as Jet-A.  Otherwise,
401                    gasoline density is used.  A more elaborate
402                    density setting (in pounds per gallon, for
403                    example) would be easy to implement.  Bug me.
404
405ballast:  This is a mechanism for modifying the mass distribution of
406          the aircraft.  A ballast setting specifies that a particular
407          amount of the empty weight of the aircraft must be placed at
408          a given location.  The remaining non-ballast weight will be
409          distributed "intelligently" across the fuselage and wing
410          objects.  Note again: this does NOT change the empty weight
411          of the aircraft.
412          x,y,z: The location of the ballast.
413          mass:  How much mass, in pounds, to put there.  Note that
414                 this value can be negative.  I find that I often need
415                 to "lighten" the tail of the aircraft.
416
417weight:   This is an added weight, something not part of the empty
418          weight of the aircraft, like passengers, cargo, or external
419          stores.  The actual value of the mass is not specified here,
420          instead, a mapping to a property is used.  This allows
421          external code, such as the panel, to control the weight
422          (loading a given cargo configuration from preference files,
423          dropping bombs at runtime, etc...)
424          x,y,z:      The location of the weight.
425          mass-prop:  The name of the fgfs property containing the
426                      mass, in pounds, of this weight.
427          size:       The aerodynamic "size", in meters, of the
428                      object.  This is important for external stores,
429                      which will cause drag.  For reasonably
430                      aerodynamic stuff like bombs, the size should be
431                      roughly the width of the object.  For other
432                      stuff, you're on your own.  The default is zero,
433                      which results in no aerodynamic force (internal
434                      cargo).
435
436solve-weight:
437          Subtag of approach and cruise parameters.  Used to specify a
438          non-zero setting for a <weight> tag during solution.  The
439          default is to assume all weights are zero at the given
440          performance numbers.
441          idx:    Index of the weight in the file (starting with zero).
442          weight: Weight setting in pounds.
443
444
445control-input:
446          This element manages a mapping from fgfs properties (user
447          input) to settable values on the aircraft's objects.  Note
448          that the value to be set MUST (!) be valid on the given
449          object type.  This is not checked for by the parser, and
450          will cause a runtime crash if you try it.  Wing's don't have
451          throttle controls, etc...  Note that multiple axes may be
452          set on the same value.  They are summed before setting.
453
454          axis:  The name of the double-valued fgfs property "axis" to
455                 use as input, such as "/controls/flight/aileron".
456          control: Which control axis to set on the objects.  It can have
457                   the following values:
458                  THROTTLE - The throttle on a jet or propeller.
459                  MIXTURE - The mixture on a propeller.
460                  REHEAT - The afterburner on a jet
461                  PROP - The propeller advance
462                  BRAKE - The brake on a gear.
463                  STEER - The steering angle on a gear.
464                  INCIDENCE - The incidence angle of a wing.
465                  FLAP0 - The flap0 deflection of a wing.
466                  FLAP1 - The flap1 deflection of a wing.
467                  FLAP[0/1]EFFECTIVENESS - a multiplier for flap lift, but not drag
468                                           (useful for blown flaps)
469                  SLAT - The slat extension of a wing.
470                  SPOILER - The spoiler extension for a wing.
471                  CYCLICAIL - The "aileron" cyclic input of a rotor
472                  CYCLICELE - The "elevator" cyclic input of a rotor
473                  COLLECTIVE - The collective input of a rotor
474                  ROTORENGINEON - If not equal zero the rotor is rotating
475                  WINCHRELSPEED - The relative winch speed
476          LACCEL - The acceleration provided by the catapult.
477                  {... and many more, see FGFDM.cpp ...}
478          invert: Negate the value of the property before setting on
479                  the object.
480          split:  Applicable to wing control surfaces.  Sets the
481                  normal value on the left wing, and a negated value
482                  on the right wing.
483          square: Squares the value before setting.  Useful for
484                  controls like steering that need a wide range, yet
485                  lots of sensitivity in the center.  Obviously only
486                  applicable to values that have a range of [-1:1] or
487                  [0:1].
488          src0/src1/dst0/dst1:
489                  If present, these defined a linear mapping from the
490                  source to the output value.  Input values in the
491                  range src0-src1 are mapped linearly to dst0-dst1,
492                  with clamping for input values that lie outside the
493                  range.
494
495control-output:
496          This can be used to pass the value of a YASim control axis
497          (after all mapping and summing is applied) back to the
498          property tree.
499
500          control: Name of the control axis.  See above.
501          prop:    Property node to receive the value.
502          side:    Optional, for split controls.  Either "right" or "left"
503          min/max: Clamping applied to output value.
504
505control-speed:
506          Some controls (most notably flaps and hydraulics) have
507          maximum slew rates and cannot respond instantly to pilot
508          input.  This can be implemented with a control-speed tag,
509          which defines a "transition time" required to slew through
510          the full input range.  Note that this tag is
511          semi-deprecated, complicated control input filtering can be
512          done much more robustly from a Nasal script.
513
514          control: Name of the control axis. See above.
515          transition-time: Time in seconds to slew through input range.
516
517control-setting:
518          This tag is used to define a particular setting for a
519          control axis inside the <cruise> or <approach> tags, where
520          obviously property input is not available.  It can be used,
521          for example, to inform the solver that the approach
522          performance values assume full flaps, etc...
523
524          axis:  Name of the control input (i.e. a property name)
525          value: Value of the control axis.
526
527hitch:    A hitch, can be used for winch-start (in gliders) or aerotow (in
528          gliders and motor aircrafts) or for external cargo with helicopter.
529          You can do aerotow over the net via multiplayer (see j3 and bocian
530          as an example).
531
532          name:  the name of the hitch. must be aerotow if you want to do
533                 aerotow via multiplayer. You will find many properties
534                 at /sim/hitches/name. Most of them are directly tied to
535                 the internal variables, you can modify them as you like.
536                 You can add a listener to the property "broken", e. g. for
537                 playing a sound.
538          x,y,z: The position of the hitch
539          force-is-calculated-by-other: if you want to simulate aerotowing
540                 over the internet, set this value to "1" in the motor
541                 aircraft. Don't specify or set this to zero in gliders.
542                 In a LAN the time lag might be small enough to set it on
543                 both aircrafts to "0". It's intended, that this is done
544                 automatically in the future.
545
546tow: The tow used for aerotow or winch. This must be a subelement
547               of an enclosing <hitch> tag.
548          length: upstretched length in m
549          weight-per-meter: in kg/m
550          elastic-constant: lower values give higher elasticity
551          break-force: in N
552          mp-auto-connect-period: the every x seconds a towed multiplayer
553                 aircraft is searched. If found, this tow is connected
554                 automatically, parameters are copied from the other
555                 aircraft. Should be set only in the motor aircraft, not
556                 in the glider
557
558winch: The tow used for aerotow or winch. This must be a subelement
559               of an enclosing <hitch> tag.
560          max-tow-length:
561          min-tow-length:
562          initial-tow-length: all are in m. The initial tow length also
563                 defines the length/search radius used for the mp-autoconnect
564                 feature
565          max-winch-speed: in m/s
566          power: in kW
567          max-force: in N
568
569
570rotor:    A rotor. Used for simulating helicopters. You can have one, two
571          or even more.
572          There is a drawing of a rotor in the Doc-directory
573          (README.yasim.rotor.png) Please find the measures from this drawing
574          for several parameters in square brackets [].
575          If you specify a rotor, you do not need to specify a wing or hstab,
576          the settings for approach and cruise will be ignored then. You have
577          to specify the solver results manually. See below.
578          The rotor generates downwash acting on all stabs, surfaces and
579          fuselages. For all fuselages in the rotor downwash you should
580          specify idrag="0" to get realistic results.
581
582          name:    The name of the rotor.
583                   (some data is stored at /rotors/name/)
584                   The rpm, cone angle, yaw angle and roll angle are stored
585                   for the complete rotor. For every blade the position
586                   angle, the flap angle and the incidence angle are stored.
587                   All angles are in degree, positive values always mean "up".
588                   This is not completely tested, but seem to work at least
589                   for rotors rotating counterclockwise.
590                   A value stall gives the fraction of the rotor in stall
591                   (weighted by the fraction the have on lift and drag
592                   without stall). Use this for modifying the rotor-sound.
593          x,y,z:   The position of the rotor center
594          nx,ny,nz: The normal of the rotor (pointing upwards, will be
595                   normalized by the computer)
596          fx,fy,fz: A Vector pointing forward, if not perpendicular to the
597                   normal it will be corrected by the computer
598          diameter: The diameter in meter [D]
599          numblades: The number of blades
600          weightperblade: The weight per blade in pounds
601          relbladecenter: The relative center of gravity of the blade. Maybe
602                   not 100% correct interpreted; use 0.5 for the start and
603                   change in small steps [b/R]
604          chord:     The chord of the blade its base, along the X axis
605                     (not normal to the leading edge, as it is
606                     sometimes defined). [c]
607          twist:     The difference between the incidence angle at the
608                     blade root and the incidence angle at the wing
609                     tip.  Typically, this is a negative number so
610                     that the rotor tips have a lower angle of attack.
611          taper:     The taper fraction, expressed as the tip chord
612                     divided by the root chord.  A taper of one is a
613                     bar blade, and zero would be a blade ending
614                     at a point.  Defaults to one. [d/c]
615          rel-len-where-incidence-is-measured: If the blade is twisted,
616                     you need a point where to measure the incidence angle.
617                     Zero means at the base, 1 means at the tip. Typically
618                     it should be something near 0.7
619          rel-len-blade-start: Typically the blade is not mounted in the
620                   center of the rotor [a/R]
621          rpm:     rounds per minute.
622          phi0:    initial position of this rotor
623          ccw:     determines if the rotor rotates clockwise (="0") or
624                   counterclockwise (="1"), (if you look on the top of the
625                   normal, so the bo105 has counterclockwise rotor).
626                   "true" and "false" are not any longer supported to
627                   increase my lifespan. ;-)
628          maxcollective: The maximum of the collective incidence in degree
629          mincollective: The minimum of the collective incidence in degree
630          maxcyclicele: The maximum of the cyclic incidence in degree for
631                   the elevator like function
632          mincyclicele: The minimum of the cyclic incidence in degree for
633                   the elevator like function
634          maxcyclicail: The maximum of the cyclic incidence in degree for
635                   the aileron like function
636          mincyclicail: The minimum of the cyclic incidence in degree for
637                   the aileron like function
638          airfoil-incidence-no-lift: non symmetric airfoils produces lift
639                   with no incidence. This is is the incidence, where the
640                   airfoil is producing no lift. Zero for symmetrical airfoils
641                   (default)
642          incidence-stall-zero-speed:
643          incidence-stall-half-sonic-speed: the stall incidence is a function
644                   of the speed. I found some measured data, where this is
645                   linear over a wide range of speed. Of course the linear
646                   region ends at higher speeds than zero, but just
647                   extrapolate the linear behavior to zero.
648          lift-factor-stall: In stall airfoils produce less lift. Without
649                   stall the c-lift of the profile is assumed to be
650                   sin(incidence-"airfoil-incidence-no-lift")*liftcoef;
651                   And in stall:
652                   sin(2*(incidence-"airfoil-incidence-no-lift"))*liftcoef*...
653                   ..."lift-factor-stall";
654                   Therefore this factor is not the quotient between lift
655                   with and without stall. Use 0.28 if you have no idea.
656          drag-factor-stall: The drag of an airfoil in stall is larger than
657                   without stall.
658                   Without stall c-drag is assumed to be
659                   abs(sin(incidence-"airfoil-incidence-no-lift"))...
660                   ..*dragcoef1+dragcoef0);
661                   With stall this is multiplied by drag-factor
662          stall-change-over: For incidence<"incidence-stall" there is no stall.
663                   For incidence>("incidence-stall"+"stall-change-over") there
664                   is stall. In the range between this incidences it is
665                   interpolated linear.
666
667          pitch-a:
668          pitch-b: collective incidence angles, If you start flightgear
669                   with --log-level=info, flightgear reports lift and needed
670                   power for theses incidence angles
671          forceatpitch-a:
672          poweratpitch-b:
673          poweratpitch-0: old tokens, not supported any longer, the result are
674                   not exactly the expected lift and power values. Will be
675                   removed in one of the next updates.directly.Use "real"
676                   coefficients instead (see below) and adjust the lift with
677                   rotor-correction-factor.
678
679          The airfoil of the rotor is described as follows:
680          The way is to define the lift and drag coefficients directly.
681          Without stall the c-lift of the profile is assumed to be
682                   sin(incidence-"airfoil-incidence-no-lift")*liftcoef;
683          And in stall:
684                   sin(2*(incidence-"airfoil-incidence-no-lift"))*liftcoef*...
685                   ..."lift-factor-stall";
686          Without stall c-drag is assumed to be
687                   abs(sin(incidence-"airfoil-incidence-no-lift"))...
688                   ..*dragcoef1+dragcoef0);
689          See above, how the coefficients are defined with stall.
690          The parameters:
691          airfoil-lift-coefficient: liftcoef
692          airfoil-drag-coefficient0: dragcoef0
693          airfoil-drag-coefficient1: dragcoef1
694                   To find the right values: see README.yasim.rotor.ods
695                   (Open Office file) or README.yasim.rotor.xls (Excel
696                   file). With theses files you can generate graphs of the
697                   airfoil coefficients and adjust the parameters to match
698                   real airfoils. For many airfoils you find data published
699                   in the internet. Parameters for the airfoils NACA 23012
700                   (main rotor of bo105) and NACA 0012 (tail rotor of bo105?)
701                   are included.
702
703          rotor-correction-factor:
704                   If you calculate the lift of a heli rotor or even of a
705                   propeller, you get a value larger than the real measured
706                   one. (Due to vortex effects.) This is considered in the
707                   simulation, but with a old theory by Prantl, which is known
708                   to give still too large. This is corrected by this token,
709                   default: 1
710          flapmin: Minimum flapping angle. (Should normally never reached)
711          flapmax: Maximum flapping angle. (Should normally never reached)
712          flap0:   Flapping angle at no rotation, i.e. -5
713          dynamic: this changes the reactions speed of the rotor to an input.
714                   normally 1 (Maybe there are rotors with a little faster
715                   reaction, than use a value a little greater than one.
716                   A value greater than one will result in a more inert,
717                   system. Maybe it's useful for simulating the rotor of the
718                   Bell UH1
719          rellenflaphinge: The relative length from the center of the rotor
720                   to the flapping hinge. Can be taken from pictures of the
721                   helicopter (i.e. 0 for Bell206, about 0.05 for most
722                   rotors) For rotors without flapping hinge (where the blade
723                   are twisted instead, i.e. Bo 105, Lynx) use a mean value,
724                   maybe 0.2. This value has a extreme result in the behavior
725                   of the rotor [F/r]
726          sharedflaphinge: determines, if the rotor has one central flapping
727                   hinge (="1") for the blades (like the Bell206 or the tail
728                   rotor of the Bo 105), default is "0".
729          delta3: Some rotors have a delta3 effect, which results in a
730                   decreasing of the incidence when the rotor is flapping.
731                   A value of 0 (as most helicopters have) means no change in
732                   incidence, a value of 1 result in a decreases of one degree
733                   per one degree flapping.
734                   So delta3 is the proportional factor between flapping and
735                   decrease of incidence. I.e. the tail rotor of a Bo105 has
736                   a delta3 of 1.
737                   In some publications delta3 is described by an angle. The
738                   value in YASim is the atan of this angle
739          delta:   A factor for the damping constant for the flapping. 1 means
740                   a analytical result, which is only a approximation. Has a
741                   very strong result in the reaction of the rotor system on
742                   control inputs.
743                   If you know the flapping angle for a given cyclic input you
744                   can adjust this by changing this value. Or if you now the
745                   maximum roll rate or ...
746          translift-maxfactor: Helicopters have "translational lift", which
747                   is due to turbulence. In forward flying the rotor gets less
748                   turbulence air and produces more lift. The factor is the
749                   quotient between lift at high airspeeds to the lift at
750                   hover (with same pitch).
751          translift-ve: the speed, where the translational lift reaches 1/e of
752                   the maximum value. In m/s.
753          ground-effect-constant: Near to the ground the rotor produces more
754                   torque than in higher altitudes. The ground effect is
755                   calculated as
756                   factor = 1+diameter/altitude*"ground-effect-constant"
757          number-of-parts:
758          number-of-segments: The rotor is simulated in "number-of-parts"
759                   different directions.
760                   In every direction the rotor is simulated at
761                   number-of-segments points. If the value is to small, the
762                   rotor will react unrealistic. If it is to high, cpu-power
763                   will be wasted. I now use a value of 8 for
764                   "number-of-parts" and 8 for number-of-segments for the main
765                   rotor and 4 for "number-of-parts" and 5 for
766                   "number-of-segments" for the tail rotor.
767                   "number-of-parts" must be a multiple of 4 (if not, it
768                   is corrected)
769          cyclic-factor: The response of a rotor to cyclic input is hard to
770                   calculate (its a damped oscillator in resonance, some
771                   parameters have very large impact to the cyclic response)
772                   With this parameter (default 1) you can adjust the
773                   simulator to the real helo.
774          downwashfactor: A factor for the downwash of the rotor, default 1.
775          balance: The balance of the rotor. 1.0: the rotor is 100% balanced,
776                   0.0: half of the blades are missing. Use a value near one
777                   (0.98 ... 0.999) to add some vibration.
778          tiltcenterx:
779          tiltcentery:
780          tiltcenterz: The center for the tilting of the complete rotorhead/
781                       mast. Can be used for simulating of the Osprey or small
782                       autogyros.
783          mintiltyaw:
784          mintiltpitch:
785          mintiltroll:
786          maxtiltyaw:
787          maxtiltpitch:
788          maxtiltroll: The limits (in degree) for tilting the rotor head
789
790          All rotor can have <control> subelements for the cyclic
791          (CYCLICELE, CYCLICAIL) and collective (COLLECTIVE) input.
792          and can have <control> subelements for the tilting the whole rotor
793          head around the y-axis (TILTPITCH), the x-axis (TILTROLL) and the
794          z-axis (TILTYAW). ROTORBALANCE is a factor for the balance.
795
796rotorgear: If you are using one or more rotors you have to define a
797          rotorgear. It connects all the rotors and adds a simple engine.
798          In future it will be possible, to add a YASim-engine.
799          max-power-engine: the maximum power of the engine, in kW.
800          engine-prop-factor: the engine is working as a pd-regulator. This
801                   is the width of the regulation-band, or, in other words,
802                   the inverse of the proportional-factor of the regulator.
803                   If you set it to 0.02, than up to 98% of the rotor-rpm
804                   the engine will produce maximum torque. At 100% of
805                   the engine will produce no torque.  It is planned to use
806                   YASim-engines instead of this simple engine.
807          engine-accel-limit: The d-factor of the engine is defined as the
808                   maximum acceleration rate of the engine in %/s,
809                   default is 5%/s.
810          max-power-rotor-brake: the maximum power of the rotor brake, in kW
811                   at normal rpm (most? real rotor brakes would be overheated
812                   if used at normal rpm, but this is not simulated now)
813          rotorgear-friction: the power loss due to friction in kW at normal
814                   RPM
815          yasimdragfactor:
816          yasimliftfactor: the solver is not working with rotor-aircraft.
817                   Therefore you have to specify the results yourself.
818                   10 for drag and 140 for lift seem to be good starting
819                   values. Although the solve is not invoked for aircraft
820                   with at least one rotor, you need to specify the cruise
821                   and the approach settings. The approach speed is needed to
822                   calculate the gear springs. Use a speed of approx. 50knots.
823                   They do not need to match any real value.
824
825          The rotorgear needs a <control> subelement for the engine
826          (ROTORGEARENGINEON) and can have further <control> subelements:
827                   ROTORBRAKE: rotor brake
828                   ROTORRELTARGET: the target rpm of the engine relative to
829                               the "normal" value for the governor. Default is
830                               1.
831                   ROTORENGINEMAXRELTORQUE: the maximum torque of the engine
832                               relative to the torque defined by the engine-
833                               power. Default is 1. By setting the rel-target
834                               to a large number you get control over the
835                               engine by this control.
836                               Alternatively you can use these two values for
837                               individual start-up sequences (see the s58)
838
839