1
0
Fork 0

Add support for a Logitech Extreme 3D Pro and a thrustmaster top gun afterburner USB joystick

This commit is contained in:
ehofman 2004-03-04 10:37:44 +00:00
parent 65407653a9
commit db14caea2d
3 changed files with 803 additions and 0 deletions

View file

@ -0,0 +1,260 @@
<?xml version="1.0" ?>
<!--
************************************************************************
* Bindings for Logitech Extreme Digital 3D Pro joystick.
*
*
* Axis 0: ailerons
* Axis 1: elevator
* Axis 2 (twist): rudder
* Axis 3 (slider): throttle
* Axes 4 and 5 (hat): view direction
*
* Buttons according to the numbers printed on the joystick:
* Button 1: all brakes
* Button 4: flap down
* Button 6: flap up
* Button 5: elevator trim up
* Button 3: elevator trim down
* Button 11: left brake only
* Button 12: right brake only
************************************************************************
$Id$
-->
<PropertyList>
<name>Logitech Extreme Digital 3D Pro</name>
<axis n="0">
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="1">
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<factor type="double">-1.0</factor>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="2">
<desc>Rudder</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/rudder</property>
<factor type="double">1.0</factor>
</binding>
</axis>
<axis n="3">
<desc>Throttle</desc>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[0]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[1]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[2]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[3]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[4]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[5]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[6]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
<binding>
<command>property-scale</command>
<property>/controls/engines/engine[7]/throttle</property>
<offset type="double">-1.0</offset>
<factor type="double">-0.5</factor>
</binding>
</axis>
<axis n="4">
<desc>View Direction</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">5.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-heading-offset-deg</property>
<step type="double">-5.0</step>
</binding>
</high>
</axis>
<axis n="5">
<desc>View Elevation</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">5.0</step>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/goal-pitch-offset-deg</property>
<step type="double">-5.0</step>
</binding>
</high>
</axis>
<button n="0">
<desc>Brakes</desc>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[0]/brake</property>
<value type="double">1.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[1]/brake</property>
<value type="double">1.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[2]/brake</property>
<value type="double">1.0</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[0]/brake</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[1]/brake</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[2]/brake</property>
<value type="double">0.0</value>
</binding>
</mod-up>
</button>
<button n="4">
<desc>Elevator trim up</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/elevator-trim</property>
<step type="double">0.001</step>
</binding>
</button>
<button n="2">
<desc>Elevator trim down</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/elevator-trim</property>
<step type="double">-0.001</step>
</binding>
</button>
<button n="3">
<desc>Flaps down</desc>
<repeatable>false</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/flaps</property>
<step type="double">-0.34</step>
</binding>
</button>
<button n="5">
<desc>Flaps up</desc>
<repeatable>false</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/flight/flaps</property>
<step type="double">0.34</step>
</binding>
</button>
<button n="11">
<desc>Right brake</desc>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[1]/brake</property>
<value type="double">1.0</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[1]/brake</property>
<value type="double">0.0</value>
</binding>
</mod-up>
</button>
<button n="10">
<desc>Left brake</desc>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[0]/brake</property>
<value type="double">1.0</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[0]/brake</property>
<value type="double">0.0</value>
</binding>
</mod-up>
</button>
</PropertyList>

View file

@ -0,0 +1,541 @@
<?xml version="1.0"?>
<!--
$Id$
Bindings for THRUSTMASTER Top Gun Afterburner stick/throttle combination.
This file is based on the Cyborg-Gold-3d-USB configuration file. So it provides
maximum compatibility.
_______________________________________ Layout _______________________________________
axis 0: aileron
axis 1: elevator
axis 2: rudder
axis 3: throttle
no modifier F3 F4 F3+F4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
button 0 (trigger): brakes parking brake speed brake thrust revers.
button 1 (top middle): flaps up gear up previous view *
button 2 (front right): reset view dir tail wheel lock cockpit view reset all trim
button 3 (top right): flaps down gear down next view *
button 4 (thr. down/back): brakes left * zoom out *
button 5 (thr. middle/back): brakes right * zoom in *
button 6 (thr. upper/back): //////////////////////// modifier 0 /////////////////////////
button 7 (thr. front): //////////////////////// modifier 1 /////////////////////////
hat left (axis5): look left leaner mixture aileron trim rudder trim
hat right (axis5): look right richer mixture aileron trim rudder trim
hat back (axis6): look down dec prop pitch elevator trim *
hat forward (axis6): look up inc prop pitch elevator trim *
F3 and F4 are used like "Shift", "Control", or "Alternate" on computer keyboards.
For example: press F3 and keep holding it down while pressing the fire
button/trigger -> toggle parking brake
Also this configurations will make use of the raster positions on the throttle.
The idle position and below is really zero thrust command.
Positions bewteen idle and afterburner will scale the thrust value between 0 and 0.98
and thus provides military power for jet engines. The afterburner raster will
really turn on afterburning.
Also to avoid additional deadband values in the linux kernel
to the deadband values configured here in flightgear.
You may need to issue the following command before starting flightgear:
jscal -s 7,1,0,-5,5,4194304,4194304,1,0,-5,5,4194304,4194304,1,0,-5,5,4194304,4194304,1,0,128,128,4194304,4194304,1,0,112,142,5534751,5534751,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912 /dev/input/js0
This will also avoid the useless deadband area in the middle of the throttle position.
Also this will make the raster positions of the throttle match the programmed values here.
___________________________________ Customization ____________________________________
If you want to change some (or all) of the bindings, the recommended way is
to copy this file to your home directory, make your changes there, and include
it from your personal preferences.xml file. Use the tags <js-named n="100">
and </js-named> around the definitions, but within the <PropertyList> scope.
(You can use any number lower than 999.)
<PropertyList>
<input>
<joysticks include="your-modified-copy.xml"/>
</input>
</PropertyList>
The property "/input/joysticks/js[0]/saitek-cyborg-3D-modifier" indicates
the "shift" level. F3 sets bit 0, F4 sets bit 1. The property is 'nil' or
zero if none of the shift buttons is pressed, 1 if F3 is pressed, 2 if F4
is pressed, and 3 if both F3 and F4 are pressed.
Note that you have to enclose nasal scripts in <script><![CDATA[...]]></script>
if they contain characters that interfere with the xml markup. This is the case
if you are, for exmaple, using < (lower than). Alternatively, you can 'escape'
the character with "&lt;".
____________________________________ References ______________________________________
Joysticks: $FG_ROOT/Docs/README.Joystick.html
Properties: see property browser (fgfs menu: "File"->"Browse internal properties")
Nasal: http://www.plausible.org/nasal/
Nasal examples: $FG_ROOT/Nasal/
______________________________________________________________________________________
~~ Melchior FRANZ <mfranz@aon.at>
slightly modified for the thrustmaster joystick Mathias Froehlich <Mathias.Froehlich@web.de>
-->
<PropertyList>
<name>THRUSTMASTER Top Gun Afterburner</name>
<axis n="0">
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<power type="double">2.0</power>
</binding>
</axis>
<axis n="1">
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<factor type="double">-1.0</factor>
<power type="double">2.0</power>
</binding>
</axis>
<axis n="2">
<desc>Rudder</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/rudder</property>
<offset type="double">0.0</offset>
<factor type="double">1.0</factor>
<power type="double">2.0</power>
</binding>
</axis>
<axis n="3">
<!--
We have a throttle with two raster positions.
The areas are:
1 - 0.87: idle
0.87 - 0.79: idle deadband
0.79 - -0.55: normal thrust
-0.55 - -0.73: afterburner deadband
-0.73 - -1: afterburner
-->
<desc>Throttle</desc>
<dead-band type="double">0.0</dead-band>
<binding>
<command>nasal</command>
<script>
<![CDATA[
if (1==1) {
val = cmdarg().getNode("setting").getValue();
abend = -1;
abstart = -0.73;
milend = -0.55;
milstart = 0.79;
if (val < abstart) {
# afterburner
a = 0.03/(abend-abstart);
b = 1-a*abend;
props.setAll("/controls/engines/engine", "augumentation", "true");
props.setAll("/controls/engines/engine", "throttle", a*val+b);
} else {
# no afterburner
props.setAll("/controls/engines/engine", "augumentation", "false");
if (val < -0.55) {
# afterburner deadband
props.setAll("/controls/engines/engine", "throttle", 0.9699999999);
} else {
if (val < 0.79) {
a = 0.96999999999/(milend-milstart);
b = -a*milstart;
props.setAll("/controls/engines/engine", "throttle", a*val+b);
} else {
props.setAll("/controls/engines/engine", "throttle", 0);
}
}
}
}
]]>
</script>
</binding>
</axis>
<button n="0"><!-- trigger -->
<desc>Brakes</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
interpolate("/controls/gear/brake-left", 1, 0.075);
interpolate("/controls/gear/brake-right", 1, 0.075);
} elsif (mod == 1) {
setprop("/controls/gear/brake-left", 1);
setprop("/controls/gear/brake-right", 1);
} elsif (mod == 2) {
#
} elsif (mod == 3) {
#
}
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
interpolate("/controls/gear/brake-left", 0, 0.075);
interpolate("/controls/gear/brake-right", 0, 0.075);
} elsif (mod == 1) {
brake = !getprop("/controls/gear/brake-parking");
setprop("/controls/gear/brake-parking", brake);
if (brake) {
gui.popupTip("Parking Brake ON");
} else {
gui.popupTip("Parking Brake OFF");
}
setprop("/controls/gear/brake-left", 0);
setprop("/controls/gear/brake-right", 0);
} elsif (mod == 2) {
speedbrake = !getprop("/controls/flight/speedbrake");
setprop("/controls/flight/speedbrake", speedbrake);
} elsif (mod == 3) {
reverser = !getprop("/controls/engines/engine[0]/reverser");
props.setAll("/controls/engines/engine", "reverser", reverser);
if (reverser) {
gui.popupTip("Thrust Reverser ON");
} else {
gui.popupTip("Thrust Reverser OFF");
}
}
</script>
</binding>
</mod-up>
</button>
<button n="1"><!-- top middle -->
<desc>Flaps/gear up; previous view</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
controls.stepFlaps(-1);
} elsif (mod == 1) {
setprop("/controls/gear/gear-down", 0);
} elsif (mod == 2) {
view.stepView(-1);
} elsif (mod == 3) {
#
}
</script>
</binding>
</button>
<button n="2"><!-- front right -->
<desc>Reset view; toggle tail-wheel lock; reset trim</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
view.resetView();
} elsif (mod == 1) {
twlock = !getprop("/controls/gear/tailwheel-lock");
setprop("/controls/gear/tailwheel-lock", twlock);
if (twlock) {
rection Hat -->} else {
gui.popupTip("Tail Wheel LOCKED");
}
} elsif (mod == 2) {
setprop("/sim/current-view/view-number", 0);
view.resetView();
} elsif (mod == 3) {
setprop("/controls/flight/elevator-trim", 0);
setprop("/controls/flight/aileron-trim", 0);
setprop("/controls/flight/rudder-trim", 0);
}
</script>
</binding>
</button>
<button n="3"><!-- top right -->
<desc>Flaps/gear down; next view</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
controls.stepFlaps(1);
} elsif (mod == 1) {
setprop("/controls/gear/gear-down", 1);
} elsif (mod == 2) {
view.stepView(1);
} elsif (mod == 3) {
#
}
</script>
</binding>
</button>
top
<button n="4"><!-- throttle down/back -->
<desc>Brakes left</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
interpolate("/controls/gear/brake-left", 1, 0.075);
} elsif (mod == 1) {
#
} elsif (mod == 2) {
view.increase();
} elsif (mod == 3) {
#
}
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
interpolate("/controls/gear/brake-left", 0, 0.075);
} elsif (mod == 1) {
#
} elsif (mod == 2) {
#
} elsif (mod == 3) {
#
}
</script>
</binding>
</mod-up>
</button>
<button n="5"><!-- throttle middle/back -->
<desc>Brakes right</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
interpolate("/controls/gear/brake-right", 1, 0.075);
} elsif (mod == 1) {
#
} elsif (mod == 2) {
view.decrease();
} elsif (mod == 3) {
#
}
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
interpolate("/controls/gear/brake-right", 0, 0.075);
} elsif (mod == 1) {
#
} elsif (mod == 2) {
#
} elsif (mod == 3) {
#
}
</script>
</binding>
</mod-up>
</button>
<button n="6"><!-- throttle upper/back -->
<desc>Modifier Bit 0</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
mod = getprop(name);
if (mod == nil) {
setprop(name, 1);
} elsif (mod == 0 or mod == 2) {
setprop(name, mod + 1);
}
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
mod = getprop(name);
if (mod == nil) {
setprop(name, 0);
} elsif (mod == 1 or mod == 3) {
setprop(name, mod - 1);
}
</script>
</binding>
</mod-up>
</button>
<button n="7"><!-- throttle front -->
<desc>Modifier Bit 1</desc>
<repeatable type="bool">false</repeatable>
<binding>
<command>nasal</command>
<script>
name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
mod = getprop(name);
if (mod == nil) {
setprop(name, 2);
} elsif (mod == 0 or mod == 1) {
setprop(name, mod + 2);
}
</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>
name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
mod = getprop(name);
if (mod == nil) {
setprop(name, 0);
} elsif (mod == 2 or mod == 3) {
setprop(name, mod - 2);
}
</script>
</binding>
</mod-up>
</button>
<axis n="5"><!-- View Direction Hat -->
<desc>View direction; mixture; aileron trim; rudder trim</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
<![CDATA[
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
v = getprop("/sim/current-view/view-number");
if (v == 0 or v == 4) {
view.panViewDir(1);
} else {
view.panViewDir(-1);
}
} elsif (mod == 1) {
controls.adjMixture(-2);
} elsif (mod == 2) {
controls.aileronTrim(-0.75);
} elsif (mod == 3) {
controls.rudderTrim(0.75);
}
]]>
</script>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
<![CDATA[
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
v = getprop("/sim/current-view/view-number");
if (v == 0 or v == 4) {
view.panViewDir(-1);
} else {
view.panViewDir(1);
}
} elsif (mod == 1) {
controls.adjMixture(2);
} elsif (mod == 2) {
controls.aileronTrim(0.75);
} elsif (mod == 3) {
controls.rudderTrim(-0.75);
}
]]></script>
</binding>
</high>
</axis>
<axis n="6">
<desc>View direction; prop pitch; elevator trim</desc>
<low>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
<![CDATA[
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
view.panViewPitch(1);
} elsif (mod == 1) {
controls.adjPropeller(1);
} elsif (mod == 2) {
controls.elevatorTrim(0.75);
} elsif (mod == 3) {
#
}
]]>
</script>
</binding>
</low>
<high>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>
<![CDATA[
mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
if (mod == nil or mod == 0) {
view.panViewPitch(-1);
} elsif (mod == 1) {
controls.adjPropeller(-1);
} elsif (mod == 2) {
controls.elevatorTrim(-0.75);
} elsif (mod == 3) {
#
}
]]>
</script>
</binding>
</high>
</axis>
</PropertyList>

View file

@ -26,6 +26,7 @@ Joystick binding definitions.
<js-named include="Input/Joysticks/Logitech/wingman-force-3d.xml"/> <js-named include="Input/Joysticks/Logitech/wingman-force-3d.xml"/>
<js-named include="Input/Joysticks/Logitech/wingman-rumblepad-usb.xml"/> <js-named include="Input/Joysticks/Logitech/wingman-rumblepad-usb.xml"/>
<js-named include="Input/Joysticks/Logitech/extreme-3d-win.xml"/> <js-named include="Input/Joysticks/Logitech/extreme-3d-win.xml"/>
<js-named include="Input/Joysticks/Logitech/extreme-3d-pro.xml"/>
<!-- Microsoft devices --> <!-- Microsoft devices -->
<js-named include="Input/Joysticks/Microsoft/sidewinder.xml"/> <js-named include="Input/Joysticks/Microsoft/sidewinder.xml"/>
@ -43,6 +44,7 @@ Joystick binding definitions.
<!-- ThrustMaster devices --> <!-- ThrustMaster devices -->
<js-named include="Input/Joysticks/ThrustMaster/FCS.xml"/> <js-named include="Input/Joysticks/ThrustMaster/FCS.xml"/>
<js-named include="Input/Joysticks/ThrustMaster/Attack-Throttle.xml"/> <js-named include="Input/Joysticks/ThrustMaster/Attack-Throttle.xml"/>
<js-named include="Input/Joysticks/ThrustMaster/Top-Gun-Afterburner.xml"/>
<!-- Lew Engineering RCJOY device for various RC transmitters. http://www.leweng.com --> <!-- Lew Engineering RCJOY device for various RC transmitters. http://www.leweng.com -->
<js-named include="Input/Joysticks/LewEngineering/RC-transmitter-hitecLaser4.xml"/> <js-named include="Input/Joysticks/LewEngineering/RC-transmitter-hitecLaser4.xml"/>