1 // bfi.cxx - Big Friendly Interface implementation
3 // Written by David Megginson, started February, 2000.
5 // Copyright (C) 2000 David Megginson - david@megginson.com
7 // THIS CLASS IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <simgear/constants.h>
28 #include <simgear/debug/logstream.hxx>
29 #include <simgear/ephemeris/ephemeris.hxx>
30 #include <simgear/math/sg_types.hxx>
31 #include <simgear/misc/props.hxx>
32 #include <simgear/timing/sg_time.hxx>
34 #include <Aircraft/aircraft.hxx>
35 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
36 #include <Controls/controls.hxx>
37 #include <Autopilot/newauto.hxx>
38 #include <Scenery/scenery.hxx>
39 #include <Time/light.hxx>
40 #include <Time/event.hxx>
41 #include <Time/sunpos.hxx>
42 #include <Time/tmp.hxx>
43 #include <Cockpit/radiostack.hxx>
44 #include <Cockpit/panel.hxx>
45 #ifndef FG_OLD_WEATHER
46 # include <WeatherCM/FGLocalWeatherDatabase.h>
48 # include <Weather/weather.hxx>
51 #include "globals.hxx"
52 #include "fg_init.hxx"
53 #include "fg_props.hxx"
55 SG_USING_NAMESPACE(std);
62 ////////////////////////////////////////////////////////////////////////
64 ////////////////////////////////////////////////////////////////////////
66 // Yech -- not thread-safe, etc. etc.
67 static bool _needReinit = false;
70 static inline void needReinit ()
77 * Reinitialize FGFS to use the new BFI settings.
82 // Save the state of everything
83 // that's going to get clobbered
84 // when we reinit the subsystems.
86 FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI reinit");
88 // TODO: add more AP stuff
89 bool apHeadingLock = FGBFI::getAPHeadingLock();
90 bool apAltitudeLock = FGBFI::getAPAltitudeLock();
91 double apAltitude = FGBFI::getAPAltitude();
92 bool gpsLock = FGBFI::getGPSLock();
93 // double gpsLatitude = FGBFI::getGPSTargetLatitude();
94 // double gpsLongitude = FGBFI::getGPSTargetLongitude();
98 // FIXME: this is wrong.
99 // All of these are scheduled events,
100 // and it should be possible to force
101 // them all to run once.
104 cur_light_params.Update();
106 fgUpdateWeatherDatabase();
107 current_radiostack->search();
109 // Restore all of the old states.
110 FGBFI::setAPHeadingLock(apHeadingLock);
111 FGBFI::setAPAltitudeLock(apAltitudeLock);
112 FGBFI::setAPAltitude(apAltitude);
113 FGBFI::setGPSLock(gpsLock);
117 FG_LOG(FG_GENERAL, FG_INFO, "Ending BFI reinit");
121 // Allow the view to be set from two axes (i.e. a joystick hat)
122 // This needs to be in FGViewer itself, somehow.
123 static double axisLong = 0.0;
124 static double axisLat = 0.0;
127 _set_view_from_axes ()
129 // Take no action when hat is centered
130 if (axisLong == 0 && axisLat == 0)
135 if (axisLong < 0) { // Longitudinal axis forward
138 else if (axisLat > 0)
142 } else if (axisLong > 0) { // Longitudinal axis backward
145 else if (axisLat > 0)
149 } else { // Longitudinal axis neutral
156 globals->get_current_view()->set_goal_view_offset(viewDir*DEG_TO_RAD);
157 // globals->get_current_view()->set_view_offset(viewDir*DEG_TO_RAD);
164 ////////////////////////////////////////////////////////////////////////
166 ////////////////////////////////////////////////////////////////////////
170 * Initialize the BFI by binding its functions to properties.
172 * TODO: perhaps these should migrate into the individual modules
173 * (i.e. they should register themselves).
178 FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI init");
181 fgTie("/sim/aircraft-dir", getAircraftDir, setAircraftDir);
182 fgTie("/sim/time/gmt", getDateString, setDateString);
183 fgTie("/sim/time/gmt-string", getGMTString);
186 fgTie("/orientation/heading-magnetic", getHeadingMag);
189 fgTie("/engines/engine0/rpm", getRPM);
190 fgTie("/engines/engine0/egt", getEGT);
191 fgTie("/engines/engine0/cht", getCHT);
192 fgTie("/engines/engine0/mp", getMP);
193 fgTie("/engines/engine0/fuel-flow", getFuelFlow);
196 fgTie("/consumables/fuel/tank1/level", getTank1Fuel, setTank1Fuel, false);
197 fgTie("/consumables/fuel/tank2/level", getTank2Fuel, setTank2Fuel, false);
200 fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock);
201 fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude);
202 fgTie("/autopilot/settings/climb-rate", getAPClimb, setAPClimb, false);
203 fgTie("/autopilot/locks/heading", getAPHeadingLock, setAPHeadingLock);
204 fgTie("/autopilot/settings/heading-bug", getAPHeadingBug, setAPHeadingBug,
206 fgTie("/autopilot/locks/wing-leveler", getAPWingLeveler, setAPWingLeveler);
207 fgTie("/autopilot/locks/nav1", getAPNAV1Lock, setAPNAV1Lock);
210 fgTie("/environment/visibility", getVisibility, setVisibility);
211 fgTie("/environment/wind-north", getWindNorth, setWindNorth);
212 fgTie("/environment/wind-east", getWindEast, setWindEast);
213 fgTie("/environment/wind-down", getWindDown, setWindDown);
216 fgTie("/sim/field-of-view", getFOV, setFOV);
217 fgTie("/sim/view/axes/long", (double(*)())0, setViewAxisLong);
218 fgTie("/sim/view/axes/lat", (double(*)())0, setViewAxisLat);
222 FG_LOG(FG_GENERAL, FG_INFO, "Ending BFI init");
227 * Reinitialize FGFS if required.
229 * Some changes (especially those in aircraft position) require that
230 * FGFS be reinitialized afterwards. Rather than reinitialize after
231 * every change, the setter methods simply set a flag so that there
232 * can be a single reinit at the end of the frame.
237 _set_view_from_axes();
245 ////////////////////////////////////////////////////////////////////////
247 ////////////////////////////////////////////////////////////////////////
251 * Return the current aircraft directory (UIUC) as a string.
254 FGBFI::getAircraftDir ()
261 * Set the current aircraft directory (UIUC).
264 FGBFI::setAircraftDir (string dir)
266 if (getAircraftDir() != dir) {
274 * Return the current Zulu time.
277 FGBFI::getDateString ()
281 struct tm * t = globals->get_time_params()->getGmt();
282 sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
283 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
284 t->tm_hour, t->tm_min, t->tm_sec);
291 * Set the current Zulu time.
294 FGBFI::setDateString (string date_string)
295 // FGBFI::setTimeGMT (time_t time)
297 SGTime * st = globals->get_time_params();
298 struct tm * current_time = st->getGmt();
301 // Scan for basic ISO format
302 // YYYY-MM-DDTHH:MM:SS
303 int ret = sscanf(date_string.c_str(), "%d-%d-%dT%d:%d:%d",
304 &(new_time.tm_year), &(new_time.tm_mon),
305 &(new_time.tm_mday), &(new_time.tm_hour),
306 &(new_time.tm_min), &(new_time.tm_sec));
308 // Be pretty picky about this, so
309 // that strange things don't happen
310 // if the save file has been edited
313 FG_LOG(FG_INPUT, FG_ALERT, "Date/time string " << date_string
314 << " not in YYYY-MM-DDTHH:MM:SS format; skipped");
318 // OK, it looks like we got six
319 // values, one way or another.
320 new_time.tm_year -= 1900;
321 new_time.tm_mon -= 1;
323 // Now, tell flight gear to use
324 // the new time. This was far
325 // too difficult, by the way.
327 mktime(&new_time) - mktime(current_time) + globals->get_warp();
328 double lon = current_aircraft.fdm_state->get_Longitude();
329 double lat = current_aircraft.fdm_state->get_Latitude();
330 // double alt = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER;
331 globals->set_warp(warp);
332 st->update(lon, lat, warp);
333 fgUpdateSkyAndLightingParams();
338 * Return the GMT as a string.
341 FGBFI::getGMTString ()
345 struct tm * t = globals->get_time_params()->getGmt();
346 sprintf(buf, " %.2d:%.2d:%.2d",
347 t->tm_hour, t->tm_min, t->tm_sec);
354 ////////////////////////////////////////////////////////////////////////
356 ////////////////////////////////////////////////////////////////////////
360 * Return the current latitude in degrees (negative for south).
363 FGBFI::getLatitude ()
365 return current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
370 * Set the current latitude in degrees (negative for south).
373 FGBFI::setLatitude (double latitude)
375 current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD);
380 * Return the current longitude in degrees (negative for west).
383 FGBFI::getLongitude ()
385 return current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
390 * Set the current longitude in degrees (negative for west).
393 FGBFI::setLongitude (double longitude)
395 current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD);
400 * Return the current altitude in feet.
403 FGBFI::getAltitude ()
405 return current_aircraft.fdm_state->get_Altitude();
411 * Return the current altitude in above the terrain.
416 return current_aircraft.fdm_state->get_Altitude()
417 - (scenery.cur_elev * METER_TO_FEET);
422 * Set the current altitude in feet.
425 FGBFI::setAltitude (double altitude)
427 current_aircraft.fdm_state->set_Altitude(altitude);
432 ////////////////////////////////////////////////////////////////////////
434 ////////////////////////////////////////////////////////////////////////
438 * Return the current heading in degrees.
443 return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG;
448 * Return the current heading in degrees.
451 FGBFI::getHeadingMag ()
453 return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG - getMagVar();
458 * Set the current heading in degrees.
461 FGBFI::setHeading (double heading)
463 FGInterface * fdm = current_aircraft.fdm_state;
464 fdm->set_Euler_Angles(fdm->get_Phi(), fdm->get_Theta(),
465 heading * DEG_TO_RAD);
470 * Return the current pitch in degrees.
475 return current_aircraft.fdm_state->get_Theta() * RAD_TO_DEG;
480 * Set the current pitch in degrees.
483 FGBFI::setPitch (double pitch)
485 FGInterface * fdm = current_aircraft.fdm_state;
486 fdm->set_Euler_Angles(fdm->get_Phi(), pitch * DEG_TO_RAD, fdm->get_Psi());
491 * Return the current roll in degrees.
496 return current_aircraft.fdm_state->get_Phi() * RAD_TO_DEG;
501 * Set the current roll in degrees.
504 FGBFI::setRoll (double roll)
506 FGInterface * fdm = current_aircraft.fdm_state;
507 fdm->set_Euler_Angles(roll * DEG_TO_RAD, fdm->get_Theta(), fdm->get_Psi());
512 * Return the current engine0 rpm
517 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
518 return current_aircraft.fdm_state->get_engine(0)->get_RPM();
526 * Set the current engine0 rpm
529 FGBFI::setRPM (double rpm)
531 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
532 if (getRPM() != rpm) {
533 current_aircraft.fdm_state->get_engine(0)->set_RPM( rpm );
540 * Return the current engine0 EGT.
545 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
546 return current_aircraft.fdm_state->get_engine(0)->get_EGT();
554 * Return the current engine0 CHT.
559 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
560 return current_aircraft.fdm_state->get_engine(0)->get_CHT();
568 * Return the current engine0 Manifold Pressure.
573 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
574 return current_aircraft.fdm_state->get_engine(0)->get_Manifold_Pressure();
581 * Return the current engine0 fuel flow
584 FGBFI::getFuelFlow ()
586 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
587 return current_aircraft.fdm_state->get_engine(0)->get_Fuel_Flow();
593 ////////////////////////////////////////////////////////////////////////
595 ////////////////////////////////////////////////////////////////////////
598 * Return the fuel level in tank 1
601 FGBFI::getTank1Fuel ()
603 return current_aircraft.fdm_state->get_Tank1Fuel();
607 FGBFI::setTank1Fuel ( double gals )
609 current_aircraft.fdm_state->set_Tank1Fuel( gals );
613 * Return the fuel level in tank 2
616 FGBFI::getTank2Fuel ()
618 return current_aircraft.fdm_state->get_Tank2Fuel();
622 FGBFI::setTank2Fuel ( double gals )
624 current_aircraft.fdm_state->set_Tank2Fuel( gals );
628 ////////////////////////////////////////////////////////////////////////
630 ////////////////////////////////////////////////////////////////////////
634 * Return the current airspeed in knots.
637 FGBFI::getAirspeed ()
639 // FIXME: should we add speed-up?
640 return current_aircraft.fdm_state->get_V_calibrated_kts();
645 * Set the calibrated airspeed in knots.
648 FGBFI::setAirspeed (double speed)
650 current_aircraft.fdm_state->set_V_calibrated_kts(speed);
655 * Return the current sideslip (FIXME: units unknown).
658 FGBFI::getSideSlip ()
660 return current_aircraft.fdm_state->get_Beta();
665 * Return the current climb rate in feet/minute
668 FGBFI::getVerticalSpeed ()
670 // What about meters?
671 return current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
676 * Get the current north velocity (units??).
679 FGBFI::getSpeedNorth ()
681 return current_aircraft.fdm_state->get_V_north();
686 // * Set the current north velocity (units??).
689 // FGBFI::setSpeedNorth (double speed)
691 // FGInterface * fdm = current_aircraft.fdm_state;
692 // // fdm->set_Velocities_Local(speed, fdm->get_V_east(), fdm->get_V_down());
697 * Get the current east velocity (units??).
700 FGBFI::getSpeedEast ()
702 return current_aircraft.fdm_state->get_V_east();
707 // * Set the current east velocity (units??).
710 // FGBFI::setSpeedEast (double speed)
712 // FGInterface * fdm = current_aircraft.fdm_state;
713 // // fdm->set_Velocities_Local(fdm->get_V_north(), speed, fdm->get_V_down());
718 * Get the current down velocity (units??).
721 FGBFI::getSpeedDown ()
723 return current_aircraft.fdm_state->get_V_down();
728 // * Set the current down velocity (units??).
731 // FGBFI::setSpeedDown (double speed)
733 // FGInterface * fdm = current_aircraft.fdm_state;
734 // // fdm->set_Velocities_Local(fdm->get_V_north(), fdm->get_V_east(), speed);
739 ////////////////////////////////////////////////////////////////////////
741 ////////////////////////////////////////////////////////////////////////
746 * Get the throttle setting, from 0.0 (none) to 1.0 (full).
749 FGBFI::getThrottle ()
751 // FIXME: add engine selector
752 return controls.get_throttle(0);
757 * Set the throttle, from 0.0 (none) to 1.0 (full).
760 FGBFI::setThrottle (double throttle)
762 // FIXME: allow engine selection
763 controls.set_throttle(0, throttle);
768 * Get the fuel mixture setting, from 0.0 (none) to 1.0 (full).
773 // FIXME: add engine selector
774 return controls.get_mixture(0);
779 * Set the fuel mixture, from 0.0 (none) to 1.0 (full).
782 FGBFI::setMixture (double mixture)
784 // FIXME: allow engine selection
785 controls.set_mixture(0, mixture);
790 * Get the propellor pitch setting, from 0.0 (none) to 1.0 (full).
793 FGBFI::getPropAdvance ()
795 // FIXME: add engine selector
796 return controls.get_prop_advance(0);
801 * Set the propellor pitch, from 0.0 (none) to 1.0 (full).
804 FGBFI::setPropAdvance (double pitch)
806 // FIXME: allow engine selection
807 controls.set_prop_advance(0, pitch);
812 * Get the flaps setting, from 0.0 (none) to 1.0 (full).
817 return controls.get_flaps();
822 * Set the flaps, from 0.0 (none) to 1.0 (full).
825 FGBFI::setFlaps (double flaps)
828 controls.set_flaps(flaps);
833 * Get the aileron, from -1.0 (left) to 1.0 (right).
838 return controls.get_aileron();
843 * Set the aileron, from -1.0 (left) to 1.0 (right).
846 FGBFI::setAileron (double aileron)
849 controls.set_aileron(aileron);
854 * Get the rudder setting, from -1.0 (left) to 1.0 (right).
859 return controls.get_rudder();
864 * Set the rudder, from -1.0 (left) to 1.0 (right).
867 FGBFI::setRudder (double rudder)
870 controls.set_rudder(rudder);
875 * Get the elevator setting, from -1.0 (down) to 1.0 (up).
878 FGBFI::getElevator ()
880 return controls.get_elevator();
885 * Set the elevator, from -1.0 (down) to 1.0 (up).
888 FGBFI::setElevator (double elevator)
891 controls.set_elevator(elevator);
896 * Get the elevator trim, from -1.0 (down) to 1.0 (up).
899 FGBFI::getElevatorTrim ()
901 return controls.get_elevator_trim();
906 * Set the elevator trim, from -1.0 (down) to 1.0 (up).
909 FGBFI::setElevatorTrim (double trim)
912 controls.set_elevator_trim(trim);
917 * Get the highest brake setting, from 0.0 (none) to 1.0 (full).
922 double b1 = getCenterBrake();
923 double b2 = getLeftBrake();
924 double b3 = getRightBrake();
925 return (b1 > b2 ? (b1 > b3 ? b1 : b3) : (b2 > b3 ? b2 : b3));
930 * Set all brakes, from 0.0 (none) to 1.0 (full).
933 FGBFI::setBrakes (double brake)
935 setCenterBrake(brake);
937 setRightBrake(brake);
942 * Get the center brake, from 0.0 (none) to 1.0 (full).
945 FGBFI::getCenterBrake ()
947 return controls.get_brake(2);
952 * Set the center brake, from 0.0 (none) to 1.0 (full).
955 FGBFI::setCenterBrake (double brake)
957 controls.set_brake(2, brake);
962 * Get the left brake, from 0.0 (none) to 1.0 (full).
965 FGBFI::getLeftBrake ()
967 return controls.get_brake(0);
972 * Set the left brake, from 0.0 (none) to 1.0 (full).
975 FGBFI::setLeftBrake (double brake)
977 controls.set_brake(0, brake);
982 * Get the right brake, from 0.0 (none) to 1.0 (full).
985 FGBFI::getRightBrake ()
987 return controls.get_brake(1);
992 * Set the right brake, from 0.0 (none) to 1.0 (full).
995 FGBFI::setRightBrake (double brake)
997 controls.set_brake(1, brake);
1004 ////////////////////////////////////////////////////////////////////////
1006 ////////////////////////////////////////////////////////////////////////
1010 * Get the autopilot altitude lock (true=on).
1013 FGBFI::getAPAltitudeLock ()
1015 return current_autopilot->get_AltitudeEnabled();
1020 * Set the autopilot altitude lock (true=on).
1023 FGBFI::setAPAltitudeLock (bool lock)
1025 current_autopilot->set_AltitudeMode(FGAutopilot::FG_ALTITUDE_LOCK);
1026 current_autopilot->set_AltitudeEnabled(lock);
1031 * Get the autopilot target altitude in feet.
1034 FGBFI::getAPAltitude ()
1036 return current_autopilot->get_TargetAltitude() * METER_TO_FEET;
1041 * Set the autopilot target altitude in feet.
1044 FGBFI::setAPAltitude (double altitude)
1046 current_autopilot->set_TargetAltitude( altitude * FEET_TO_METER );
1051 * Get the autopilot target altitude in feet.
1054 FGBFI::getAPClimb ()
1056 return current_autopilot->get_TargetClimbRate() * METER_TO_FEET;
1061 * Set the autopilot target altitude in feet.
1064 FGBFI::setAPClimb (double rate)
1066 current_autopilot->set_TargetClimbRate( rate * FEET_TO_METER );
1071 * Get the autopilot heading lock (true=on).
1074 FGBFI::getAPHeadingLock ()
1077 (current_autopilot->get_HeadingEnabled() &&
1078 current_autopilot->get_HeadingMode() == FGAutopilot::FG_DG_HEADING_LOCK);
1083 * Set the autopilot heading lock (true=on).
1086 FGBFI::setAPHeadingLock (bool lock)
1089 current_autopilot->set_HeadingMode(FGAutopilot::FG_DG_HEADING_LOCK);
1090 current_autopilot->set_HeadingEnabled(true);
1092 current_autopilot->set_HeadingEnabled(false);
1098 * Get the autopilot heading bug in degrees.
1101 FGBFI::getAPHeadingBug ()
1103 return current_autopilot->get_DGTargetHeading();
1108 * Set the autopilot heading bug in degrees.
1111 FGBFI::setAPHeadingBug (double heading)
1113 current_autopilot->set_DGTargetHeading( heading );
1118 * Get the autopilot wing leveler lock (true=on).
1121 FGBFI::getAPWingLeveler ()
1124 (current_autopilot->get_HeadingEnabled() &&
1125 current_autopilot->get_HeadingMode() == FGAutopilot::FG_TC_HEADING_LOCK);
1130 * Set the autopilot wing leveler lock (true=on).
1133 FGBFI::setAPWingLeveler (bool lock)
1136 current_autopilot->set_HeadingMode(FGAutopilot::FG_TC_HEADING_LOCK);
1137 current_autopilot->set_HeadingEnabled(true);
1139 current_autopilot->set_HeadingEnabled(false);
1145 * Return true if the autopilot is locked to NAV1.
1148 FGBFI::getAPNAV1Lock ()
1151 (current_autopilot->get_HeadingEnabled() &&
1152 current_autopilot->get_HeadingMode() == FGAutopilot::FG_HEADING_NAV1);
1157 * Set the autopilot NAV1 lock.
1160 FGBFI::setAPNAV1Lock (bool lock)
1163 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_NAV1);
1164 current_autopilot->set_HeadingEnabled(true);
1165 } else if (current_autopilot->get_HeadingMode() ==
1166 FGAutopilot::FG_HEADING_NAV1) {
1167 current_autopilot->set_HeadingEnabled(false);
1173 ////////////////////////////////////////////////////////////////////////
1175 ////////////////////////////////////////////////////////////////////////
1179 * Get the autopilot GPS lock (true=on).
1182 FGBFI::getGPSLock ()
1184 return (current_autopilot->get_HeadingEnabled() &&
1185 (current_autopilot->get_HeadingMode() ==
1186 FGAutopilot::FG_HEADING_WAYPOINT ));
1191 * Set the autopilot GPS lock (true=on).
1194 FGBFI::setGPSLock (bool lock)
1197 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_WAYPOINT);
1198 current_autopilot->set_HeadingEnabled(true);
1199 } else if (current_autopilot->get_HeadingMode() ==
1200 FGAutopilot::FG_HEADING_WAYPOINT) {
1201 current_autopilot->set_HeadingEnabled(false);
1207 * Get the GPS target latitude in degrees (negative for south).
1210 FGBFI::getGPSTargetLatitude ()
1212 return current_autopilot->get_TargetLatitude();
1217 * Get the GPS target longitude in degrees (negative for west).
1220 FGBFI::getGPSTargetLongitude ()
1222 return current_autopilot->get_TargetLongitude();
1227 * Set the GPS target longitude in degrees (negative for west).
1230 FGBFI::setGPSTargetLongitude (double longitude)
1232 current_autopilot->set_TargetLongitude( longitude );
1238 ////////////////////////////////////////////////////////////////////////
1240 ////////////////////////////////////////////////////////////////////////
1244 * Get the current visibility (meters).
1247 FGBFI::getVisibility ()
1249 #ifndef FG_OLD_WEATHER
1250 return WeatherDatabase->getWeatherVisibility();
1252 return current_weather.get_visibility();
1258 * Set the current visibility (meters).
1261 FGBFI::setVisibility (double visibility)
1263 #ifndef FG_OLD_WEATHER
1264 WeatherDatabase->setWeatherVisibility(visibility);
1266 current_weather.set_visibility(visibility);
1272 * Get the current wind north velocity (feet/second).
1275 FGBFI::getWindNorth ()
1277 return current_aircraft.fdm_state->get_V_north_airmass();
1282 * Set the current wind north velocity (feet/second).
1285 FGBFI::setWindNorth (double speed)
1287 current_aircraft.fdm_state->set_Velocities_Local_Airmass(speed,
1294 * Get the current wind east velocity (feet/second).
1297 FGBFI::getWindEast ()
1299 return current_aircraft.fdm_state->get_V_east_airmass();
1304 * Set the current wind east velocity (feet/second).
1307 FGBFI::setWindEast (double speed)
1309 cout << "Set wind-east to " << speed << endl;
1310 current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
1317 * Get the current wind down velocity (feet/second).
1320 FGBFI::getWindDown ()
1322 return current_aircraft.fdm_state->get_V_down_airmass();
1327 * Set the current wind down velocity (feet/second).
1330 FGBFI::setWindDown (double speed)
1332 current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
1339 ////////////////////////////////////////////////////////////////////////
1341 ////////////////////////////////////////////////////////////////////////
1346 return globals->get_current_view()->get_fov();
1350 FGBFI::setFOV (double fov)
1352 globals->get_current_view()->set_fov( fov );
1356 FGBFI::setViewAxisLong (double axis)
1362 FGBFI::setViewAxisLat (double axis)
1368 ////////////////////////////////////////////////////////////////////////
1370 ////////////////////////////////////////////////////////////////////////
1373 * Return the magnetic variation
1378 return globals->get_mag()->get_magvar() * RAD_TO_DEG;
1383 * Return the magnetic variation
1388 return globals->get_mag()->get_magdip() * RAD_TO_DEG;