There are two environment variables that must be defined to run FlightGear. These tell FlightGear where to find its data and scenery.
You can set them in a number of ways depending on your platform and requirements.
This is where FlightGear will find data files such as aircraft, navigational beacon locations, airport frequencies. This is the data subdirectory of where you installed FlightGear. e.g. /usr/local/share/FlightGear/data or c:\Program Files\FlightGear\data.
This is where FlightGear will look for scenery files. It consists of a list of directories that will be searched in order. The directories are separated by “:” on Unix and “;” on Windows. e.g.
/home/joebloggs/WorldScenery:/usr/local/share/FlightGear/data/Scenery
or
c:\Program Files\FlightGear\data\Scenery;c:\Program Files\FlightGear\data\WorldScenery.
The graphical wizard on Windows and the GUI launcher on Mac OS X internally define these environment variables so you don’t have to define these yourself. However, in case you launch FlightGear from command-line, you need to explicitly define these variables.
Fig. 3: Ready for takeoff: Waiting at the default startup position at San Francisco Itl., KSFO.
Before you can run FlightGear, you need to set a couple of environment variables:
e.g. $FG_ROOT/Scenery:$FG_ROOT/WorldScenery.
To add these in the Bourne shell (and compatibles):
or in C shell (and compatibles):
Once you have these environment variables set up, simply start FlightGear by running fgfs --option1 --option2…. Command-line options are described in Chapter 3.5.
The pre-built windows binaries come complete with a graphical wizard to start FlightGear. Simply double-click on the FlightGear Launcher Start Menu item, or the icon on the Desktop. The launcher allows you to select your aircraft, the start airport and runway, time of day, current weather, and lots of other settings.
The first time your run it, you will be asked to set your FG_ROOT variable (normally c:\Program Files\FlightGear\data) and FG_SCENERY. This should be a list of the directories where you have installed scenery, typically c:\Program Files\FlightGear\data\Scenery.
If you set invalid values or change your scenery directories later, you can change the settings by pressing the ”Prev” button from the first page of the launcher.
Alternatively, you can run FlightGear from the command line. To do this, you need to set up the FG_ROOT and FG_SCENERY environment variables manually.
Open a command shell, change to the directory where your binary resides (typically something like c:\Program Files\FlightGear\bin\Win32), set the environment variables by typing
and invoke FlightGear (within the same Command shell, as environment settings are only valid locally within the same shell) via
fgfs --option1 --option2… Command-line options are described in Chapter 3.5.
Of course, you can create a batch file with a Windows text editor (like notepad) using the lines above.
For maximum performance it is recommended that you to minimize (iconize) the text output window while running FlightGear.
The prebuilt binary package for Mac OS X comes with the GUI launcher. Simply double-click the FlightGear icon on /Applications folder shows up the GUI launcher window as shown in Fig. 5. The launcher allows you to :
The follow sections describe using these features.
At the launcher window, you can select an aircraft and an airport by clicking gear buttons at the right end of the airport/aircraft name. The thumbnail image of a selected aircraft will show up at the image panel on the window. The airport that you select here will be the starting point of your flight. FlightGear uses ICAO 4-letter airport code, which is composed with one or two prefix letters followed by a two or three letter airport code. For example, the ICAO code for San Francisco International Airport is KSFO. “K” in this case is the prefix for The United States, and SFO is the airport code for San Francisco International Airport. You can use Advanced features » Position or Aircraft tab to find an airport or an aircraft.
By checking Download scenery on the fly at the launcher window, the scenery data will
be downloaded while you’re flying using TerraSync. The scenery downloader will install
the scenery data into
/Applications/FlightGear.app/Contents/Resouces/data/Scenery-Terrasync.
The Mac version of FlightGear includes Atlas, the navigation map that helps your flight plan, for your convenience. Checking this option will automatically launch Atlas when you start the flight. You don’t have to specify any Atlas options. The GUI launcher will specify these for you.
Clicking Start Flight button at the launcher window opens up another window - the FlightGear main window. FlightGear immediately starts loading tons of data required for simulation. It may take a while on slower machines to load everything.
FlightGear has many features and options that you can specify at launch time. Some of these are not changeable from the menu in the FlightGear main window. To enable / disable these features, click the triangle-shaped button at the left-bottom of the launcher window. This displays the advanced features tabs. All settings are saved so you don’t have to respecify them.
These tabs let you specify some of FlightGear options:
Favorite list provides a means of preserving a named set of current options like a book mark of a web browser. To save the current set of options, press “+” button on the top window or at the bottom of the Favorite tab. Once favorites are added, You can switch from one configuration to another by double-clicking a row in the table view in the Favorite tab. Pressing “-” button (or delete key) on a favorite in the table view deletes the selected favorite.
You can find airports or aircraft carriers by searching with a keyword into the filter text area. Available keywords are:
Airports and carriers that match the keyword are shown at the table view below the filter text area. The airport name at the upper pane is synchronized with the currently selected airport or carrier. You can also open this tab by clicking the gear button at the right end of airport name on the top pane.
When you choose an airport, available runways show up at the “runway” pop-up button. You can choose a runway or leave it as “default.”
You can find aircraft by searching with a keyword into the filter text area. Available keywords are:
A list of aircraft that match the keyword shows up at the table view below the filter text area. The aircraft name at the upper pane is synchronized with the currently selected aircraft. You can also open this tab by clicking the gear button at the right end of aircraft name on the top pane.
If you want to find more aircraft data from the internet, click “Get Aircraft” button at the bottom of the Aircraft tab. It opens a web browser to lead you to the Aircraft Links page on FlightGear Mac OS X web site. you can visit some links there and download an aircraft you want. Once an aircraft is downloaded, open “Others” tab to install it.
If you encounter some weird behavior in searching aircraft, removing a cache file for
aircraft database might solve your problem. open
/Applications/Utilities/Terminal.app and type the following commands
to remove the cache file:
Note that you must not launch FlightGear from mounted disk image of a prebuilt binary package since the folder in the mounted disk image is read-only, which prevents you from installing any add-on data. you need to install FlightGear by copying the FlightGear icon from the mounted disk image to /Applciations folder.
This tab contains two network features of FlightGear. One is multi-player mode and another is FGCOM (a voice ATC). To enable multi-player mode, specify the followings:
FGCOM enables you to make a real voice communication using radio setting. You can talk at a selected radio frequency (COM1) while pressing space bar. You can listen to some other player’s talking in the frequency if some others are using the same frequency and you are in range. The options available for FGCOM are listed below:
For further instructions on FGCOM, and Multiplay, please see Chapter 5.
You can specify any options other than aircraft, airport, and the options shown in the launcher. Entering space-separated options as shown in Figure 11 will pass additional options to FlightGear. You can see all available options by pressing “View Options.” Some options might cause FlightGear crash. If you encounter such crashes with a specific option, please let us know.
To install additional aircraft and scenery data, press "Install Add-on Data." You can specify multiple files and/or folders to install to the FlightGear data folder. Acceptable file types are:
You will see the message window when all the data is successfully installed, otherwise error message will show up. You can select both aircraft and scenery data at the same time. If you select an archived file that does not contain aircraft files, it will be extracted into the data folder, but will be ignored. When you finish installing new aircraft, you can select the aircraft on the “Aircraft” tab.
You can also launch the simulator from the command line on Mac OS X. To do so, open Terminal.app (located at /Applications/Utilities) and type the following commands:
See chapter 3.5 for detail information on command line options. Unlike the other platforms, you don’t have to manually specify the environment variables such as FG_ROOT and FG_SCENERY as long as you use a prebuilt binary package.
Following is a complete list and short description of the numerous command line options available for FlightGear. Most of these options are exposed through the FlightGear launcher delivered with the Windows binaries.
If you have options you re-use continually, you can create a preferences file containing a set of command-line options that will be set automatically. You can create the file with any text editor (notepad, emacs, vi, if you like).
Display the most relevant command line options.
Display all command line options.
Select the language for this session. e.g. pl, nl, it, fr, en, de.
Display the current FlightGear version.
Tells FlightGear where to look for its root data files if you didn’t compile it with the default settings.
Allows specification of a path to the base scenery path , in case scenery is not at the default position under $FG ROOT/Scenery; this might be especially useful in case you have scenery on a CD-ROM.
Enable or disable saving of user-preferences on exit from the simulator.
Control whether FlightGear starts paused or not. Defaults to not paused.
Specify your primary control mode (joystick, keyboard, mouse) Defaults to joystick.
Switches auto-co-ordination between aileron and rudder on/off. Auto-coordination is recommended for users without rudder pedals or a ‘twist’ joystick. Defaults to off.
Specify location of your web browser. E.g: --browser-app=
“C:\Program Files\Internet Explorer\iexplore.exe”
(Note the “ ” because of the spaces!).
Load additional properties from the given path. E.g:
--config=./Aircraft/X15-set.xml
Use feet as the unit of measurement.
Enable or disable other aircraft/AI-models in the simulator.
Enable a specific AI scenario (e.g. --ai-scenario=vinson-demo). May be used multiple times.
Enable, disable random scenery objects (buildings/trees). Enabled by default.
Enable or disable sound.
Show the available sound devices.
Specify the sound device to use for audio.
Enable or disable playing an audio sample when FlightGear starts up.
Load the specified aircraft, for example: --aircraft=c172p. For available choices check the directory $FG ROOT/Aircraft, and look for files ending in “-set.xml”. When specifying the aircraft, drop the “-set.xml” from the filename. Alternatively, use the --show-aircraft option described below to list the available aircraft. For information on downloading additional aircraft, see Section 2.2.
Print a sorted list of the currently available aircraft types.
Display only those aircraft with a specified minimum declared status, one of alpha, beta, early-production, production. For use with --show-aircraft.
Aircraft directory relative to the executable location. Defaults to $FG ROOT/Aircraft.
Synonym for --aircraft.
Set the aircraft livery.
Select the core flight model. Options are jsb, larcsim, yasim, magic, balloon, external, pipe, ada, null. This option can normally be ignored, as the --aircraft option will set the FDM correctly.
Specifies the aircraft aeronautical model to load. This option can normally be ignored, as the --aircraft option will set the aircraft model correctly.
Run the Flight Dynamics Model with this rate (iterations per second).
Run the Flight Dynamics Model this much faster than real time.
Trim (or not) when initializing JSBSim. Defaults to trim.
Start up at ground level (default), or in the air. If specifying --in-air you must also set an initial altitude using --altitude, and may also want to set an initial velocity with --vc. Note that some aircraft (notably the X15) must be started in mid-air.
Control whether fuel state is constant (e.g. frozen) or consumed normally (default).
Start at a specific airport. The airport is specified by its ICAO code, e.g. --airport=KJFK for JFK airport in New York. For US airport without an ICAO code, try prefixing the 3 character code with ‘K’.
Start at a specific parking spot on the airport.
Start at the threshold of a specific runway (e.g. 28L). If no runway or parking ID is specified, a runway facing into the wind will be chosen for takeoff.
Set the starting position relative to a VOR, NDB or FIX. Useful for practising approaches.
Start on an aircraft carrier. See 5.2 for details of carrier operations.
Start at a particular parking position on the carrier. Must be used with --carrier. Defaults to a catapult launch position.
Start at a particular distance and heading from a position set using --airport, --vor, --ndb, --fix, --carrier.
Start at a particular longitude and latitude, in decimal degrees (south, west negative).
Start at specific altitude. Implies --in-air. Altitude is specified in feet unless you also select --units-meters, in which case altitude is in meters. You may also want to set an initial velocity with --vc to avoid stalling immediately.
Set the initial orientation of the aircraft. All values default to 0 - heading North, in straight and level flight.
Set the initial speed along the X, Y and Z axes. Speed is in feet per second unless you also select --units-meters, in which case altitude is in meters per second.
Set the initial speed along the South-North, West-East and vertical axes. Speed is in feet per second unless you also select --units-meters, in which case altitude is in meters per second.
Set the initial airspeed in knots or as a Mach number. Useful if setting --altitude, unless you want to stall immediately!
Set the initial glide slope angle in degrees or as a climb rate in feet per minute. May be positive or negative.
Sets an overcase ceiling at a particular height, and with an optional thickness (defaults to 2000ft).
Control whether real-time weather information is downloaded and used.
Use a specific METAR string, e.g. --metar=~XXXX 012345Z 00000KT 99SM CLR 19/M01 A2992~. The METAR may be specified in most common formats (US, European). Incompatible with --enable-real-weather-fetch.
Sets random wind direction and strength.
Sets turbulence from completely calm (0.0) to severe (1.0).
Specify the surface wind. Direction is in degrees, and speed in knots. Values may be specified as a range by using a colon separator; e.g. --wind=180:220@10:15.
Sets the simulated season. Valid parameters are summer (default), winter.
Set a multiplier for the display aspect ratio.
Specify the bits per pixel.
Enable (default), disable 3D clouds. Very pretty, but depend on your graphics card supporting GLSL Shaders, which some older, or less powerful graphics cards do not.
Enable or disable more realistic runway and approach light attenuation.
Enable or disable more realistic runway and approach lights.
Enable, disable (default) full screen mode.
Enable or disable full screen display for 3DFX graphics cards.
Enable (default), disable celestial body growth illusion near the horizon.
Enable, disable (default) extra mouse pointer. Useful in full screen mode for old Voodoo based cards.
Enable (default), disable fogging/haze.
Enable (default), disable specular highlights.
Enable or disable (default) the rotating 3DFX logo when the accelerator board gets initialized (3DFX only).
Enable (default), disable use of textures.
Enable, disable (default) display of wireframes. If you want to know what the world of FlightGear looks like internally, try this!
Set the fog level. To cut down the rendering efforts, distant regions vanish in fog by default. If you disable fog you’ll see farther, but your frame rates will drop. Using --fog-fastest will display a less realistic fog, by increase frame rate. Default is --fog-nicest.
Defines the window/screen resolution. E.g. --geometry=1024x768..
Use smooth shading (default), or flat shading which is faster but less pretty.
Configure anisotropic texture filtering. Values are 1 (default), 2, 4, 8 or 16.
Allows setting the default forward view direction as an offset from straight ahead. Possible values are LEFT, RIGHT, CENTER, or a specific number of degrees. Useful for multi-window display.
Control whether the HUD (Head Up Display) is shown anti-aliased.
Control whether the HUD is displayed. Defaults to disabled.
Control whether the 3D HUD is displayed.
Display the percentage of triangles culled, or the number of triangles rendered in the HUD. Mainly of interest to graphics developers.
Set the ADF frequency and radial.
Set the COM1/COM2 radio frequency.
Set the DME to NAV1, NAV2, or a specific frequency and radial.
Fail a specific aircraft system. Valid systems are pitot, static, vacuum, electrical. Specify multiple times to fail multiple systems.
Set the NAV1/NAV2 radio frequency and radial.
Control whether time advances normally or is frozen.
Specify the exact startup time/date. The three functions differ in that they take either Greenwich Mean Time, the local time of your virtual flight, or your computer system’s local time as the reference point.
Incompatible with --time-match-local, --time-match-real.
--time-match-real, is default: Simulator time is read from the system clock, and is used as is. When your virtual flight is in the same timezone as where your computer is located, this may be desirable, because the clocks are synchronized. However, when you fly in a different part of the world, it may not be the case, because there is a number of hours difference, between the position of your computer and the position of your virtual flight.
The option --time-match-local takes care of this by computing the timezone difference between your real world time zone and the position of your virtual flight, and local clocks are synchronized.
Incompatible with --start-date-gmt, --start-date-lat, --start-date-sys.
Specify a time offset relative to one of the time options above.
Set the time of day. Valid parameters are real, dawn, morning, noon, afternoon, dusk, evening, midnight.
Set multiplay options and aircraft call-sign. See Section 5.1.
Enable http server or telnet server on the specified port to provide access to the property tree.
Enable screen shot http server on the specified port.
Specify a proxy server to use.
Allows specifying a waypoint for the GC autopilot; it is possible to specify multiple waypoints (i.e. a route) via multiple instances of this command.
This is more comfortable if you have several waypoints. You can specify a file to read them from.
NB: These options are rather geared to the advanced user who knows what he is doing.
More detailed descriptions of the various IO parameters can be found in the README.IO file within the Docs directory of your FlightGear installation.
Open connection using the Atlas protocol (used by Atlas and TerraSync).
Open connection using the ATC Sim protocol (atc610x).
Open connection to drive a Garmin 196/296 series GPS
Open connection to drive a Garmin 400 series GPS
Open connection using the Generic (XML-defined) protocol.
Open connection using the Garmin GPS protocol.
Open connection to an Agwagon joystick.
Open connection to a remote joystick.
Open connection using the FG native Controls protocol.
Open connection using the FG Native FDM protocol.
Open connection using the FG Native GUI protocol.
Open connection using the FG Native protocol.
Open connection using the NMEA protocol.
Open connection using the OpenGC protocol.
Open connection using the interactive property manager.
Open connection using the PVE protocol.
Open connection using the RayWoodworth motion chair protocol.
Open connection using the RUL protocol.
Enable abort on a Floating Point Exception.
Instead of loading the entire simulator, load a lightweight OSG viewer. Useful for checking aircraft models.
Set the logging level. Valid values are bulk, debug, info, warn, alert.
Set property name to value
Example: --prop:/engines/engine[0]/running=true starts the simulator with running engines.
Another example:
--aircraft=c172p
--prop:/consumables/fuels/tank[0]/level-gal=10
--prop:/consumables/fuels/tank[1]/level-gal=10
fills the Cessna for a short flight. You may optionally specific the property type (double, string, boolean).
Trace the reads for a property; multiple instances are allowed.
Trace the writes for a property; multiple instances are allowed.
Could you imagine a pilot in his or her Cessna controlling the machine with a keyboard alone? For getting the proper feeling of flight you will need a joystick/yoke plus rudder pedals, right? However, the combination of numerous types of joysticks, flightsticks, yokes, pedals etc. on the market with the several target operating systems, makes joystick support a non-trivial task in FlightGear.
FlightGear has integrated joystick support, which automatically detects any joystick, yoke, or pedals attached. Just try it! If this does work for you, lean back and be happy! You can see what FlightGear has detected your joystick as by selecting Help -> Joystick Information from the menu.
Unfortunately, given the several combinations of operating systems supported by FlightGear (possibly in foreign languages) and joysticks available, chances are your joystick does not work out of the box. Basically, there are two alternative approaches to get it going, with the first one being preferred.
In order for joystick auto-detection to work, a joystick bindings xml file must exist for each joystick. This file describes what axes and buttons are to be used to control which functions in FlightGear. The associations between functions and axes or buttons are called “bindings”. This bindings file can have any name as long as a corresponding entry exists in the joysticks description file
/FlightGear/joysticks.xml
which tells FlightGear where to look for all the bindings files. We will look at examples later.
FlightGear includes several such bindings files for several joystick manufacturers in folders named for each manufacturer. For example, if you have a CH Products joystick, look in the folder
/FlightGear/Input/Joysticks/CH
for a file that might work for your joystick. If such a file exists and your joystick is working with other applications, then it should work with FlightGear the first time you run it. If such a file does not exist, then we will discuss in a later section how to create such a file by cutting and pasting bindings from the examples that are included with FlightGear.
Does your computer see your joystick? One way to answer this question under Linux is to reboot your system and immediately enter on the command line
dmesg | grep Joystick
which pipes the boot message to grep which then prints every line in the boot message that contains the string “Joystick”. When you do this with a Saitek joystick attached, you will see a line similar to this one:
input0: USB HID v1.00 Joystick [SAITEK CYBORG 3D USB] on usb2:3.0
This line tells us that a joystick has identified itself as SAITEK CYBORG 3D USB to the operating system. It does not tell us that the joystick driver sees your joystick. If you are working under Windows, the method above does not work, but you can still go on with the next paragraph.
FlightGear ships with a utility called js demo. It will report the number of joysticks attached to a system, their respective “names”, and their capabilities. Under Linux, you can run js demo from the folder /FlightGear/bin as follows:
$ cd /usr/local/FlightGear/bin
$ ./js demo
Under Windows, open a command shell (StartAll ProgramsAccessories), go to the FlightGear binary folder and start the program as follows (given FlightGear is installed under c:\Flightgear)
cd \FlightGear\bin
js demo.exe
Under Mac OS X, open Terminal.app (/Applications/Utilities/) and run js demo as follows:
$ cd /Applications/FlightGear.app/Contents/Resources
$ ./js demo
On our system, the first few lines of output are (stop the program with Ctrl-C if it is quickly scrolling past your window!) as follows:
Joystick test program.
Joystick 0: “CH PRODUCTS CH FLIGHT SIM YOKE USB ”
Joystick 1: “CH PRODUCTS CH PRO PEDALS USB”
Joystick 2 not detected
Joystick 3 not detected
Joystick 4 not detected
Joystick 5 not detected
Joystick 6 not detected
Joystick 7 not detected
+——————–JS.0———————-+——————–JS.1———————-+
| Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 Ax:6 | Btns Ax:0 Ax:1 Ax:2 |
+———————————————-+———————————————-+
| 0000 +0.0 +0.0 +1.0 -1.0 -1.0 +0.0 +0.0 . | 0000 -1.0 -1.0 -1.0 . . . . . |
First note that js demo reports which number is assigned to each joystick recognized by the driver. Also, note that the “name” each joystick reports is also included between quotes. We will need the names for each bindings file when we begin writing the binding xml files for each joystick.
Axis and button numbers can be identified using js demo as follows. By observing the output of js demo while working your joystick axes and buttons you can determine what axis and button numbers are assigned to each joystick axis and button. It should be noted that numbering generally starts with zero.
The buttons are handled internally as a binary number in which bit 0 (the least significant bit) represents button 0, bit 1 represents button 1, etc., but this number is displayed on the screen in hexadecimal notation, so:
0001 ⇒ button 0 pressed
0002 ⇒ button 1 pressed
0004 ⇒ button 2 pressed
0008 ⇒ button 3 pressed
0010 ⇒ button 4 pressed
0020 ⇒ button 5 pressed
0040 ⇒ button 6 pressed
... etc. up to ...
8000 ⇒ button 15 pressed
... and ...
0014 ⇒ buttons 2 and 4 pressed simultaneously
... etc.
For Linux users, there is another option for identifying the “name” and the numbers assigned to each axis and button. Most Linux distributions include a very handy program, “jstest”. With a CH Product Yoke plugged into the system, the following output lines are displayed by jstest:
jstest /dev/js3
Joystick (CH PRODUCTS CH FLIGHT SIM YOKE USB ) has 7 axes and 12 buttons. Driver version is 2.1.0
Testing…(interrupt to exit)
Axes: 0: 0 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0 Buttons: 0:off 1:off 2:off 3:on 4:off 5:off 6:off 7:off 8:off
9:off 10:off 11:off
Note the “name” between parentheses. This is the name the system associates with your joystick.
When you move any control, the numbers change after the axis number corresponding to that moving control and when you depress any button, the “off” after the button number corresponding to the button pressed changes to “on”. In this way, you can quickly write down the axes numbers and button numbers for each function without messing with binary.
At this point, you have confirmed that the operating system and the joystick driver both recognize your joystick(s). You also know of several ways to identify the joystick “name” your joystick reports to the driver and operating system. You will need a written list of what control functions you wish to have assigned to which axis and button and the corresponding numbers.
Make the following table from what you learned from js demo or jstest above (pencil and paper is fine). Here we assume there are 5 axes including 2 axes associated with the hat.
Axis | Button |
elevator = 0 | view cycle = 0 |
rudder = 1 | all brakes = 1 |
aileron = 2 | up trim = 2 |
throttle = 3 | down trim = 3 |
leftright hat = 4 | extend flaps = 4 |
foreaft hat = 5 | retract flaps = 5 |
decrease RPM = 6 | |
increase RPM = 7 |
We will assume that our hypothetical joystick supplies the “name” QUICK STICK 3D USB to the system and driver. With all the examples included with FlightGear, the easiest way to get a so far unsupported joystick to be auto detected, is to edit an existing binding xml file. Look at the xml files in the sub-folders of /FlightGear/Input/Joysticks/. After evaluating several of the xml binding files supplied with FlightGear, we decide to edit the file
/FlightGear/Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml.
This file has all the axes functions above assigned to axes and all the button functions above assigned to buttons. This makes our editing almost trivial.
Before we begin to edit, we need to choose a name for our bindings xml file, create the folder for the QS joysticks, and copy the original xml file into this directory with this name.
$ cd /usr/local/FlightGear/Input/Joysticks
$ mkdir QS
$ cd QS
$ cp /usr/local/FlightGear/Input/Joysticks/Saitek/
Cyborg-Gold-3d-USB.xml QuickStick.xml
Here, we obviously have supposed a Linux/UNIX system with FlightGear being installed under /usr/local/FlightGear. For a similar procedure under Windows with FlightGear being installed under c:FlightGear, open a command shell and type
c:
cd /FlightGear/Input/Joysticks
mkdir QS
cd QS
copy /FlightGear/Input/Joysticks/Saitek/
Cyborg-Gold-3d-USB.xml QuickStick.xml
Next, open QuickStick.xml with your favorite editor. Before we forget to change the joystick name, search for the line containing <name>. You should find the line
<name>SAITEK CYBORG 3D USB</name>
and change it to
<name>QUICK STICK 3D USB</name>.
This line illustrates a key feature of xml statements. They begin with a <tag> and end with a </tag>.
You can now compare your table to the comment table at the top of your file copy. Note that the comments tell us that the Saitek elevator was assigned to axis 1. Search for the string
<axis n=~1~>
and change this to
<axis n=~0~>.
Next, note that the Saitek rudder was assigned to axis 2. Search for the string
<axis n=~2~>
and change this to
<axis n=~1~>.
Continue comparing your table with the comment table for the Saitek and changing the axis numbers and button numbers accordingly. Since QUICKSTICK USB and the Saitek have the same number of axes but different number of buttons, you must delete the buttons left over. Just remember to double-check that you have a closing tag for each opening tag or you will get an error using the file.
Finally, be good to yourself (and others when you submit your new binding file to a FlightGear developers or users archive!) by taking the time to change the comment table in the edited file to match your changed axis and button assignments. The new comments should match the table you made from the js demo output. Save your edits.
Several users have reported that the numbers of axes and buttons assigned to functions may be different with the same joystick under Windows and Linux. The above procedure should allow one to easily change a binding xml file created for a different operating system for use by their operating system.
Before FlightGear can use your new xml file, you need to edit the file
/FlightGear/joysticks.xml,
adding a line that will include your new file if the “name” you entered between the name tags matches the name supplied to the driver by your joystick. Add the following line to joysticks.xml.
<js-named include=~Input/Joysticks/QS/QuickStick.xml~/>
You can tell how FlightGear has interpreted your joystick setup by selecting Help -> Joystick Information from the Menu.
Basically, the procedures described above should work for Windows as well. If your joystick/yoke/pedals work out of the box or if you get it to work using the methods above, fine. Unfortunately, however, it’s likely you may encounter a few problems.
The first one concerns users of non-US Windows versions. As stated above, you can get the name of the joystick from the program js demo. If you have a non-US version of Windows and the joystick .xml files named above do not contain that special name, just add it on top of the appropriate file in the style of
<name>Microsoft-PC-Joysticktreiber </name>
No new entry in the base joysticks.xml file is required.
Unfortunately, there is one more loophole with Windows joystick support. In the case that you have two USB devices attached (for instance, a yoke plus pedals), it’s possible that the same driver name will be reported twice. In this case, you can at least get the yoke working by assigning it number 0 (out of 0 and 1). For this purpose, rotate the yoke (aileron control) and observe the output of js demo. If figures in the first group of colons (for device 0) change, assignment is correct. If figures in the second group of colons (for device 1) change, you have to make the yoke the preferred device first. For doing so, enter the Windows “Control panel”, open “Game controllers” and select the “Advanced” button. Here you can select the yoke as the “Preferred” device. Afterward you can check that assignment by running js demo again. The yoke should now control the first group of figures.
Unfortunately, we did not find a way to get the pedals to work, too, that way. Thus, in cases like this one (and others) you may want to try an alternative method of assigning joystick controls.
Thanks to Mac OS X, most of HID compatible joysticks are recognized and usable on Mac OS X. Some of joysticks are already defined properly in FlightGear. However, sometimes your joystick does not work as you expect due to some reasons such as missing joystick ID, and misconfigured buttons or axis. In such cases, you need to modify a joystick configuration file.
The basic procedures in configuring joysticks under Mac OS X are the same as those of Linux as described above. The main differences are the path to the joystick configuration files and the means of finding a joystick name. The joystick configuration files are at Contents/Resources/data/Input/Joysticks under the FlightGear.app folder. You can open the data folder by choosing “Advanced Features » Others » Open data folder” on the GUI launcher. You can also open it by right-clicking the FlightGear icon at Applications folder and choose “Show Package Contents” to access the folders inside the application. To find a joystick name, follow the steps below:
In case your joystick doesn’t work as expected even it is recognized properly, you need to modify the button and/or axis settings. Some Mac users reported that twisting a joystick controls the throttle instead of the rudder. This is a typical joystick misconfiguration on Mac OS X. To fix this issue, you need to edit two axis tags in a joystick configuration file.
In many cases, the rudder is assigned to axis 2 and the throttle to axis 3 in driver level. Editing or adding a mac tag inside an axis tag for the rudder (and throttle) will fix this problem. The example below is a part of a joystick configuration file that assigns axis 3 for rudder control.
Fortunately, there is now a utility available which makes things easier for the average, non-XML savvy user.
To configure your joystick using this approach do the following:
The program will tell you which joysticks, if any, were detected. Now follow the commands given on screen, i.e. move the axis and press the buttons as required. Be careful, a minor touch already “counts” as a movement. Check the reports on screen. If you feel something went wrong, just re-start the program.
After you are done with all the axes and switches, the directory above will hold a file called fgfsrc.js. The contents on this file can be copied into your personal preferences file (.fgfsrc/system.fgfsrc). See 3.5 for details of how to create this file.
Note that output of fgjs is UNIX formatted. As a result, Windows Editor may not display it properly. It may be helpful to use an editor capable of handling UNIX files as well. My favorite freeware file editor for that purpose, although somewhat dated, is PFE, which can be obtained from http://www.lancs.ac.uk/staff/steveb/cpaap/pfe/.
The axis/button assignment of fgjs should at least get the axis assignments right, but the output may need some tweaking. For example, some axes may be moving the opposite way they should, or the dead zones may be too small. For instance, the elevator axes on my USB CH Yoke was reversed so I had to change
--prop:/input/joysticks/js[1]/axis[1]/binding/factor=-1.0
into
--prop:/input/joysticks/js[1]/axis[1]/binding/factor=1.0
To help with tuning, here is a short introduction into the assignments of joystick properties. Basically, all axes settings are specified via lines having the following structure:
--prop:/input/joysticks/js[n]/axis[m]/binding/command=property-scale
--prop:/input/joysticks/js[n]/axis[m]/binding/property=/controls/steering option
--prop:/input/joysticks/js[n]/axis[m]/binding/dead-band=db
--prop:/input/joysticks/js[n]/axis[m]/binding/offset=os
--prop:/input/joysticks/js[n]/axis[m]/binding/factor=fa
where
n | = | number of device (usually starting with 0) |
m | = | number of axis (usually starting with 0) |
steering option | = | elevator, aileron, rudder, throttle, mixture, pitch |
dead-band | = | range within which signals are discarded. |
Useful to avoid jittering for minor yoke movements | ||
offset | = | Applies an offset after any factor. |
Useful to handle devices where the neutral position does not map to 0. | ||
factor | = | controls sensitivity of that axis; defaults to +1, |
with a value of -1 reversing the behavior |
You should be able to at least get your joystick working along these lines. Concerning all the finer points, such as getting the joystick buttons working, John Check has written a very useful README included in the base package under $FG_ROOT/Docs/README.Joystick.html. In case of any trouble with your input device, it is highly recommended to read this document.