1 // controls.cxx -- defines a standard interface to all flight sim controls
3 // Written by Curtis Olson, started May 1997.
5 // Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <Main/fg_props.hxx>
28 #include <simgear/sg_inlines.h>
29 #include "controls.hxx"
31 ////////////////////////////////////////////////////////////////////////
32 // Implementation of FGControls.
33 ////////////////////////////////////////////////////////////////////////
36 FGControls::FGControls() :
51 throttle_idle( true ),
55 copilot_brake_left( 0.0 ),
56 copilot_brake_right( 0.0 ),
59 nose_wheel_steering( true ),
64 catapult_launch_cmd( false ),
65 tailwheel_lock( true ),
70 battery_switch( true ),
71 external_power( false ),
72 APU_generator( false ),
83 instruments_norm( 0.0 ),
88 vertical_adjust( 0.0 ),
89 fore_aft_adjust( 0.0 ),
91 APU_fire_switch( false ),
92 autothrottle_arm( false ),
93 autothrottle_engage( false ),
94 heading_select( 0.0 ),
95 altitude_select( 50000.0 ),
96 bank_angle_select( 30.0 ),
97 vertical_speed_select( 0.0 ),
106 void FGControls::reset_all()
109 set_aileron_trim( 0.0 );
111 set_elevator_trim( 0.0 );
113 set_rudder_trim( 0.0 );
116 set_speedbrake( 0.0 );
117 set_wing_sweep( 0.0 );
120 set_throttle( ALL_ENGINES, 0.0 );
121 set_starter( ALL_ENGINES, false );
122 set_magnetos( ALL_ENGINES, 0 );
123 set_fuel_pump( ALL_ENGINES, false );
124 set_fire_switch( ALL_ENGINES, false );
125 set_fire_bottle_discharge( ALL_ENGINES, false );
126 set_cutoff( ALL_ENGINES, true );
127 set_nitrous_injection( ALL_ENGINES, false );
128 set_cowl_flaps_norm( ALL_ENGINES, 1.0 );
129 set_feather( ALL_ENGINES, false );
130 set_ignition( ALL_ENGINES, false );
131 set_augmentation( ALL_ENGINES, false );
132 set_reverser( ALL_ENGINES, false );
133 set_water_injection( ALL_ENGINES, false );
134 set_condition( ALL_ENGINES, 1.0 );
135 throttle_idle = true;
136 set_fuel_selector( ALL_TANKS, true );
139 nose_wheel_steering = true;
143 catapult_launch_cmd = false;
144 tailwheel_lock = true;
145 set_carb_heat( ALL_ENGINES, false );
146 set_inlet_heat( ALL_ENGINES, false );
151 set_engine_pump( ALL_HYD_SYSTEMS, true );
152 set_electric_pump( ALL_HYD_SYSTEMS, true );
153 landing_lights = false;
154 turn_off_lights = false;
156 set_ejection_seat( ALL_EJECTION_SEATS, false );
157 set_eseat_status( ALL_EJECTION_SEATS, SEAT_SAFED );
158 set_cmd_selector_valve( CMD_SEL_NORM );
159 APU_fire_switch = false;
160 autothrottle_arm = false;
161 autothrottle_engage = false;
162 set_autopilot_engage( ALL_AUTOPILOTS, false );
167 FGControls::~FGControls() {
174 throttle_idle = true;
175 for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
176 throttle[engine] = 0.0;
177 mixture[engine] = 1.0;
178 fuel_pump[engine] = false;
179 prop_advance[engine] = 1.0;
180 magnetos[engine] = 0;
181 feed_tank[engine] = -1; // set to -1 to turn off all tanks 0 feeds all engines from center body tank
182 starter[engine] = false;
183 feather[engine] = false;
184 ignition[engine] = false;
185 fire_switch[engine] = false;
186 fire_bottle_discharge[engine] = false;
187 cutoff[engine] = true;
188 augmentation[engine] = false;
189 reverser[engine] = false;
190 water_injection[engine] = false;
191 nitrous_injection[engine] = false;
192 cowl_flaps_norm[engine] = 0.0;
193 condition[engine] = 1.0;
194 carb_heat[engine] = false;
195 inlet_heat[engine] = false;
196 generator_breaker[engine] = false;
197 bus_tie[engine] = false;
198 engine_bleed[engine] = false;
201 for ( int tank = 0; tank < MAX_TANKS; tank++ ) {
202 fuel_selector[tank] = false;
207 for( int pump = 0; pump < MAX_TANKS * MAX_BOOSTPUMPS; pump++ ) {
208 boost_pump[pump] = false;
211 brake_left = brake_right
212 = copilot_brake_left = copilot_brake_right
213 = brake_parking = 0.0;
214 for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
215 alternate_extension[wheel] = false;
218 auto_coordination = fgGetNode("/sim/auto-coordination", true);
221 static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const char * root, int index = 0 )
223 tiedProperties.setRoot( fgGetNode( root, index, true ) );
232 _SetRoot( _tiedProperties, "/controls/flight" );
234 _tiedProperties.Tie( "aileron", this, &FGControls::get_aileron, &FGControls::set_aileron )
235 ->setAttribute( SGPropertyNode::ARCHIVE, true );
237 _tiedProperties.Tie( "aileron-trim", this, &FGControls::get_aileron_trim, &FGControls::set_aileron_trim )
238 ->setAttribute( SGPropertyNode::ARCHIVE, true );
240 _tiedProperties.Tie( "elevator", this, &FGControls::get_elevator, &FGControls::set_elevator )
241 ->setAttribute( SGPropertyNode::ARCHIVE, true );
243 _tiedProperties.Tie( "elevator-trim", this, &FGControls::get_elevator_trim, &FGControls::set_elevator_trim )
244 ->setAttribute( SGPropertyNode::ARCHIVE, true );
246 _tiedProperties.Tie( "rudder", this, &FGControls::get_rudder, &FGControls::set_rudder )
247 ->setAttribute( SGPropertyNode::ARCHIVE, true );
249 _tiedProperties.Tie( "rudder-trim", this, &FGControls::get_rudder_trim, &FGControls::set_rudder_trim )
250 ->setAttribute( SGPropertyNode::ARCHIVE, true );
252 _tiedProperties.Tie( "flaps", this, &FGControls::get_flaps, &FGControls::set_flaps )
253 ->setAttribute( SGPropertyNode::ARCHIVE, true );
255 _tiedProperties.Tie( "slats", this, &FGControls::get_slats, &FGControls::set_slats )
256 ->setAttribute( SGPropertyNode::ARCHIVE, true );
258 _tiedProperties.Tie( "BLC", this, &FGControls::get_BLC, &FGControls::set_BLC )
259 ->setAttribute( SGPropertyNode::ARCHIVE, true );
261 _tiedProperties.Tie( "spoilers", this, &FGControls::get_spoilers, &FGControls::set_spoilers )
262 ->setAttribute( SGPropertyNode::ARCHIVE, true );
264 _tiedProperties.Tie( "speedbrake", this, &FGControls::get_speedbrake, &FGControls::set_speedbrake )
265 ->setAttribute( SGPropertyNode::ARCHIVE, true );
267 _tiedProperties.Tie( "wing-sweep", this, &FGControls::get_wing_sweep, &FGControls::set_wing_sweep )
268 ->setAttribute( SGPropertyNode::ARCHIVE, true );
270 _tiedProperties.Tie( "wing-fold", this, &FGControls::get_wing_fold, &FGControls::set_wing_fold )
271 ->setAttribute( SGPropertyNode::ARCHIVE, true );
273 _tiedProperties.Tie( "drag-chute", this, &FGControls::get_drag_chute, &FGControls::set_drag_chute )
274 ->setAttribute( SGPropertyNode::ARCHIVE, true );
277 _tiedProperties.setRoot( fgGetNode("/controls/engines", true ) );
279 _tiedProperties.Tie( "throttle_idle", this, &FGControls::get_throttle_idle, &FGControls::set_throttle_idle )
280 ->setAttribute( SGPropertyNode::ARCHIVE, true );
282 for (index = 0; index < MAX_ENGINES; index++) {
283 _SetRoot(_tiedProperties, "/controls/engines/engine", index );
285 _tiedProperties.Tie( "throttle", this, index, &FGControls::get_throttle, &FGControls::set_throttle )
286 ->setAttribute( SGPropertyNode::ARCHIVE, true );
288 _tiedProperties.Tie( "starter", this, index, &FGControls::get_starter, &FGControls::set_starter )
289 ->setAttribute( SGPropertyNode::ARCHIVE, true );
291 _tiedProperties.Tie( "fuel-pump", this, index, &FGControls::get_fuel_pump, &FGControls::set_fuel_pump )
292 ->setAttribute( SGPropertyNode::ARCHIVE, true );
294 _tiedProperties.Tie( "fire-switch", this, index, &FGControls::get_fire_switch, &FGControls::set_fire_switch )
295 ->setAttribute( SGPropertyNode::ARCHIVE, true );
297 _tiedProperties.Tie( "fire-bottle-discharge", this, index, &FGControls::get_fire_bottle_discharge, &FGControls::set_fire_bottle_discharge )
298 ->setAttribute( SGPropertyNode::ARCHIVE, true );
300 _tiedProperties.Tie( "cutoff", this, index, &FGControls::get_cutoff, &FGControls::set_cutoff )
301 ->setAttribute( SGPropertyNode::ARCHIVE, true );
303 _tiedProperties.Tie( "mixture", this, index, &FGControls::get_mixture, &FGControls::set_mixture )
304 ->setAttribute( SGPropertyNode::ARCHIVE, true );
306 _tiedProperties.Tie( "propeller-pitch", this, index, &FGControls::get_prop_advance, &FGControls::set_prop_advance )
307 ->setAttribute( SGPropertyNode::ARCHIVE, true );
309 _tiedProperties.Tie( "magnetos", this, index, &FGControls::get_magnetos, &FGControls::set_magnetos )
310 ->setAttribute( SGPropertyNode::ARCHIVE, true );
312 _tiedProperties.Tie( "feed_tank", this, index, &FGControls::get_feed_tank, &FGControls::set_feed_tank )
313 ->setAttribute( SGPropertyNode::ARCHIVE, true );
315 _tiedProperties.Tie( "WEP", this, index, &FGControls::get_nitrous_injection, &FGControls::set_nitrous_injection )
316 ->setAttribute( SGPropertyNode::ARCHIVE, true );
318 _tiedProperties.Tie( "cowl-flaps-norm", this, index, &FGControls::get_cowl_flaps_norm, &FGControls::set_cowl_flaps_norm )
319 ->setAttribute( SGPropertyNode::ARCHIVE, true );
321 _tiedProperties.Tie( "propeller-feather", this, index, &FGControls::get_feather, &FGControls::set_feather )
322 ->setAttribute( SGPropertyNode::ARCHIVE, true );
324 _tiedProperties.Tie( "ignition", this, index, &FGControls::get_ignition, &FGControls::set_ignition )
325 ->setAttribute( SGPropertyNode::ARCHIVE, true );
327 _tiedProperties.Tie( "augmentation", this, index, &FGControls::get_augmentation, &FGControls::set_augmentation )
328 ->setAttribute( SGPropertyNode::ARCHIVE, true );
330 _tiedProperties.Tie( "reverser", this, index, &FGControls::get_reverser, &FGControls::set_reverser )
331 ->setAttribute( SGPropertyNode::ARCHIVE, true );
333 _tiedProperties.Tie( "water-injection", this, index, &FGControls::get_water_injection, &FGControls::set_water_injection )
334 ->setAttribute( SGPropertyNode::ARCHIVE, true );
336 _tiedProperties.Tie( "condition", this, index, &FGControls::get_condition, &FGControls::set_condition )
337 ->setAttribute( SGPropertyNode::ARCHIVE, true );
341 _SetRoot( _tiedProperties, "/controls/fuel" );
343 _tiedProperties.Tie( "dump-valve", this, &FGControls::get_dump_valve, &FGControls::set_dump_valve)
344 ->setAttribute( SGPropertyNode::ARCHIVE, true );
346 for (index = 0; index < MAX_TANKS; index++) {
347 _SetRoot( _tiedProperties, "/controls/fuel/tank", index );
349 _tiedProperties.Tie( "fuel_selector", this, index, &FGControls::get_fuel_selector, &FGControls::set_fuel_selector)
350 ->setAttribute( SGPropertyNode::ARCHIVE, true );
352 _tiedProperties.Tie( "to_engine", this, index, &FGControls::get_to_engine, &FGControls::set_to_engine)
353 ->setAttribute( SGPropertyNode::ARCHIVE, true );
355 _tiedProperties.Tie( "to_tank", this, index, &FGControls::get_to_tank, &FGControls::set_to_tank)
356 ->setAttribute( SGPropertyNode::ARCHIVE, true );
358 for (i = 0; i < MAX_BOOSTPUMPS; i++) {
359 _tiedProperties.Tie( "boost-pump", i,
360 this, index * 2 + i, &FGControls::get_boost_pump, &FGControls::set_boost_pump)
361 ->setAttribute( SGPropertyNode::ARCHIVE, true );
366 _SetRoot( _tiedProperties, "/controls/gear" );
368 _tiedProperties.Tie( "brake-left", this, &FGControls::get_brake_left, &FGControls::set_brake_left)
369 ->setAttribute( SGPropertyNode::ARCHIVE, true );
371 _tiedProperties.Tie( "brake-right", this, &FGControls::get_brake_right, &FGControls::set_brake_right)
372 ->setAttribute( SGPropertyNode::ARCHIVE, true );
374 _tiedProperties.Tie( "copilot-brake-left", this, &FGControls::get_copilot_brake_left, &FGControls::set_copilot_brake_left)
375 ->setAttribute( SGPropertyNode::ARCHIVE, true );
377 _tiedProperties.Tie( "copilot-brake-right", this, &FGControls::get_copilot_brake_right, &FGControls::set_copilot_brake_right)
378 ->setAttribute( SGPropertyNode::ARCHIVE, true );
380 _tiedProperties.Tie( "brake-parking", this, &FGControls::get_brake_parking, &FGControls::set_brake_parking)
381 ->setAttribute( SGPropertyNode::ARCHIVE, true );
383 _tiedProperties.Tie( "steering", this, &FGControls::get_steering, &FGControls::set_steering)
384 ->setAttribute( SGPropertyNode::ARCHIVE, true );
386 _tiedProperties.Tie( "nose-wheel-steering", this, &FGControls::get_nose_wheel_steering, &FGControls::set_nose_wheel_steering)
387 ->setAttribute( SGPropertyNode::ARCHIVE, true );
389 _tiedProperties.Tie( "gear-down", this, &FGControls::get_gear_down, &FGControls::set_gear_down)
390 ->setAttribute( SGPropertyNode::ARCHIVE, true );
392 _tiedProperties.Tie( "antiskid", this, &FGControls::get_antiskid, &FGControls::set_antiskid)
393 ->setAttribute( SGPropertyNode::ARCHIVE, true );
395 _tiedProperties.Tie( "tailhook", this, &FGControls::get_tailhook, &FGControls::set_tailhook)
396 ->setAttribute( SGPropertyNode::ARCHIVE, true );
398 _tiedProperties.Tie( "launchbar", this, &FGControls::get_launchbar, &FGControls::set_launchbar)
399 ->setAttribute( SGPropertyNode::ARCHIVE, true );
401 _tiedProperties.Tie( "catapult-launch-cmd", this, &FGControls::get_catapult_launch_cmd, &FGControls::set_catapult_launch_cmd)
402 ->setAttribute( SGPropertyNode::ARCHIVE, true );
404 _tiedProperties.Tie( "tailwheel-lock", this, &FGControls::get_tailwheel_lock, &FGControls::set_tailwheel_lock)
405 ->setAttribute( SGPropertyNode::ARCHIVE, true );
407 for (index = 0; index < MAX_WHEELS; index++) {
408 _SetRoot( _tiedProperties, "/controls/gear/wheel", index );
409 _tiedProperties.Tie( "alternate-extension", this, index, &FGControls::get_alternate_extension, &FGControls::set_alternate_extension)
410 ->setAttribute( SGPropertyNode::ARCHIVE, true );
414 _SetRoot( _tiedProperties, "/controls/anti-ice" );
416 _tiedProperties.Tie( "wing-heat", this, &FGControls::get_wing_heat, &FGControls::set_wing_heat)
417 ->setAttribute( SGPropertyNode::ARCHIVE, true );
419 _tiedProperties.Tie( "pitot-heat", this, &FGControls::get_pitot_heat, &FGControls::set_pitot_heat)
420 ->setAttribute( SGPropertyNode::ARCHIVE, true );
422 _tiedProperties.Tie( "wiper", this, &FGControls::get_wiper, &FGControls::set_wiper)
423 ->setAttribute( SGPropertyNode::ARCHIVE, true );
425 _tiedProperties.Tie( "window-heat", this, &FGControls::get_window_heat, &FGControls::set_window_heat)
426 ->setAttribute( SGPropertyNode::ARCHIVE, true );
428 for (index = 0; index < MAX_ENGINES; index++) {
429 _SetRoot( _tiedProperties, "/controls/anti-ice/engine", index );
431 _tiedProperties.Tie( "carb-heat", this, index, &FGControls::get_carb_heat, &FGControls::set_carb_heat)
432 ->setAttribute( SGPropertyNode::ARCHIVE, true );
434 _tiedProperties.Tie( "inlet-heat", this, index, &FGControls::get_inlet_heat, &FGControls::set_inlet_heat)
435 ->setAttribute( SGPropertyNode::ARCHIVE, true );
439 for (index = 0; index < MAX_HYD_SYSTEMS; index++) {
440 _SetRoot( _tiedProperties, "/controls/hydraulic/system", index );
442 _tiedProperties.Tie( "engine-pump", this, index, &FGControls::get_engine_pump, &FGControls::set_engine_pump)
443 ->setAttribute( SGPropertyNode::ARCHIVE, true );
445 _tiedProperties.Tie( "electric-pump", this, index, &FGControls::get_electric_pump, &FGControls::set_electric_pump)
446 ->setAttribute( SGPropertyNode::ARCHIVE, true );
450 _SetRoot( _tiedProperties, "/controls/electric" );
452 _tiedProperties.Tie( "battery-switch", this, &FGControls::get_battery_switch, &FGControls::set_battery_switch)
453 ->setAttribute( SGPropertyNode::ARCHIVE, true );
455 _tiedProperties.Tie( "external-power", this, &FGControls::get_external_power, &FGControls::set_external_power)
456 ->setAttribute( SGPropertyNode::ARCHIVE, true );
458 _tiedProperties.Tie( "APU-generator", this, &FGControls::get_APU_generator, &FGControls::set_APU_generator)
459 ->setAttribute( SGPropertyNode::ARCHIVE, true );
461 for (index = 0; index < MAX_ENGINES; index++) {
462 _SetRoot( _tiedProperties, "/controls/electric/engine", index );
464 _tiedProperties.Tie( "generator", this, index, &FGControls::get_generator_breaker, &FGControls::set_generator_breaker)
465 ->setAttribute( SGPropertyNode::ARCHIVE, true );
467 _tiedProperties.Tie( "bus-tie", this, index, &FGControls::get_bus_tie, &FGControls::set_bus_tie)
468 ->setAttribute( SGPropertyNode::ARCHIVE, true );
472 _SetRoot( _tiedProperties, "/controls/pneumatic" );
474 _tiedProperties.Tie( "APU-bleed", this, &FGControls::get_APU_bleed, &FGControls::set_APU_bleed)
475 ->setAttribute( SGPropertyNode::ARCHIVE, true );
477 for (index = 0; index < MAX_ENGINES; index++) {
478 _SetRoot( _tiedProperties, "/controls/pneumatic/engine", index );
480 _tiedProperties.Tie( "bleed", this, index, &FGControls::get_engine_bleed, &FGControls::set_engine_bleed)
481 ->setAttribute( SGPropertyNode::ARCHIVE, true );
485 _SetRoot( _tiedProperties, "/controls/pressurization" );
487 _tiedProperties.Tie( "mode", this, &FGControls::get_mode, &FGControls::set_mode)
488 ->setAttribute( SGPropertyNode::ARCHIVE, true );
490 _tiedProperties.Tie( "dump", this, &FGControls::get_dump, &FGControls::set_dump)
491 ->setAttribute( SGPropertyNode::ARCHIVE, true );
493 _tiedProperties.Tie( "outflow-valve", this, &FGControls::get_outflow_valve, &FGControls::set_outflow_valve)
494 ->setAttribute( SGPropertyNode::ARCHIVE, true );
496 for (index = 0; index < MAX_PACKS; index++) {
497 _SetRoot( _tiedProperties, "/controls/pressurization/pack", index );
499 _tiedProperties.Tie( "pack-on", this, index, &FGControls::get_pack_on, &FGControls::set_pack_on)
500 ->setAttribute( SGPropertyNode::ARCHIVE, true );
504 _SetRoot( _tiedProperties, "/controls/lighting" );
506 _tiedProperties.Tie( "landing-lights", this, &FGControls::get_landing_lights, &FGControls::set_landing_lights)
507 ->setAttribute( SGPropertyNode::ARCHIVE, true );
509 _tiedProperties.Tie( "turn-off-lights", this, &FGControls::get_turn_off_lights, &FGControls::set_turn_off_lights)
510 ->setAttribute( SGPropertyNode::ARCHIVE, true );
512 _tiedProperties.Tie( "taxi-light", this, &FGControls::get_taxi_light, &FGControls::set_taxi_light)
513 ->setAttribute( SGPropertyNode::ARCHIVE, true );
515 _tiedProperties.Tie( "logo-lights", this, &FGControls::get_logo_lights, &FGControls::set_logo_lights)
516 ->setAttribute( SGPropertyNode::ARCHIVE, true );
518 _tiedProperties.Tie( "nav-lights", this, &FGControls::get_nav_lights, &FGControls::set_nav_lights)
519 ->setAttribute( SGPropertyNode::ARCHIVE, true );
521 _tiedProperties.Tie( "beacon", this, &FGControls::get_beacon, &FGControls::set_beacon)
522 ->setAttribute( SGPropertyNode::ARCHIVE, true );
524 _tiedProperties.Tie( "strobe", this, &FGControls::get_strobe, &FGControls::set_strobe)
525 ->setAttribute( SGPropertyNode::ARCHIVE, true );
527 _tiedProperties.Tie( "panel-norm", this, &FGControls::get_panel_norm, &FGControls::set_panel_norm)
528 ->setAttribute( SGPropertyNode::ARCHIVE, true );
530 _tiedProperties.Tie( "instruments-norm", this, &FGControls::get_instruments_norm, &FGControls::set_instruments_norm)
531 ->setAttribute( SGPropertyNode::ARCHIVE, true );
533 _tiedProperties.Tie( "dome-norm", this, &FGControls::get_dome_norm, &FGControls::set_dome_norm)
534 ->setAttribute( SGPropertyNode::ARCHIVE, true );
537 _SetRoot( _tiedProperties, "/controls/armament" );
539 _tiedProperties.Tie( "master-arm", this, &FGControls::get_master_arm, &FGControls::set_master_arm)
540 ->setAttribute( SGPropertyNode::ARCHIVE, true );
542 _tiedProperties.Tie( "station-select", this, &FGControls::get_station_select, &FGControls::set_station_select)
543 ->setAttribute( SGPropertyNode::ARCHIVE, true );
545 _tiedProperties.Tie( "release-all", this, &FGControls::get_release_ALL, &FGControls::set_release_ALL)
546 ->setAttribute( SGPropertyNode::ARCHIVE, true );
548 for (index = 0; index < MAX_STATIONS; index++) {
549 _SetRoot( _tiedProperties, "/controls/armament/station", index );
551 _tiedProperties.Tie( "stick-size", this, index, &FGControls::get_stick_size, &FGControls::set_stick_size)
552 ->setAttribute( SGPropertyNode::ARCHIVE, true );
554 _tiedProperties.Tie( "release-stick", this, index, &FGControls::get_release_stick, &FGControls::set_release_stick)
555 ->setAttribute( SGPropertyNode::ARCHIVE, true );
557 _tiedProperties.Tie( "release-all", this, index, &FGControls::get_release_all, &FGControls::set_release_all)
558 ->setAttribute( SGPropertyNode::ARCHIVE, true );
560 _tiedProperties.Tie( "jettison-all", this, index, &FGControls::get_jettison_all, &FGControls::set_jettison_all)
561 ->setAttribute( SGPropertyNode::ARCHIVE, true );
565 _SetRoot( _tiedProperties, "/controls/seat" );
567 _tiedProperties.Tie( "vertical-adjust", this, &FGControls::get_vertical_adjust, &FGControls::set_vertical_adjust)
568 ->setAttribute( SGPropertyNode::ARCHIVE, true );
570 _tiedProperties.Tie( "fore-aft-adjust", this, &FGControls::get_fore_aft_adjust, &FGControls::set_fore_aft_adjust)
571 ->setAttribute( SGPropertyNode::ARCHIVE, true );
573 _tiedProperties.Tie( "cmd_selector_valve", this, &FGControls::get_cmd_selector_valve, &FGControls::set_cmd_selector_valve)
574 ->setAttribute( SGPropertyNode::ARCHIVE, true );
576 for (index = 0; index < MAX_EJECTION_SEATS; index++) {
577 _SetRoot( _tiedProperties, "/controls/seat/eject", index );
579 _tiedProperties.Tie( "initiate", this, index, &FGControls::get_ejection_seat, &FGControls::set_ejection_seat)
580 ->setAttribute( SGPropertyNode::ARCHIVE, true );
582 _tiedProperties.Tie( "status", this, index, &FGControls::get_eseat_status, &FGControls::set_eseat_status)
583 ->setAttribute( SGPropertyNode::ARCHIVE, true );
587 _SetRoot( _tiedProperties, "/controls/APU" );
589 _tiedProperties.Tie( "off-start-run", this, &FGControls::get_off_start_run, &FGControls::set_off_start_run)
590 ->setAttribute( SGPropertyNode::ARCHIVE, true );
592 _tiedProperties.Tie( "fire-switch", this, &FGControls::get_APU_fire_switch, &FGControls::set_APU_fire_switch)
593 ->setAttribute( SGPropertyNode::ARCHIVE, true );
596 for (index = 0; index < MAX_AUTOPILOTS; index++) {
598 _SetRoot( _tiedProperties, "/controls/autoflight/autopilot", index );
600 _tiedProperties.Tie( "engage", this, index, &FGControls::get_autopilot_engage, &FGControls::set_autopilot_engage)
601 ->setAttribute( SGPropertyNode::ARCHIVE, true );
604 _SetRoot( _tiedProperties, "/controls/autoflight/" );
606 _tiedProperties.Tie( "autothrottle-arm", this, &FGControls::get_autothrottle_arm, &FGControls::set_autothrottle_arm)
607 ->setAttribute( SGPropertyNode::ARCHIVE, true );
609 _tiedProperties.Tie( "autothrottle-engage", this, &FGControls::get_autothrottle_engage, &FGControls::set_autothrottle_engage)
610 ->setAttribute( SGPropertyNode::ARCHIVE, true );
612 _tiedProperties.Tie( "heading-select", this, &FGControls::get_heading_select, &FGControls::set_heading_select)
613 ->setAttribute( SGPropertyNode::ARCHIVE, true );
615 _tiedProperties.Tie( "altitude-select", this, &FGControls::get_altitude_select, &FGControls::set_altitude_select)
616 ->setAttribute( SGPropertyNode::ARCHIVE, true );
618 _tiedProperties.Tie( "bank-angle-select", this, &FGControls::get_bank_angle_select, &FGControls::set_bank_angle_select)
619 ->setAttribute( SGPropertyNode::ARCHIVE, true );
621 _tiedProperties.Tie( "vertical-speed-select", this, &FGControls::get_vertical_speed_select, &FGControls::set_vertical_speed_select)
622 ->setAttribute( SGPropertyNode::ARCHIVE, true );
624 _tiedProperties.Tie( "speed-select", this, &FGControls::get_speed_select, &FGControls::set_speed_select)
625 ->setAttribute( SGPropertyNode::ARCHIVE, true );
627 _tiedProperties.Tie( "mach-select", this, &FGControls::get_mach_select, &FGControls::set_mach_select)
628 ->setAttribute( SGPropertyNode::ARCHIVE, true );
630 _tiedProperties.Tie( "vertical-mode", this, &FGControls::get_vertical_mode, &FGControls::set_vertical_mode)
631 ->setAttribute( SGPropertyNode::ARCHIVE, true );
633 _tiedProperties.Tie( "lateral-mode", this, &FGControls::get_lateral_mode, &FGControls::set_lateral_mode)
634 ->setAttribute( SGPropertyNode::ARCHIVE, true );
637 void FGControls::unbind ()
639 _tiedProperties.Untie();
644 FGControls::update (double dt)
650 ////////////////////////////////////////////////////////////////////////
651 // Setters and adjusters.
652 ////////////////////////////////////////////////////////////////////////
655 FGControls::set_aileron (double pos)
658 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
660 // check for autocoordination
661 if ( auto_coordination->getBoolValue() ) {
662 set_rudder( aileron / 2.0 );
667 FGControls::move_aileron (double amt)
670 SG_CLAMP_RANGE<double>( aileron, -1.0, 1.0 );
672 // check for autocoordination
673 if ( auto_coordination->getBoolValue() ) {
674 set_rudder( aileron / 2.0 );
679 FGControls::set_aileron_trim( double pos )
682 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
686 FGControls::move_aileron_trim( double amt )
689 SG_CLAMP_RANGE<double>( aileron_trim, -1.0, 1.0 );
693 FGControls::set_elevator( double pos )
696 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
700 FGControls::move_elevator( double amt )
703 SG_CLAMP_RANGE<double>( elevator, -1.0, 1.0 );
707 FGControls::set_elevator_trim( double pos )
710 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
714 FGControls::move_elevator_trim( double amt )
716 elevator_trim += amt;
717 SG_CLAMP_RANGE<double>( elevator_trim, -1.0, 1.0 );
721 FGControls::set_rudder( double pos )
724 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
728 FGControls::move_rudder( double amt )
731 SG_CLAMP_RANGE<double>( rudder, -1.0, 1.0 );
735 FGControls::set_rudder_trim( double pos )
738 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
742 FGControls::move_rudder_trim( double amt )
745 SG_CLAMP_RANGE<double>( rudder_trim, -1.0, 1.0 );
749 FGControls::set_flaps( double pos )
752 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
756 FGControls::move_flaps( double amt )
759 SG_CLAMP_RANGE<double>( flaps, 0.0, 1.0 );
763 FGControls::set_slats( double pos )
766 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
770 FGControls::move_slats( double amt )
773 SG_CLAMP_RANGE<double>( slats, 0.0, 1.0 );
777 FGControls::set_BLC( bool val )
783 FGControls::set_spoilers( double pos )
786 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
790 FGControls::move_spoilers( double amt )
793 SG_CLAMP_RANGE<double>( spoilers, 0.0, 1.0 );
797 FGControls::set_speedbrake( double pos )
800 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
804 FGControls::move_speedbrake( double amt )
807 SG_CLAMP_RANGE<double>( speedbrake, 0.0, 1.0 );
811 FGControls::set_wing_sweep( double pos )
814 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
818 FGControls::move_wing_sweep( double amt )
821 SG_CLAMP_RANGE<double>( wing_sweep, 0.0, 1.0 );
825 FGControls::set_wing_fold( bool val )
831 FGControls::set_drag_chute( bool val )
837 FGControls::set_throttle_idle( bool val )
843 FGControls::set_throttle( int engine, double pos )
845 if ( engine == ALL_ENGINES ) {
846 for ( int i = 0; i < MAX_ENGINES; i++ ) {
848 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
851 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
852 throttle[engine] = pos;
853 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
859 FGControls::move_throttle( int engine, double amt )
861 if ( engine == ALL_ENGINES ) {
862 for ( int i = 0; i < MAX_ENGINES; i++ ) {
864 SG_CLAMP_RANGE<double>( throttle[i], 0.0, 1.0 );
867 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
868 throttle[engine] += amt;
869 SG_CLAMP_RANGE<double>( throttle[engine], 0.0, 1.0 );
875 FGControls::set_starter( int engine, bool flag )
877 if ( engine == ALL_ENGINES ) {
878 for ( int i = 0; i < MAX_ENGINES; i++ ) {
882 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
883 starter[engine] = flag;
889 FGControls::set_fuel_pump( int engine, bool val )
891 if ( engine == ALL_ENGINES ) {
892 for ( int i = 0; i < MAX_ENGINES; i++ ) {
896 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
897 fuel_pump[engine] = val;
903 FGControls::set_fire_switch( int engine, bool val )
905 if ( engine == ALL_ENGINES ) {
906 for ( int i = 0; i < MAX_ENGINES; i++ ) {
907 fire_switch[i] = val;
910 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
911 fire_switch[engine] = val;
917 FGControls::set_fire_bottle_discharge( int engine, bool val )
919 if ( engine == ALL_ENGINES ) {
920 for ( int i = 0; i < MAX_ENGINES; i++ ) {
921 fire_bottle_discharge[i] = val;
924 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
925 fire_bottle_discharge[engine] = val;
931 FGControls::set_cutoff( int engine, bool val )
933 if ( engine == ALL_ENGINES ) {
934 for ( int i = 0; i < MAX_ENGINES; i++ ) {
938 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
939 cutoff[engine] = val;
945 FGControls::set_feed_tank( int engine, int tank )
947 if ( engine == ALL_ENGINES ) {
948 for ( int i = 0; i < MAX_ENGINES; i++ ) {
950 SG_CLAMP_RANGE<int>( feed_tank[i], -1, 4 );
953 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
954 feed_tank[engine] = tank;
955 SG_CLAMP_RANGE<int>( feed_tank[engine], -1, 4 );
958 // feed_tank[engine] = engine;
963 FGControls::set_mixture( int engine, double pos )
965 if ( engine == ALL_ENGINES ) {
966 for ( int i = 0; i < MAX_ENGINES; i++ ) {
968 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
971 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
972 mixture[engine] = pos;
973 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
979 FGControls::move_mixture( int engine, double amt )
981 if ( engine == ALL_ENGINES ) {
982 for ( int i = 0; i < MAX_ENGINES; i++ ) {
984 SG_CLAMP_RANGE<double>( mixture[i], 0.0, 1.0 );
987 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
988 mixture[engine] += amt;
989 SG_CLAMP_RANGE<double>( mixture[engine], 0.0, 1.0 );
995 FGControls::set_prop_advance( int engine, double pos )
997 if ( engine == ALL_ENGINES ) {
998 for ( int i = 0; i < MAX_ENGINES; i++ ) {
999 prop_advance[i] = pos;
1000 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1003 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1004 prop_advance[engine] = pos;
1005 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1011 FGControls::move_prop_advance( int engine, double amt )
1013 if ( engine == ALL_ENGINES ) {
1014 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1015 prop_advance[i] += amt;
1016 SG_CLAMP_RANGE<double>( prop_advance[i], 0.0, 1.0 );
1019 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1020 prop_advance[engine] += amt;
1021 SG_CLAMP_RANGE<double>( prop_advance[engine], 0.0, 1.0 );
1027 FGControls::set_magnetos( int engine, int pos )
1029 if ( engine == ALL_ENGINES ) {
1030 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1032 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1035 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1036 magnetos[engine] = pos;
1037 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1043 FGControls::move_magnetos( int engine, int amt )
1045 if ( engine == ALL_ENGINES ) {
1046 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1048 SG_CLAMP_RANGE<int>( magnetos[i], 0, 3 );
1051 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1052 magnetos[engine] += amt;
1053 SG_CLAMP_RANGE<int>( magnetos[engine], 0, 3 );
1059 FGControls::set_nitrous_injection( int engine, bool val )
1061 if ( engine == ALL_ENGINES ) {
1062 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1063 nitrous_injection[i] = val;
1066 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1067 nitrous_injection[engine] = val;
1074 FGControls::set_cowl_flaps_norm( int engine, double pos )
1076 if ( engine == ALL_ENGINES ) {
1077 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1078 cowl_flaps_norm[i] = pos;
1079 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1082 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1083 cowl_flaps_norm[engine] = pos;
1084 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1090 FGControls::move_cowl_flaps_norm( int engine, double amt )
1092 if ( engine == ALL_ENGINES ) {
1093 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1094 cowl_flaps_norm[i] += amt;
1095 SG_CLAMP_RANGE<double>( cowl_flaps_norm[i], 0.0, 1.0 );
1098 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1099 cowl_flaps_norm[engine] += amt;
1100 SG_CLAMP_RANGE<double>( cowl_flaps_norm[engine], 0.0, 1.0 );
1106 FGControls::set_feather( int engine, bool val )
1108 if ( engine == ALL_ENGINES ) {
1109 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1113 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1114 feather[engine] = val;
1120 FGControls::set_ignition( int engine, int pos )
1122 if ( engine == ALL_ENGINES ) {
1123 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1125 SG_CLAMP_RANGE<int>( ignition[i], 0, 3 );
1128 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1129 ignition[engine] = pos;
1130 SG_CLAMP_RANGE<int>( ignition[engine], 0, 3 );
1136 FGControls::set_augmentation( int engine, bool val )
1138 if ( engine == ALL_ENGINES ) {
1139 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1140 augmentation[i] = val;
1143 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1144 augmentation[engine] = val;
1150 FGControls::set_reverser( int engine, bool val )
1152 if ( engine == ALL_ENGINES ) {
1153 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1157 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1158 reverser[engine] = val;
1164 FGControls::set_water_injection( int engine, bool val )
1166 if ( engine == ALL_ENGINES ) {
1167 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1168 water_injection[i] = val;
1171 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1172 water_injection[engine] = val;
1178 FGControls::set_condition( int engine, double val )
1180 if ( engine == ALL_ENGINES ) {
1181 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1183 SG_CLAMP_RANGE<double>( condition[i], 0.0, 1.0 );
1186 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1187 condition[engine] = val;
1188 SG_CLAMP_RANGE<double>( condition[engine], 0.0, 1.0 );
1194 FGControls::set_dump_valve( bool val )
1201 FGControls::set_fuel_selector( int tank, bool pos )
1203 if ( tank == ALL_TANKS ) {
1204 for ( int i = 0; i < MAX_TANKS; i++ ) {
1205 fuel_selector[i] = pos;
1208 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1209 fuel_selector[tank] = pos;
1215 FGControls::set_to_engine( int tank, int engine )
1217 if ( tank == ALL_TANKS ) {
1218 for ( int i = 0; i < MAX_TANKS; i++ ) {
1219 to_engine[i] = engine;
1222 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1223 to_engine[tank] = engine;
1229 FGControls::set_to_tank( int tank, int dest_tank )
1231 if ( tank == ALL_TANKS ) {
1232 for ( int i = 0; i < MAX_TANKS; i++ ) {
1233 to_tank[i] = dest_tank;
1236 if ( (tank >= 0) && (tank < MAX_TANKS) ) {
1237 to_tank[tank] = dest_tank;
1243 FGControls::set_boost_pump( int index, bool val )
1245 if ( index == -1 ) {
1246 for ( int i = 0; i < (MAX_TANKS * MAX_BOOSTPUMPS); i++ ) {
1247 boost_pump[i] = val;
1250 if ( (index >= 0) && (index < (MAX_TANKS * MAX_BOOSTPUMPS)) ) {
1251 boost_pump[index] = val;
1258 FGControls::set_brake_left( double pos )
1261 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1265 FGControls::move_brake_left( double amt )
1268 SG_CLAMP_RANGE<double>( brake_left, 0.0, 1.0 );
1272 FGControls::set_brake_right( double pos )
1275 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1279 FGControls::move_brake_right( double amt )
1282 SG_CLAMP_RANGE<double>( brake_right, 0.0, 1.0 );
1286 FGControls::set_copilot_brake_left( double pos )
1288 copilot_brake_left = pos;
1289 SG_CLAMP_RANGE<double>(brake_left, 0.0, 1.0);
1293 FGControls::set_copilot_brake_right( double pos )
1295 copilot_brake_right = pos;
1296 SG_CLAMP_RANGE<double>(brake_right, 0.0, 1.0);
1300 FGControls::set_brake_parking( double pos )
1302 brake_parking = pos;
1303 SG_CLAMP_RANGE<double>(brake_parking, 0.0, 1.0);
1307 FGControls::set_steering( double angle )
1310 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1314 FGControls::set_nose_wheel_steering( bool nws )
1316 nose_wheel_steering = nws;
1320 FGControls::move_steering( double angle )
1323 SG_CLAMP_RANGE<double>(steering, -80.0, 80.0);
1327 FGControls::set_gear_down( bool gear )
1333 FGControls::set_antiskid( bool state )
1339 FGControls::set_tailhook( bool state )
1345 FGControls::set_launchbar( bool state )
1351 FGControls::set_catapult_launch_cmd( bool state )
1353 catapult_launch_cmd = state;
1357 FGControls::set_tailwheel_lock( bool state )
1359 tailwheel_lock = state;
1364 FGControls::set_alternate_extension( int wheel, bool val )
1366 if ( wheel == ALL_WHEELS ) {
1367 for ( int i = 0; i < MAX_WHEELS; i++ ) {
1368 alternate_extension[i] = val;
1371 if ( (wheel >= 0) && (wheel < MAX_WHEELS) ) {
1372 alternate_extension[wheel] = val;
1378 FGControls::set_wing_heat( bool state )
1384 FGControls::set_pitot_heat( bool state )
1390 FGControls::set_wiper( int state )
1396 FGControls::set_window_heat( bool state )
1398 window_heat = state;
1402 FGControls::set_carb_heat( int engine, bool val )
1404 if ( engine == ALL_ENGINES ) {
1405 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1409 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1410 carb_heat[engine] = val;
1416 FGControls::set_inlet_heat( int engine, bool val )
1418 if ( engine == ALL_ENGINES ) {
1419 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1420 inlet_heat[i] = val;
1423 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1424 inlet_heat[engine] = val;
1430 FGControls::set_engine_pump( int system, bool val )
1432 if ( system == ALL_HYD_SYSTEMS ) {
1433 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1434 engine_pump[i] = val;
1437 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1438 engine_pump[system] = val;
1444 FGControls::set_electric_pump( int system, bool val )
1446 if ( system == ALL_HYD_SYSTEMS ) {
1447 for ( int i = 0; i < MAX_HYD_SYSTEMS; i++ ) {
1448 electric_pump[i] = val;
1451 if ( (system >= 0) && (system < MAX_HYD_SYSTEMS) ) {
1452 electric_pump[system] = val;
1458 FGControls::set_battery_switch( bool state )
1460 battery_switch = state;
1464 FGControls::set_external_power( bool state )
1466 external_power = state;
1470 FGControls::set_APU_generator( bool state )
1472 APU_generator = state;
1476 FGControls::set_generator_breaker( int engine, bool val )
1478 if ( engine == ALL_ENGINES ) {
1479 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1480 generator_breaker[i] = val;
1483 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1484 generator_breaker[engine] = val;
1490 FGControls::set_bus_tie( int engine, bool val )
1492 if ( engine == ALL_ENGINES ) {
1493 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1497 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1498 bus_tie[engine] = val;
1504 FGControls::set_APU_bleed( bool state )
1510 FGControls::set_engine_bleed( int engine, bool val )
1512 if ( engine == ALL_ENGINES ) {
1513 for ( int i = 0; i < MAX_ENGINES; i++ ) {
1514 engine_bleed[i] = val;
1517 if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
1518 engine_bleed[engine] = val;
1524 FGControls::set_mode( int new_mode )
1530 FGControls::set_outflow_valve( double pos )
1532 outflow_valve = pos;
1533 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1537 FGControls::move_outflow_valve( double amt )
1539 outflow_valve += amt;
1540 SG_CLAMP_RANGE<double>( outflow_valve, 0.0, 1.0 );
1544 FGControls::set_dump( bool state )
1550 FGControls::set_pack_on( int pack, bool val )
1552 if ( pack == ALL_PACKS ) {
1553 for ( int i = 0; i < MAX_PACKS; i++ ) {
1557 if ( (pack >= 0) && (pack < MAX_PACKS) ) {
1558 pack_on[pack] = val;
1564 FGControls::set_landing_lights( bool state )
1566 landing_lights = state;
1570 FGControls::set_turn_off_lights( bool state )
1572 turn_off_lights = state;
1576 FGControls::set_taxi_light( bool state )
1582 FGControls::set_logo_lights( bool state )
1584 logo_lights = state;
1588 FGControls::set_nav_lights( bool state )
1594 FGControls::set_beacon( bool state )
1600 FGControls::set_strobe( bool state )
1606 FGControls::set_panel_norm( double intensity )
1608 panel_norm = intensity;
1609 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1613 FGControls::move_panel_norm( double amt )
1616 SG_CLAMP_RANGE<double>( panel_norm, 0.0, 1.0 );
1620 FGControls::set_instruments_norm( double intensity )
1622 instruments_norm = intensity;
1623 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1627 FGControls::move_instruments_norm( double amt )
1629 instruments_norm += amt;
1630 SG_CLAMP_RANGE<double>( instruments_norm, 0.0, 1.0 );
1634 FGControls::set_dome_norm( double intensity )
1636 dome_norm = intensity;
1637 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1641 FGControls::move_dome_norm( double amt )
1644 SG_CLAMP_RANGE<double>( dome_norm, 0.0, 1.0 );
1648 FGControls::set_master_arm( bool val )
1654 FGControls::set_station_select( int station )
1656 station_select = station;
1657 SG_CLAMP_RANGE<int>( station_select, 0, MAX_STATIONS );
1661 FGControls::set_release_ALL( bool val )
1667 FGControls::set_stick_size( int station, int size )
1669 if ( station == ALL_STATIONS ) {
1670 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1671 stick_size[i] = size;
1672 SG_CLAMP_RANGE<int>( stick_size[i], 1, 20 );
1675 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1676 stick_size[station] = size;
1677 SG_CLAMP_RANGE<int>( stick_size[station], 1, 20 );
1683 FGControls::set_release_stick( int station, bool val )
1685 if ( station == ALL_STATIONS ) {
1686 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1687 release_stick[i] = val;
1690 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1691 release_stick[station] = val;
1697 FGControls::set_release_all( int station, bool val )
1699 if ( station == ALL_STATIONS ) {
1700 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1701 release_all[i] = val;
1704 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1705 release_all[station] = val;
1711 FGControls::set_jettison_all( int station, bool val )
1713 if ( station == ALL_STATIONS ) {
1714 for ( int i = 0; i < MAX_STATIONS; i++ ) {
1715 jettison_all[i] = val;
1718 if ( (station >= 0) && (station < MAX_STATIONS) ) {
1719 jettison_all[station] = val;
1725 FGControls::set_vertical_adjust( double pos )
1727 vertical_adjust = pos;
1728 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1732 FGControls::move_vertical_adjust( double amt )
1734 vertical_adjust += amt;
1735 SG_CLAMP_RANGE<double>( vertical_adjust, -1.0, 1.0 );
1739 FGControls::set_fore_aft_adjust( double pos )
1741 fore_aft_adjust = pos;
1742 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1746 FGControls::move_fore_aft_adjust( double amt )
1748 fore_aft_adjust += amt;
1749 SG_CLAMP_RANGE<double>( fore_aft_adjust, -1.0, 1.0 );
1753 FGControls::set_ejection_seat( int which_seat, bool val )
1755 if ( which_seat == ALL_EJECTION_SEATS ) {
1756 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1760 if ( (which_seat >= 0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1761 if ( eseat_status[which_seat] == SEAT_SAFED ||
1762 eseat_status[which_seat] == SEAT_FAIL )
1764 // we can never eject if SEAT_SAFED or SEAT_FAIL
1768 eject[which_seat] = val;
1774 FGControls::set_eseat_status( int which_seat, int val )
1776 if ( which_seat == ALL_EJECTION_SEATS ) {
1777 for ( int i = 0; i < MAX_EJECTION_SEATS; i++ ) {
1778 eseat_status[i] = val;
1781 if ( (which_seat >=0) && (which_seat <= MAX_EJECTION_SEATS) ) {
1782 eseat_status[which_seat] = val;
1788 FGControls::set_cmd_selector_valve( int val )
1790 cmd_selector_valve = val;
1795 FGControls::set_off_start_run( int pos )
1797 off_start_run = pos;
1798 SG_CLAMP_RANGE<int>( off_start_run, 0, 3 );
1802 FGControls::set_APU_fire_switch( bool val )
1804 APU_fire_switch = val;
1808 FGControls::set_autothrottle_arm( bool val )
1810 autothrottle_arm = val;
1814 FGControls::set_autothrottle_engage( bool val )
1816 autothrottle_engage = val;
1820 FGControls::set_heading_select( double heading )
1822 heading_select = heading;
1823 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1827 FGControls::move_heading_select( double amt )
1829 heading_select += amt;
1830 SG_CLAMP_RANGE<double>( heading_select, 0.0, 360.0 );
1834 FGControls::set_altitude_select( double altitude )
1836 altitude_select = altitude;
1837 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1841 FGControls::move_altitude_select( double amt )
1843 altitude_select += amt;
1844 SG_CLAMP_RANGE<double>( altitude_select, -1000.0, 100000.0 );
1848 FGControls::set_bank_angle_select( double angle )
1850 bank_angle_select = angle;
1851 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1855 FGControls::move_bank_angle_select( double amt )
1857 bank_angle_select += amt;
1858 SG_CLAMP_RANGE<double>( bank_angle_select, 10.0, 30.0 );
1862 FGControls::set_vertical_speed_select( double speed )
1864 vertical_speed_select = speed;
1865 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1869 FGControls::move_vertical_speed_select( double amt )
1871 vertical_speed_select += amt;
1872 SG_CLAMP_RANGE<double>( vertical_speed_select, -3000.0, 4000.0 );
1876 FGControls::set_speed_select( double speed )
1878 speed_select = speed;
1879 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1883 FGControls::move_speed_select( double amt )
1885 speed_select += amt;
1886 SG_CLAMP_RANGE<double>( speed_select, 60.0, 400.0 );
1890 FGControls::set_mach_select( double mach )
1893 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1897 FGControls::move_mach_select( double amt )
1900 SG_CLAMP_RANGE<double>( mach_select, 0.4, 4.0 );
1904 FGControls::set_vertical_mode( int mode )
1906 vertical_mode = mode;
1907 SG_CLAMP_RANGE<int>( vertical_mode, 0, 4 );
1911 FGControls::set_lateral_mode( int mode )
1913 lateral_mode = mode;
1914 SG_CLAMP_RANGE<int>( lateral_mode, 0, 4 );
1918 FGControls::set_autopilot_engage( int ap, bool val )
1920 if ( ap == ALL_AUTOPILOTS ) {
1921 for ( int i = 0; i < MAX_AUTOPILOTS; i++ ) {
1922 autopilot_engage[i] = val;
1925 if ( (ap >= 0) && (ap < MAX_AUTOPILOTS) ) {
1926 autopilot_engage[ap] = val;