SHARE
TWEET

Flightgear autopilot joystick bindings

ftilmann Sep 26th, 2014 278 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4. Author: F Tilmann
  5. Copyright: 2014
  6. Licence: GPL3
  7.  
  8. Note that the following does not contain complete joystick bindings for this joystick but just the initialisation code and bindings for buttons pertaining to the control of the autopilot (buttons 4-9 for the sample joystick)
  9. -->
  10.  
  11. <PropertyList>
  12.   <name>Thrustmaster T.16000M</name>
  13. <nasal>
  14.     <!-- set autopilot type:
  15.          1: KAP140     (e.g. c172p)
  16.          2: CENTURYIII (e.g. senecaII) -->
  17.    <script><![CDATA[
  18.      var autopilottype=0;
  19.      var horizontalmode=0;
  20.     if (getprop("sim/aircraft")=="c172p") {
  21.        print("FOUND KAP140 autopilot");
  22.        autopilottype=1;
  23.     } elsif (getprop("autopilot/CENTURYIII/power")>-1) {
  24.        print("Using CENTURYIII autopilot joystick binding");
  25.        autopilottype=2;
  26.     }
  27.     var showhdgbug=func() {if ( autopilottype==1 ) {
  28.                 gui.popupTip(sprintf("Heading Bug:%3d",getprop("autopilot/settings/heading-bug-deg")));
  29.              } elsif ( autopilottype==2 ) {
  30.                gui.popupTip(sprintf("Hdg Bug:%3d",getprop("instrumentation/kcs55/ki525/selected-heading-deg")));
  31.              }}
  32.     var showroll=func() { if ( autopilottype==2 ) {
  33.                gui.popupTip(sprintf("AP Roll:%2d",getprop("autopilot/CENTURYIII/settings/roll-knob-deg")));}}
  34.     var showcourseselect=func() {
  35.                if ( autopilottype==1 ) {
  36.                  gui.popupTip(sprintf("Course select:%2d",getprop("instrumentation/nav/radials/selected-deg")));
  37.                } elsif ( autopilottype==2 ) {
  38.                  gui.popupTip(sprintf("Course select:%2d",getprop("instrumentation/kcs55/ki525/selected-course-deg")));}}
  39.     var showvertical=func()  {if ( autopilottype==1 ) {
  40.            if ( getprop("autopilot/KAP140/locks/pitch-mode") == 1 )  {
  41.               gui.popupTip(sprintf("AP VS
  42. %d",getprop("autopilot/KAP140/settings/target-pressure-rate")*(-58000)));
  43.            }
  44.         } elsif ( autopilottype==2 ) {
  45.            gui.popupTip(sprintf("AP Pitch:%4.1f",getprop("autopilot/CENTURYIII/settings/pitch-wheel-deg")));
  46.         }}
  47.     var showhorizontalmode=func() {
  48.     if ( autopilottype == 1 ) {
  49.       if ( getprop("autopilot/KAP140/locks/roll-arm") == 1 ) {
  50.         gui.popupTip("AP NAV");
  51.       } elsif ( getprop("autopilot/KAP140/locks/roll-arm") == 2 ) {
  52.         gui.popupTip("AP APR");
  53.       } elsif ( getprop("autopilot/KAP140/locks/roll-arm") == 3 ) {
  54.         gui.popupTip("AP REV");
  55.       }
  56.     }
  57.     if (autopilottype == 2) {
  58.        horizontalmode=getprop("autopilot/CENTURYIII/controls/mode");
  59.        if ( horizontalmode==0) {
  60.          gui.popupTip("APmode NAV");
  61.        } elsif ( horizontalmode==1) {
  62.          gui.popupTip("APmode OMNI");
  63.        } elsif ( horizontalmode==2) {
  64.          gui.popupTip("APmode HDG");
  65.        } elsif ( horizontalmode==3) {
  66.          gui.popupTip("APmode LOC");
  67.        } elsif ( horizontalmode==4) {
  68.          gui.popupTip("APmode REV");
  69.        }
  70.     }
  71.    }
  72.   ]]></script>
  73. </nasal>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top