8,571
edits
(Short intro on "buying a joystick or yoke?") |
(Make the "beginner" section more geared towards a quick setup of common input devices.) |
||
Line 1: | Line 1: | ||
Could you imagine a pilot in his or her [[:Category:Cessna|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? | Could you imagine a pilot in his or her [[:Category:Cessna|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? | ||
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 in the Help > Joystick Information dialog from the [[menu]]. | 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 in the Help > Joystick Information dialog from the [[menu]]. | ||
Unfortunately, for the above mentioned versatility, chances are your joystick does not work out of the box. | Unfortunately, for the above mentioned versatility, chances are your joystick does not work out of the box. This article explains you how to make FlightGear recognise your device | ||
== Joystick or yoke? == | == Joystick or yoke? == | ||
Line 52: | Line 52: | ||
== Built-in joystick support == | == Built-in joystick support == | ||
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". | |||
FlightGear includes a large number of such bindings files for a variety of manufacturers. Chances are high that your joystick will be recognised straight away, so let's try that first. You can confirm whether it was recognised by looking in the <tt>Help > Joystick Information</tt> dialog. "Used for" should contain a name/description of your joystick. It will contain "default" when FlightGear did not recognise your joystick. | |||
FlightGear | Most of the time when your joystick is not recognised, it is because of a missing name definition in the respective bindings file. Because FlightGear is used on all kind of operating systems, names vary a lot. You can find the files under <tt>[[$FG_ROOT]]/Input/Joysticks/</tt> (despite the name, yokes and pedals are also found here!). For example, if you have a CH Products joystick, look in the folder <tt>[[$FG_ROOT]]/Input/Joysticks/CH</tt> for a file that might work for your joystick. When such a file exists, do the following: | ||
# Launch FlightGear with the joystick connected. | |||
# Look under Help > Joystick Information and check the name behind "Joystick #0:". | |||
# Open your joystick's bindings file in a XML editor and add the following code to the file, below the already-present <code><name></code> tags. | |||
#:<pre><name>The EXACT name you found under step 2; including spaces, capitals etc.</name></pre> | |||
# Please report this name [http://www.flightgear.org/forums/viewforum.php?f=24 at our forum], so it can be added to the official file (and next releases). | |||
Please note that the latest config files are always to be found at https://gitorious.org/fg/fgdata/trees/master/Input/Joysticks. This link may contain additional binding files that were not included in the latest stable release. | |||
If there is no file for your joystick, you will have to create such a file. We will discuss that in [[Joystick#Writing or editing joystick binding xml files|a later section]], by cutting and pasting bindings from the examples that are included with FlightGear. | |||
=== Multiple devices on Windows === | |||
In case you have two USB devices (for instance a yoke plus pedals) to a Windows computer, there may be cases, where the same driver name is reported twice. In this case, you can get at least the yoke to work by assigning it number 0 (out of 0 and 1), by adding a line to <tt>[[$FG_ROOT]]/joystick.xml</tt> like: | |||
<js n="0" include="Input/Joysticks/Saitek/ST290-Pro.xml"/> | |||
if you also have pedals (or another joystick), just add more lines, similar to: | |||
<js n="1" include="Input/Joysticks/Saitek/Pro-Flight-Rudder-Pedals.xml"/> | |||
To make sure that the first input device is indeed the yoke, rotate the yoke ([[aileron]] control) and observe the Help > Joystick Information dialog. If the aileron value does not 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. Afterwards you can check that assignment by restarting FlightGear. The yoke should now control the aileron. | |||
== Adding support for your joystick == | |||
=== Verifying your joystick is working === | === Verifying your joystick is working === | ||
==== Linux ==== | ==== Linux ==== | ||
Line 225: | Line 241: | ||
You can tell how FlightGear has interpretted your joystick setup by selecting <tt>Help > Joystick Information</tt> from the menu. | You can tell how FlightGear has interpretted your joystick setup by selecting <tt>Help > Joystick Information</tt> from the menu. | ||
== Joystick support via .fgfsrc entries == | == Joystick support via .fgfsrc entries == |