Chapter 4
Takeoff: How to start the program

4.1 Launching the simulator under Unix/Linux

Under Linux (or any other flavor of Unix), FlightGear will be invoked by

runfgfs --option1 --option2...,

where the options will be described in Section 4.4 below.

If something strange happens while using this shell script, if you want to do some debugging (i.e. using ”strace”) or if you just feel nice to be ”keen”, then you can start FlightGear directly by executing the ”fgfs” binary. In this case you should at least add one variable to your environment, which is needed to locate the (mostly) shared library built from the sources of the SimGear package. Please add the respective directory to your LD_LIBRARY_PATH. You can do so with the following on Bourne shell (compatibles):

 LD_LIBRARY_PATH=/usr/local/FlightGear/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH/

or on C shell (compatibles):

 setenv LD_LIBRARY_PATH
 /usr/local/FlightGear/lib:$LD_LIBRARY_PATH

Besides this (used by the dynamic linker) ”fgfs” knows about the following environment variable

FG_ROOT: root directory for the FlightGear base package; this corresponds to the --fg-root=path option as described in Sec. 4.4.1

4.2 Launching the simulator under Windows

Before starting the simulator, you may want to adapt the file webrun.bat situated in the main FlightGear directory. Open the file with an editor

In Windows explorer, change to the directory /FlightGear and double-click runfgfs.bat.

Fig. 3: Ready for takeoff. Waiting at the default startup position at San Francisco Itl., KSFO.

Alternatively, if for one or the other reason the batch file does not work or is missing, you can open an MS-DOS shell, change to the directory where your binary resides (typically something like c:/FlightGear/bin where you might have to substitute c: in favor of your FlightGear directory), set the environment variable via (note the backslashes!)

SET FG_ROOT=c:\FlightGear\bin

and invoke FlightGear (within the same MS-DOS shell, as environment settings are only valid locally within the same shell) via

fgfs --option1 --option2....

Of course, you can create your own runfgfs.bat with Windows Editor using the two lines above.

For getting maximum performance it is recommended to minimize (iconize) the text output window while running FlightGear.

4.3 Launching the simulator under Mac OS X

Say you downloaded the base package and binary to yout home directory. Then you can open Terminal.app and execute the following sequence:

setenv FG_ROOT  /fgfs-base-X.X.X ./fgfs-X.X.X.-date
--option1 -- option 2 (one line)

or

./fgfs-X.X.X-version-date --fg-root=~/  fgfs-base-X.X.X
--option1 --option2. (one line)

4.4 Command line parameters

Following is a list and short description of the numerous command line options available for FlightGear. If you are running FlightGear under Windows you can include these into runfgfs.bat.

However, in case of options you want to re-use continually (like joystick settings) it is recommended to include them into a file called .fgfsrc under Unix systems and system.fgfsrc, resp. under Windows. This file has to be in the top FlightGear directory (for instance /usr/local/Flightgear). As it depends on your preferences, it is not delivered with FlightGear, but can be created with any text editor (notepad, emacs, vi, if you like). Examples for such a file (including a detailed description on the configuration of joysticks) can be found at

http://rockfish.net/shell/aboutjoy.txt.

4.4.1 General Options

4.4.2 Features

4.4.3 Flight model

4.4.4 Aircraft model directory (Only for the UIUC Flight Dynamics Model)

Remark: The difference in the handling of UIUC models has historic reasons. These models use the LaRCsim FDM. As this FDM isn’t the default FDM any more you have to specify it manually. Also the airplane description needs manual interaction as you have to specify the directory by hand where the specific aircraft data resides. So you have to use the following for flying the ’TwinOtter’:

fgfs --fdm=larcsim --aero=uiuc

--aircraft-dir=Aircraft-uiuc/TwinOtter

Fortunately work has been done to simplificate this. At least those airplanes can be flown easily by using an appropriate ’--aircraft’-string. These are the following:

--aircraft=747-uiuc, --aircraft=beech99-uiuc,
--aircraft=c172-uiuc, --aircraft=c310-uiuc

If time permits the remaining aircrafts will be adjusted soon. Please have a look at $FG_ROOT/Aircraft-uiuc for the avaliable aircrafts provided by the UIUC model collection. Also please read the notes in Section 1.4 on UIUC.

4.4.5 Initial Position and Orientation

4.4.6 Rendering Options

4.4.7 HUD Options

4.4.8 Time Options

4.4.9 Network Options

4.4.10 Route/Waypoint Options

These options are rather geared to the advanced user who knows what he is doing.

4.4.11 IO Options

4.4.12 Debugging options

4.4.13 Joystick properties

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 nontrivial task in FlightGear.

All of FlightGear’s joystick (as well as keyboard) properties are written in plain ASCII files, thus anyone can adapt them, if necessary. Fortunately, there is a tool available now, which takes most of the burden form the average user who, maybe, is not that experienced with XML, the language which these files arwe written in.

For configuring your joystick, open a command shell (command prompt(DOS shell under windows, to be found unter Start—All programs—Accessories). Change to the directory /FlightGear/bin via e.g. (modify to your path)

cd c:\FlightGear\bin

and invoke the tool fgjs via

fgjs

on a UNIX/Linux machine, or via

fgjs.exe

on a Windows machine. The program will tell you which joysticks, if any, where 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 axis/switches, the directory above will hold a file called fgfsrc.js. If the FlightGear base directory FlighGear does not already contain an options file .fgfsrc (under UNIX)/system.fgfsrc (under Windows) mentioned above, just copy

fgfsrc.js into .fgfsrc (UNIX)/system.fgfsrc (Windows)

and place it into the directory FlightGear base directory FlighGear. In case you already wrote an options file, just open it as well as fgfsrc.js with an editor and copy the entries from fgfsrc.js into .fgfsrc/system.fgfsrc. One hint: The output of fgjs is UNIX formatted. As a result, Windows Editor may not display it the proper way. I suggest getting an editor being able to handle UNIX files as well. My favorite freeware file editor for that purpose, although somewhat dated, is PFE still, to be obtained from

http://www.lancs.ac.uk/people/cpaap/pfe/.

The the axis/button assignment of fgjs should, at least, get the axis assignments right, its output may need some tweaking. There may be axis moving the opposite way the should, the dead zones may be too small etc. For instance, 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

(USB CH Flightsim Yoke under Windows XP). Thus, 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 = specifies, if device not centered in its neutral position
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, for instance, getting the joystick buttons working, John Check has written a very useful README being included in the base package to be found under FlightGear/Docs/Readme/Joystick.html. In case of any trouble with your input device, it is highly recommended to have a look into this document.