Writing Joystick Code: Part 4: Difference between revisions
(Created page with "{{WIP}} == Axis Numbering == Until now we have got our joysticks working in our system by defining each axis with the following format <axis n="0"> <desc>Aileron</des...") |
No edit summary |
||
Line 59: | Line 59: | ||
-------------------------------------------------- | ----------------------------------------------------------------------------- | ||
Any complaints/suggestions/questions/kudos can be posted [http://flightgear.org/forums/viewtopic.php?f=24&t=17892 here]. | |||
[[Category:Hardware]] |
Revision as of 02:54, 15 October 2012
Work in progress This article or section will be worked on in the upcoming hours or days. See history for the latest developments. |
Axis Numbering
Until now we have got our joysticks working in our system by defining each axis with the following format
<axis n="0"> <desc>Aileron</desc> <binding> ... </axis>
This fine if you are using the joystick on your system. But imagine that you have worked out a brilliant button assignment scheme, using modifiers, so that the joystick is a joy to use. You want to post your code in the forum so everyone can use it.
There's a problem though. Different operating systems assign different numbers to the axes. Let's say that with joystick, Windows says that the Aileron axis is number 0, and Macs and Linux say it is axis 2. We have to change our format of the axis definition to
<axis> <win>0</win> <mac>2</mac> <unix>2</unix> <desc>Aileron</desc> <binding> ... </axis>
Now th joystick will work with all operating systems.
The reason we write <unix> is because Linux is a variant of Unix.
Unfortunately, there is no fixed relationship between axis numbering in the operating susyems, and the information must be garnered form experienece. Fortunately, the button numbering doesn't change.
Here is a list of axis numbers for various joysticks. The list will be expanded as and when I get the required information. If you have axis numbers for a joystick not listed, please post the information here.
Logitech WingMan Extreme Digital 3D (USB) Ailerons win 0 unix 0 mac 0 Elevator win 1 unix 1 mac 1 Throttle win 2 unix 3 mac 3 # Slider Rudder win 3 unix 2 mac 2 # Twist Hat win 6 unix 4 mac 4 # Left/right Hat win 7 unix 5 mac 5 # Up/down
Go back to Writing Joystick Code: Part 3
Any complaints/suggestions/questions/kudos can be posted here.