Debian Codegraph @

Input/Joysticks/ThrustMaster/Top-Gun-Afterburner-USB.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <!--
3
4 Original file by frohlich
5
6 $Id$
7
8 Bindings for THRUSTMASTER Top Gun Afterburner USB stick/throttle combination.
9
10 This file is based on the Cyborg-Gold-3d-USB configuration file. So it provides
11 maximum compatibility.
12
13 _______________________________________ Layout _______________________________________
14
15
16 axis 0: aileron
17 axis 1: elevator
18 axis 2: rudder
19 axis 3: throttle
20
21
22 no modifier F3 F4 F3+F4
23 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 button 0 (trigger): brakes parking brake speed brake thrust revers.
25 button 1 (top middle): flaps up gear up previous view *
26 button 2 (front right): reset view dir tail wheel lock cockpit view reset all trim
27 button 3 (top right): flaps down gear down next view *
28 button 4 (thr. down/back): brakes left * zoom out *
29 button 5 (thr. middle/back): brakes right * zoom in *
30 button 6 (thr. upper/back): //////////////////////// modifier 0 /////////////////////////
31 button 7 (thr. front): //////////////////////// modifier 1 /////////////////////////
32 hat left (axis5): look left leaner mixture aileron trim rudder trim
33 hat right (axis5): look right richer mixture aileron trim rudder trim
34 hat back (axis6): look down dec prop pitch elevator trim *
35 hat forward (axis6): look up inc prop pitch elevator trim *
36
37
38 F3 and F4 are used like "Shift", "Control", or "Alternate" on computer keyboards.
39 For example: press F3 and keep holding it down while pressing the fire
40 button/trigger -> toggle parking brake
41
42 When flying the Harrier, "F3/hat left" and "right" control the thrust vector.
43
44 Also this configurations will make use of the raster positions on the throttle.
45 The idle position and below is really zero thrust command.
46 Positions bewteen idle and afterburner will scale the thrust value between 0 and 0.98
47 and thus provides military power for jet engines. The afterburner raster will
48 really turn on afterburning.
49
50 Also to avoid additional deadband values in the linux kernel
51 to the deadband values configured here in flightgear.
52 You may need to issue the following command before starting flightgear:
53
54 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
55
56 This will also avoid the useless deadband area in the middle of the throttle position.
57 Also this will make the raster positions of the throttle match the programmed values here.
58
59 ___________________________________ Customization ____________________________________
60
61
62
63 If you want to change some (or all) of the bindings, the recommended way is
64 to copy this file to your home directory, make your changes there, and include
65 it from your personal preferences.xml file. Use the tags <js-named n="100">
66 and </js-named> around the definitions, but within the <PropertyList> scope.
67 (You can use any number lower than 999.)
68
69 <PropertyList>
70 <input>
71 <joysticks include="your-modified-copy.xml"/>
72 </input>
73 </PropertyList>
74
75
76 The property "/input/joysticks/js[0]/saitek-cyborg-3D-modifier" indicates
77 the "shift" level. F3 sets bit 0, F4 sets bit 1. The property is 'nil' or
78 zero if none of the shift buttons is pressed, 1 if F3 is pressed, 2 if F4
79 is pressed, and 3 if both F3 and F4 are pressed.
80
81 Note that you have to enclose nasal scripts in <script><![CDATA[...]]></script>
82 if they contain characters that interfere with the xml markup. This is the case
83 if you are, for exmaple, using < (lower than). Alternatively, you can 'escape'
84 the character with "&lt;".
85
86
87
88
89 ____________________________________ References ______________________________________
90
91
92
93 Joysticks: $FG_ROOT/Docs/README.Joystick.html
94 Properties: see property browser (fgfs menu: "File"->"Browse internal properties")
95
96 Nasal: http://www.plausible.org/nasal/
97 Nasal examples: $FG_ROOT/Nasal/
98
99
100 ______________________________________________________________________________________
101
102 ~~ Melchior FRANZ <[email protected]>
103 slightly modified for the thrustmaster joystick Mathias Froehlich <[email protected]>
104 -->
105
106 <PropertyList>
107 <name type="string">ThrustMaster HOTAS Force Feedback Joystick</name>
108
109 <axis>
110 <desc>Aileron</desc>
111 <number>
112 <unix>0</unix>
113 <mac>0</mac>
114 <windows>0</windows>
115 </number>
116 <binding>
117 <command>property-scale</command>
118 <property>/controls/flight/aileron</property>
119 <power type="double">2.0</power>
120 </binding>
121 </axis>
122
123 <axis>
124 <desc>Elevator</desc>
125 <number>
126 <unix>1</unix>
127 <mac>1</mac>
128 <windows>1</windows>
129 </number>
130 <binding>
131 <command>property-scale</command>
132 <property>/controls/flight/elevator</property>
133 <factor type="double">-1.0</factor>
134 <power type="double">2.0</power>
135 </binding>
136 </axis>
137
138 <axis>
139 <desc>Rudder</desc>
140 <number>
141 <unix>3</unix>
142 <mac>3</mac>
143 <windows>3</windows>
144 </number>
145 <binding>
146 <command>property-scale</command>
147 <property>/controls/flight/rudder</property>
148 <offset type="double">0.0</offset>
149 <factor type="double">1.0</factor>
150 <power type="double">2.0</power>
151 </binding>
152 </axis>
153
154 <axis>
155 <!--
156 We have a throttle with two raster positions.
157
158 The areas are:
159 1 - 0.99: idle
160 0.99 - 0.9: idle deadband
161 0.9 - -0.55: normal thrust
162 -0.55 - -0.9: afterburner deadband
163 -0.9 - -1: afterburner
164 -->
165 <desc>Throttle</desc>
166 <number>
167 <unix>2</unix>
168 <mac>2</mac>
169 <windows>2</windows>
170 </number>
171 <dead-band type="double">0.0</dead-band>
172 <binding>
173 <command>nasal</command>
174 <script>
175 <![CDATA[
176 if (1==1) {
177 val = cmdarg().getNode("setting").getValue();
178 abend = -1;
179 abstart = -0.9;
180 milend = -0.55;
181 milstart = 0.9;
182 if (val < abstart) {
183 # afterburner
184 a = 0.03/(abend-abstart);
185 b = 1-a*abend;
186 props.setAll("/controls/engines/engine", "augmentation", "true");
187 props.setAll("/controls/engines/engine", "throttle", a*val+b);
188 } else {
189 # no afterburner
190 props.setAll("/controls/engines/engine", "augmentation", "false");
191 if (val < milend) {
192 # afterburner deadband
193 props.setAll("/controls/engines/engine", "throttle", 0.9699999999);
194 } else {
195 if (val < milstart) {
196 a = 0.96999999999/(milend-milstart);
197 b = -a*milstart;
198 props.setAll("/controls/engines/engine", "throttle", a*val+b);
199 #props.setAll("/controls/engines/engine", "cutoff", 0);
200 #props.setAll("/controls/engines/engine", "starter", 0);
201 } else {
202 if (val < 0.99) {
203 props.setAll("/controls/engines/engine", "throttle", 0.4);
204 #props.setAll("/controls/engines/engine", "cutoff", 0);
205 #props.setAll("/controls/engines/engine", "starter", 1);
206 } else {
207 props.setAll("/controls/engines/engine", "throttle", 0);
208 #props.setAll("/controls/engines/engine", "cutoff", 1);
209 #props.setAll("/controls/engines/engine", "starter", 0);
210 }
211 }
212 }
213 }
214 }
215 ]]>
216 </script>
217 </binding>
218 </axis>
219
220 <button n="0"><!-- trigger -->
221 <desc>Brakes</desc>
222 <repeatable type="bool">true</repeatable>
223 <binding>
224 <command>nasal</command>
225 <script>
226 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
227 if (mod == nil or mod == 0) {
228 interpolate("/controls/gear/brake-left", 1, 0.075);
229 interpolate("/controls/gear/brake-right", 1, 0.075);
230 } elsif (mod == 1) {
231 setprop("/controls/gear/brake-left", 1);
232 setprop("/controls/gear/brake-right", 1);
233 } elsif (mod == 2) {
234 #
235 } elsif (mod == 3) {
236 #
237 }
238 </script>
239 </binding>
240 <mod-up>
241 <binding>
242 <command>nasal</command>
243 <script>
244 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
245 if (mod == nil or mod == 0) {
246 interpolate("/controls/gear/brake-left", 0, 0.075);
247 interpolate("/controls/gear/brake-right", 0, 0.075);
248 } elsif (mod == 1) {
249 brake = !getprop("/controls/gear/brake-parking");
250 setprop("/controls/gear/brake-parking", brake);
251 if (brake) {
252 gui.popupTip("Parking Brake ON");
253 } else {
254 gui.popupTip("Parking Brake OFF");
255 }
256 setprop("/controls/gear/brake-left", 0);
257 setprop("/controls/gear/brake-right", 0);
258 } elsif (mod == 2) {
259 speedbrake = !getprop("/controls/flight/speedbrake");
260 setprop("/controls/flight/speedbrake", speedbrake);
261 } elsif (mod == 3) {
262 reverser = !getprop("/controls/engines/engine[0]/reverser");
263 props.setAll("/controls/engines/engine", "reverser", reverser);
264 if (reverser) {
265 gui.popupTip("Thrust Reverser ON");
266 } else {
267 gui.popupTip("Thrust Reverser OFF");
268 }
269 }
270 </script>
271 </binding>
272 </mod-up>
273 </button>
274
275 <button n="1"><!-- top middle -->
276 <desc>Flaps/gear up; previous view</desc>
277 <repeatable type="bool">false</repeatable>
278 <binding>
279 <command>nasal</command>
280 <script>
281 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
282 if (mod == nil or mod == 0) {
283 controls.flapsDown(-1);
284 gui.popupTip("Fermeture volets - Raise flaps");
285 } elsif (mod == 1) {
286 controls.gearDown(-1);
287 gui.popupTip("Train rentre - Gear up");
288 } elsif (mod == 2) {
289 view.stepView(-1);
290 } elsif (mod == 3) {
291 #
292 }
293 </script>
294 </binding>
295 <mod-up>
296 <binding>
297 <command>nasal</command>
298 <script>
299 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
300 if (mod == nil or mod == 0) {
301 controls.flapsDown(0);
302 gui.popupTip("Fermeture volets - Raise flaps");
303 } elsif (mod == 1) {
304 controls.gearDown(0);
305 gui.popupTip("Train rentre - Gear up");
306 } elsif (mod == 2) {
307 #
308 } elsif (mod == 3) {
309 #
310 }
311 </script>
312 </binding>
313 </mod-up>
314 </button>
315
316 <button n="2"><!-- front right -->
317 <desc>Reset view; toggle tail-wheel lock; reset trim</desc>
318 <repeatable type="bool">false</repeatable>
319 <binding>
320 <command>nasal</command>
321 <script>
322 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
323 if (mod == nil or mod == 0) {
324 view.resetView();
325 } elsif (mod == 1) {
326 twlock = !getprop("/controls/gear/tailwheel-lock");
327 setprop("/controls/gear/tailwheel-lock", twlock);
328 if (twlock) {
329 gui.popupTip("Tail Wheel LOCKED");
330 } else {
331 gui.popupTip("Tail Wheel UNLOCKED");
332 }
333 } elsif (mod == 2) {
334 setprop("/sim/current-view/view-number", 0);
335 view.resetView();
336 } elsif (mod == 3) {
337 setprop("/controls/flight/elevator-trim", 0);
338 setprop("/controls/flight/aileron-trim", 0);
339 setprop("/controls/flight/rudder-trim", 0);
340 }
341 </script>
342 </binding>
343 </button>
344
345 <button n="3"><!-- top right -->
346 <desc>Flaps/gear down; next view</desc>
347 <repeatable type="bool">false</repeatable>
348 <binding>
349 <command>nasal</command>
350 <script>
351 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
352 if (mod == nil or mod == 0) {
353 controls.flapsDown(1);
354 gui.popupTip("Ouverture volets - Lower flaps");
355 } elsif (mod == 1) {
356 controls.gearDown(1);
357 gui.popupTip("Train sorti - Gear down");
358 } elsif (mod == 2) {
359 view.stepView(1);
360 } elsif (mod == 3) {
361 #
362 }
363 </script>
364 </binding>
365 <mod-up>
366 <binding>
367 <command>nasal</command>
368 <script>
369 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
370 if (mod == nil or mod == 0) {
371 controls.flapsDown(0);
372 gui.popupTip("Ouverture volets - Lower flaps");
373 } elsif (mod == 1) {
374 controls.gearDown(0);
375 gui.popupTip("Train sorti - Gear down");
376 } elsif (mod == 2) {
377 #
378 } elsif (mod == 3) {
379 #
380 }
381 </script>
382 </binding>
383 </mod-up>
384 </button>
385
386 <button n="4"><!-- throttle down/back -->
387 <desc>Brakes left</desc>
388 <repeatable type="bool">true</repeatable>
389 <binding>
390 <command>nasal</command>
391 <script>
392 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
393 if (mod == nil or mod == 0) {
394 interpolate("/controls/gear/brake-left", 1, 0.075);
395 } elsif (mod == 1) {
396 #
397 } elsif (mod == 2) {
398 view.increase();
399 } elsif (mod == 3) {
400 #
401 }
402 </script>
403 </binding>
404 <mod-up>
405 <binding>
406 <command>nasal</command>
407 <script>
408 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
409 if (mod == nil or mod == 0) {
410 interpolate("/controls/gear/brake-left", 0, 0.075);
411 } elsif (mod == 1) {
412 #
413 } elsif (mod == 2) {
414 #
415 } elsif (mod == 3) {
416 #
417 }
418 </script>
419 </binding>
420 </mod-up>
421 </button>
422
423 <button n="5"><!-- throttle middle/back -->
424 <desc>Brakes right</desc>
425 <repeatable type="bool">true</repeatable>
426 <binding>
427 <command>nasal</command>
428 <script>
429 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
430 if (mod == nil or mod == 0) {
431 interpolate("/controls/gear/brake-right", 1, 0.075);
432 } elsif (mod == 1) {
433 #
434 } elsif (mod == 2) {
435 view.decrease();
436 } elsif (mod == 3) {
437 #
438 }
439 </script>
440 </binding>
441 <mod-up>
442 <binding>
443 <command>nasal</command>
444 <script>
445 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
446 if (mod == nil or mod == 0) {
447 interpolate("/controls/gear/brake-right", 0, 0.075);
448 } elsif (mod == 1) {
449 #
450 } elsif (mod == 2) {
451 #
452 } elsif (mod == 3) {
453 #
454 }
455 </script>
456 </binding>
457 </mod-up>
458 </button>
459
460 <button n="6"><!-- throttle upper/back -->
461 <desc>Modifier Bit 0</desc>
462 <repeatable type="bool">false</repeatable>
463 <binding>
464 <command>nasal</command>
465 <script>
466 name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
467 mod = getprop(name);
468 if (mod == nil) {
469 setprop(name, 1);
470 } elsif (mod == 0 or mod == 2) {
471 setprop(name, mod + 1);
472 }
473 </script>
474 </binding>
475 <mod-up>
476 <binding>
477 <command>nasal</command>
478 <script>
479 name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
480 mod = getprop(name);
481 if (mod == nil) {
482 setprop(name, 0);
483 } elsif (mod == 1 or mod == 3) {
484 setprop(name, mod - 1);
485 }
486 </script>
487 </binding>
488 </mod-up>
489 </button>
490
491 <button n="7"><!-- throttle front -->
492 <desc>Modifier Bit 1</desc>
493 <repeatable type="bool">false</repeatable>
494 <binding>
495 <command>nasal</command>
496 <script>
497 name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
498 mod = getprop(name);
499 if (mod == nil) {
500 setprop(name, 2);
501 } elsif (mod == 0 or mod == 1) {
502 setprop(name, mod + 2);
503 }
504 </script>
505 </binding>
506 <mod-up>
507 <binding>
508 <command>nasal</command>
509 <script>
510 name = "/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier";
511 mod = getprop(name);
512 if (mod == nil) {
513 setprop(name, 0);
514 } elsif (mod == 2 or mod == 3) {
515 setprop(name, mod - 2);
516 }
517 </script>
518 </binding>
519 </mod-up>
520 </button>
521
522 <axis n="5"><!-- View Direction Hat -->
523 <desc>View direction; mixture; aileron trim; rudder trim</desc>
524 <number>
525 <unix>4</unix>
526 <mac>5</mac>
527 <windows>6</windows>
528 </number>
529 <low>
530 <repeatable>true</repeatable>
531 <binding>
532 <command>nasal</command>
533 <script>
534 <![CDATA[
535 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
536 if (mod == nil or mod == 0) {
537 v = getprop("/sim/current-view/view-number");
538 if (v == 0 or v == 4) {
539 view.panViewDir(1);
540 } else {
541 view.panViewDir(-1);
542 }
543 } elsif (mod == 1) {
544 controls.adjMixture(-1);
545 if (getprop("/sim/aero") == "harrier") {
546 thv = getprop("/controls/engines/engine[0]/mixture");
547 thv = int(thv * 120 - 20);
548 gui.popupTip("Thrust vector " ~ thv);
549 }
550 } elsif (mod == 2) {
551 controls.aileronTrim(-0.75);
552 } elsif (mod == 3) {
553 controls.rudderTrim(0.75);
554 }
555 ]]>
556 </script>
557 </binding>
558 </low>
559 <high>
560 <repeatable>true</repeatable>
561 <binding>
562 <command>nasal</command>
563 <script>
564 <![CDATA[
565 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
566 if (mod == nil or mod == 0) {
567 v = getprop("/sim/current-view/view-number");
568 if (v == 0 or v == 4) {
569 view.panViewDir(-1);
570 } else {
571 view.panViewDir(1);
572 }
573 } elsif (mod == 1) {
574 controls.adjMixture(1);
575 if (getprop("/sim/aero") == "harrier") {
576 thv = getprop("/controls/engines/engine[0]/mixture");
577 thv = int(thv * 120 - 20);
578 gui.popupTip("Thrust vector " ~ thv);
579 }
580 } elsif (mod == 2) {
581 controls.aileronTrim(0.75);
582 } elsif (mod == 3) {
583 controls.rudderTrim(-0.75);
584 }
585 ]]></script>
586 </binding>
587 </high>
588 </axis>
589
590 <axis>
591 <desc>View direction; prop pitch; elevator trim</desc>
592 <number>
593 <unix>5</unix>
594 <mac>6</mac>
595 <windows>7</windows>
596 </number>
597 <low>
598 <repeatable>true</repeatable>
599 <binding>
600 <command>nasal</command>
601 <script>
602 <![CDATA[
603 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
604 if (mod == nil or mod == 0) {
605 view.panViewPitch(1);
606 } elsif (mod == 1) {
607 controls.adjPropeller(1);
608 } elsif (mod == 2) {
609 controls.elevatorTrim(0.75);
610 } elsif (mod == 3) {
611 #
612 }
613 ]]>
614 </script>
615 </binding>
616 </low>
617 <high>
618 <repeatable>true</repeatable>
619 <binding>
620 <command>nasal</command>
621 <script>
622 <![CDATA[
623 mod = getprop("/input/joysticks/js[0]/thrustmaster-top-gun-afterburner-modifier");
624 if (mod == nil or mod == 0) {
625 view.panViewPitch(-1);
626 } elsif (mod == 1) {
627 controls.adjPropeller(-1);
628 } elsif (mod == 2) {
629 controls.elevatorTrim(-0.75);
630 } elsif (mod == 3) {
631 #
632 }
633 ]]>
634 </script>
635 </binding>
636 </high>
637 </axis>
638
639 </PropertyList>