3 # autopilot.pl - Handle autopilot functions
5 # Written by Curtis L. Olson, started January 2004
7 # Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
9 # This code is placed in the public domain by Curtis L. Olson.
10 # There is no warranty, etc. etc. etc.
13 # ----------------------------------------------------------------------------
24 &set_prop( $fgfs, "/autopilot/locks/heading", "" );
25 &set_prop( $fgfs, "/autopilot/locks/altitude", "" );
26 &set_prop( $fgfs, "/autopilot/locks/speed", "" );
35 &set_prop( $fgfs, "/autopilot/locks/heading", "wing-leveler" );
37 &set_prop( $fgfs, "/autopilot/locks/heading", "" );
45 my( $bank_deg ) = shift;
48 &set_prop( $fgfs, "/autopilot/locks/heading", "bank-hold" );
49 &set_prop( $fgfs, "/autopilot/settings/target-bank-deg", $bank_deg );
51 &set_prop( $fgfs, "/autopilot/locks/heading", "" );
59 my( $hdg_deg ) = shift;
62 &set_prop( $fgfs, "/autopilot/locks/heading", "dg-heading-hold" );
63 &set_prop( $fgfs, "/autopilot/settings/heading-bug-deg", $hdg_deg );
65 &set_prop( $fgfs, "/autopilot/locks/heading", "" );
73 my( $pitch_deg ) = shift;
76 &set_prop( $fgfs, "/autopilot/locks/altitude", "pitch-hold" );
77 &set_prop( $fgfs, "/autopilot/settings/target-pitch-deg", $pitch_deg );
79 &set_prop( $fgfs, "/autopilot/locks/altitude", "" );
87 my( $pitch_deg ) = shift;
90 &set_prop( $fgfs, "/autopilot/locks/altitude", "pitch-hold-yoke" );
91 &set_prop( $fgfs, "/autopilot/settings/target-pitch-deg", $pitch_deg );
93 &set_prop( $fgfs, "/autopilot/locks/altitude", "" );
100 my( $state ) = shift;
101 my( $alt_ft ) = shift;
104 &set_prop( $fgfs, "/autopilot/locks/altitude", "altitude-hold" );
105 &set_prop( $fgfs, "/autopilot/settings/target-altitude-ft", $alt_ft );
107 &set_prop( $fgfs, "/autopilot/locks/altitude", "" );
112 sub auto_speed_throttle {
114 my( $state ) = shift;
118 &set_prop( $fgfs, "/autopilot/locks/speed", "speed-with-throttle" );
119 &set_prop( $fgfs, "/autopilot/settings/target-speed-kt", $kts );
121 &set_prop( $fgfs, "/autopilot/locks/speed", "" );
126 sub auto_speed_pitch_trim {
128 my( $state ) = shift;
132 &set_prop( $fgfs, "/autopilot/locks/speed", "speed-with-pitch-trim" );
133 &set_prop( $fgfs, "/autopilot/settings/target-speed-kt", $kts );
135 &set_prop( $fgfs, "/autopilot/locks/speed", "" );
139 sub auto_speed_pitch_yoke {
141 my( $state ) = shift;
145 &set_prop( $fgfs, "/autopilot/locks/speed", "speed-with-pitch-yoke" );
146 &set_prop( $fgfs, "/autopilot/settings/target-speed-kt", $kts );
148 &set_prop( $fgfs, "/autopilot/locks/speed", "" );