2000-09-21 15:17:36 +00:00
|
|
|
Users Guide to Joystick Usage Under FlightGear Flight Simulator
|
2000-10-06 21:45:47 +00:00
|
|
|
version 0.3 10/06/2000
|
2000-09-21 15:17:36 +00:00
|
|
|
Author John Check <j4strngs@rockfish.net>
|
|
|
|
|
|
|
|
This document is written with versions of FlightGear 0.7.5 and greater
|
|
|
|
in mind. It assumes a working joystick present on your system. While it
|
|
|
|
is written from the point of view of a Linux user, the cross platform
|
|
|
|
nature of FGFS should ensure the information presented is useful on other
|
|
|
|
platforms. I'd like to say thanks to all the developers who make FGFS happen
|
|
|
|
and forgive me for not giving credit with regard to the property
|
|
|
|
manager and js_demo. Corrections and additions are encouraged.
|
2000-09-25 22:02:08 +00:00
|
|
|
The most current version can be found at http://rockfish.net/shell/aboutjoy.txt
|
2000-09-21 15:17:36 +00:00
|
|
|
|
|
|
|
Some History:
|
|
|
|
Earlier versions of FGFS had assignments of joystick axis/buttons
|
|
|
|
hard coded. If you had a joystick that did not use the default channel
|
|
|
|
assignments, you had to edit the source code and recompile.
|
|
|
|
Fortunately, around about v0.7.4/0.7.5 a "property manager" was
|
|
|
|
implemented, allowing, among other things, runtime access to some of the FGFS
|
|
|
|
internals, which facilitated being able to set the parameters for the
|
|
|
|
joystick at runtime.
|
|
|
|
|
|
|
|
About runtime options:
|
|
|
|
FGFS has always had a plethora of available runtime options. Starting
|
|
|
|
point, altitude, direction, time of day and other aspects of the
|
|
|
|
simulated environment were always well represented. However there
|
|
|
|
were also a number of options and features that were not well documented.
|
|
|
|
Among these was the ability to use a runtime configuration file (.fgfsrc)
|
|
|
|
to control the default operation. The .fgfsrc file is not created at runtime
|
|
|
|
and must be created manually. Fortunately, the format of the file is
|
|
|
|
straightforward. All one need do is place the commandline options one would
|
2000-10-06 21:45:47 +00:00
|
|
|
like in a plain ASCII text file in the users home directory. System wide
|
|
|
|
defaults can be place in $FG_ROOT/system.fgfsrc.
|
2000-09-21 15:17:36 +00:00
|
|
|
|
|
|
|
With the advent of the property manager it became possible to add a number
|
|
|
|
of additional runtime options to the .fgfsrc file including joystick channel
|
|
|
|
assignments. Basically, anything* that is reported by the property manager
|
|
|
|
can now be tweaked without having to recompile the binary.
|
|
|
|
|
|
|
|
*see mini-doc/properties.txt for exceptions
|
|
|
|
|
|
|
|
Determining your joystick output:
|
|
|
|
|
|
|
|
Included with FlightGear is a utility called js_demo. It will report
|
|
|
|
the number of joysticks attached to a system and their capabilites.
|
|
|
|
By observing the output of js_demo while working our joystick we can
|
|
|
|
determine what controls are where.
|
|
|
|
It should be noted that, at least on UNIX, numbering generally starts with
|
|
|
|
zero. In the following example the system has 1 joystick (js0) connected.
|
|
|
|
The output shown is from an analog Gravis BlackHawk with four buttons and
|
|
|
|
a throttle.
|
|
|
|
|
|
|
|
Typical output of js_demo:
|
|
|
|
|
|
|
|
Joystick test program.
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Joystick 1 not detected
|
|
|
|
Joystick 2 not detected
|
|
|
|
+---------------JS.0-----------------+
|
|
|
|
| Btns Ax:0 Ax:1 Ax:2 |
|
|
|
|
+------------------------------------+
|
|
|
|
| 0000 +0.0 +0.0 -1.0 . . . |
|
|
|
|
|
|
|
|
It appears that the number of detected buttons is represented by the number of
|
|
|
|
"0"s. Clicking the actual buttons will result in the rightmost 0 changing to
|
|
|
|
the button number output. i.e. pressing button one will change the display to
|
|
|
|
look like this: 0001. It should be noted that this is a hexadecimal (base16)
|
|
|
|
number +1. Hex numbers start at 0, so this number is incremented by one for
|
|
|
|
hopefully obvious reasons.
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
|
2000-09-21 15:17:36 +00:00
|
|
|
Default Joystick properties:
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
|
2000-09-21 15:17:36 +00:00
|
|
|
Axis 0 = Aileron
|
|
|
|
Axis 1 = Elevator
|
|
|
|
Axis 2 = Rudder
|
|
|
|
Axis 3 = Throttle
|
|
|
|
Button 0 = All brakes
|
|
|
|
Button 1 = Left brake
|
|
|
|
Button 2 = Right brake
|
|
|
|
Button 3 = Elevator trim (up)
|
|
|
|
Button 4 = Elevator trim (down)
|
|
|
|
Button 5 = Flaps (down)
|
|
|
|
Button 6 = Flaps (up)
|
|
|
|
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
In addition to the channel assignments there are other properties
|
|
|
|
for tuning the joystick. These values work together in a particular order.
|
|
|
|
They should always be written as a 'float', or decimal number.
|
|
|
|
|
|
|
|
The full order of precedence for axis properties is
|
|
|
|
|
|
|
|
1. The raw axis value ...
|
|
|
|
2. is adjusted to dead-band, ...
|
|
|
|
3. then adjusted to offset, ...
|
|
|
|
4. then multiplied by factor, which ...
|
|
|
|
5. is assigned to the FlightGear control property.
|
|
|
|
|
|
|
|
Put another way....
|
|
|
|
|
|
|
|
cooked_value = (( raw_value > dead-band ) + offset) * factor
|
|
|
|
|
2000-09-21 15:17:36 +00:00
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
Axis properties:
|
|
|
|
|
|
|
|
dead-band
|
|
|
|
|
|
|
|
-1 0 1
|
|
|
|
.......................
|
|
|
|
-1 | | 1
|
|
|
|
^
|
|
|
|
dead-band
|
2000-09-21 15:17:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
This is an area where signals are ignored. It is used to compensate
|
|
|
|
for noise or potentiometers of dubious quality by creating a threshold
|
2000-10-06 21:45:47 +00:00
|
|
|
below which any signal is ignored.
|
2000-09-21 15:17:36 +00:00
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
The default of 0.1 for elevators and ailerons is very forgiving. A lower
|
|
|
|
number results in a tighter feel. Throttle defaults to 0.0
|
2000-09-21 15:17:36 +00:00
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
|
|
|
|
offset
|
2000-09-21 15:17:36 +00:00
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
-1 0 1
|
|
|
|
.......................
|
|
|
|
-1 ^ 1
|
|
|
|
offset
|
2000-09-21 15:17:36 +00:00
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
Used to maximize a controls use of it's axis, as in the case of a
|
2000-09-21 15:17:36 +00:00
|
|
|
throttle where zero would be a minimum and not a center point like in the case
|
2000-09-25 22:02:08 +00:00
|
|
|
of a rudder. Typical value -1.0.
|
2000-09-21 15:17:36 +00:00
|
|
|
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
factor
|
|
|
|
|
|
|
|
Controls sensitivity of an axis. If the factor is too low it results in
|
|
|
|
control not reaching its maximum possible limit. Negating the number will result in
|
|
|
|
the control moving counter to the default. The default value is 1.0, think unity gain.
|
|
|
|
|
|
|
|
In my case, throttle behaviour was inverted from what I preferred.
|
|
|
|
I set this value to -1.0 and everything was groovy.
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-21 15:17:36 +00:00
|
|
|
Button properties
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
switch
|
2000-09-21 15:17:36 +00:00
|
|
|
A button designated a switch is either on or off. While the button is
|
|
|
|
held in the switch is engaged. Brakes are described as a switch and take
|
|
|
|
additional parameters [ step, repeatable ]
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
adjust
|
2000-09-21 15:17:36 +00:00
|
|
|
A button designated adjust is for controls that have a range
|
|
|
|
of settings, for example elevator trim and flaps. These are found
|
|
|
|
in pairs having opposing values for the parameter 'step'.
|
|
|
|
The 'repeatable' parameter should be appropriate to the type of control.
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
step
|
2000-09-21 15:17:36 +00:00
|
|
|
This defines how much adjustment is applied when the button is activated
|
|
|
|
Default values are 1.0 for brakes (full on), 0.001 / -0.001 for
|
|
|
|
elevator trim and -0.34 / 0.34 for flaps
|
|
|
|
|
2000-10-06 21:45:47 +00:00
|
|
|
repeatable
|
2000-09-21 15:17:36 +00:00
|
|
|
In this case repeatable means when the button is held down the value continues
|
|
|
|
to increment. repeatable is a true / false value. The default for brakes is
|
|
|
|
false. This is appropriate since by default brakes are a switch that are full
|
2000-09-25 22:02:08 +00:00
|
|
|
on. Elevator trim on the other hand defaults to true. Holding down the
|
2000-09-21 15:17:36 +00:00
|
|
|
button for elevator trim will cause a continuous adjustment until the button
|
|
|
|
is released. Being a fine adjustment this is appropriate behaviour. Flaps
|
|
|
|
on the otherhand default to false. Clicking the flaps button will cause the
|
|
|
|
flaps to be extended to the first detent, subsequent clicks will extend or
|
|
|
|
retract by one increment. Being a large adjustment with a major impact on a
|
|
|
|
planes handling this is a good thing.
|
|
|
|
|
|
|
|
Syntax for properties in .fgfsrc
|
|
|
|
|
|
|
|
Here is a listing of the defaults as they would appear in .fgfsrc
|
|
|
|
You only need entries where the defaults aren't what you want.
|
|
|
|
In my case I had to make entries to put the throttle on axis2.
|
|
|
|
|
|
|
|
// Default axis 0 to aileron
|
|
|
|
--prop:/input/js0/axis0/control=/controls/aileron
|
|
|
|
--prop:/input/js0/axis0/dead-band=0.1
|
|
|
|
|
|
|
|
// Default axis 1 to elevator
|
|
|
|
--prop:/input/js0/axis1/control=/controls/elevator"
|
|
|
|
--prop:/input/js0/axis1/dead-band=0.1
|
|
|
|
--prop:/input/js0/axis1/factor=-1.0
|
|
|
|
|
|
|
|
// Default axis 2 to rudder
|
|
|
|
--prop:/input/js0/axis2/control=/controls/rudder
|
|
|
|
--prop:/input/js0/axis2/dead-band=0.1
|
|
|
|
|
|
|
|
// Default axis 3 to throttle
|
|
|
|
--prop:/input/js0/axis3/control=/controls/throttle
|
|
|
|
--prop:/input/js0/axis3/dead-band=0.0
|
|
|
|
--prop:/input/js0/axis3/offset=-1.0
|
|
|
|
--prop:/input/js0/axis3/factor=-0.5
|
|
|
|
|
|
|
|
// Default button 0 to all brakes
|
|
|
|
--prop:/input/js0/button0/action=switch
|
|
|
|
--prop:/input/js0/button0/control=/controls/brakes/all
|
|
|
|
--prop:/input/js0/button0/step=1.0
|
|
|
|
--prop:/input/js0/button0/repeatable=false
|
|
|
|
|
|
|
|
// Default button 1 to left brake.
|
|
|
|
--prop:/input/js0/button1/action=switch
|
|
|
|
--prop:/input/js0/button1/control=/controls/brakes/left
|
|
|
|
--prop:/input/js0/button1/step=1.0
|
|
|
|
--prop:/input/js0/button1/repeatable=false
|
|
|
|
|
|
|
|
// Default button 2 to right brake.
|
|
|
|
--prop:/input/js0/button2/action=switch
|
|
|
|
--prop:/input/js0/button2/control=/controls/brakes/right
|
|
|
|
--prop:/input/js0/button2/step=1.0
|
|
|
|
--prop:/input/js0/button2/repeatable=false
|
|
|
|
|
|
|
|
// Default buttons 3 and 4 to elevator trim
|
|
|
|
--prop:/input/js0/button3/action=adjust
|
|
|
|
--prop:/input/js0/button3/control=/controls/elevator-trim
|
|
|
|
--prop:/input/js0/button3/step=0.001
|
|
|
|
--prop:/input/js0/button3/repeatable=true
|
|
|
|
|
|
|
|
--prop:/input/js0/button4/action=adjust
|
|
|
|
--prop:/input/js0/button4/control=/controls/elevator-trim
|
|
|
|
--prop:/iput/js0/button4/step=0.001
|
|
|
|
--prop:/input/js0/button4/repeatable=true
|
|
|
|
|
|
|
|
// Default buttons 5 and 6 to flaps
|
|
|
|
--prop:/input/js0/button5/action=adjust
|
|
|
|
--prop:/input/js0/button5/control=/controls/flaps
|
|
|
|
--prop:/input/js0/button5/step=-0.34
|
|
|
|
--prop:/input/js0/button5/repeatable=false
|
|
|
|
|
|
|
|
--prop:/input/js0/button6/action=adjust
|
|
|
|
--prop:/input/js0/button6/control=/controls/flaps"
|
|
|
|
--prop:/input/js0/button6/step=0.34
|
|
|
|
--prop:/input/js0/button6/repeatable=false
|
|
|
|
|
|
|
|
|
2000-09-25 22:02:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-21 15:17:36 +00:00
|
|
|
|