Debian Codegraph @

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

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