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 SG_LOG(SG_GENERAL, SG_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 #ifndef FG_OLD_WEATHER
107 fgUpdateWeatherDatabase();
109 current_radiostack->search();
111 // Restore all of the old states.
112 FGBFI::setAPHeadingLock(apHeadingLock);
113 FGBFI::setAPAltitudeLock(apAltitudeLock);
114 FGBFI::setAPAltitude(apAltitude);
115 FGBFI::setGPSLock(gpsLock);
119 SG_LOG(SG_GENERAL, SG_INFO, "Ending BFI reinit");
123 // Allow the view to be set from two axes (i.e. a joystick hat)
124 // This needs to be in FGViewer itself, somehow.
125 static double axisLong = 0.0;
126 static double axisLat = 0.0;
129 _set_view_from_axes ()
131 // Take no action when hat is centered
132 if (axisLong == 0 && axisLat == 0)
137 if (axisLong < 0) { // Longitudinal axis forward
140 else if (axisLat > 0)
144 } else if (axisLong > 0) { // Longitudinal axis backward
147 else if (axisLat > 0)
151 } else { // Longitudinal axis neutral
158 globals->get_current_view()->set_goal_view_offset(viewDir*SGD_DEGREES_TO_RADIANS);
159 // globals->get_current_view()->set_view_offset(viewDir*SGD_DEGREES_TO_RADIANS);
166 ////////////////////////////////////////////////////////////////////////
168 ////////////////////////////////////////////////////////////////////////
172 * Initialize the BFI by binding its functions to properties.
174 * TODO: perhaps these should migrate into the individual modules
175 * (i.e. they should register themselves).
180 SG_LOG(SG_GENERAL, SG_INFO, "Starting BFI init");
183 fgTie("/sim/aircraft-dir", getAircraftDir, setAircraftDir);
184 fgTie("/sim/view/offset", getViewOffset, setViewOffset);
185 fgTie("/sim/view/goal-offset", getGoalViewOffset, setGoalViewOffset);
186 fgTie("/sim/time/gmt", getDateString, setDateString);
187 fgTie("/sim/time/gmt-string", getGMTString);
190 fgTie("/orientation/heading-magnetic", getHeadingMag);
193 fgTie("/engines/engine0/rpm", getRPM);
194 fgTie("/engines/engine0/egt", getEGT);
195 fgTie("/engines/engine0/cht", getCHT);
196 fgTie("/engines/engine0/mp", getMP);
197 fgTie("/engines/engine0/fuel-flow", getFuelFlow);
200 fgTie("/consumables/fuel/tank1/level", getTank1Fuel, setTank1Fuel, false);
201 fgTie("/consumables/fuel/tank2/level", getTank2Fuel, setTank2Fuel, false);
204 fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock);
205 fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude);
206 fgTie("/autopilot/locks/glide-slope", getAPGSLock, setAPGSLock);
207 fgTie("/autopilot/settings/climb-rate", getAPClimb, setAPClimb, false);
208 fgTie("/autopilot/locks/heading", getAPHeadingLock, setAPHeadingLock);
209 fgTie("/autopilot/settings/heading-bug", getAPHeadingBug, setAPHeadingBug,
211 fgTie("/autopilot/locks/wing-leveler", getAPWingLeveler, setAPWingLeveler);
212 fgTie("/autopilot/locks/nav1", getAPNAV1Lock, setAPNAV1Lock);
213 fgTie("/autopilot/locks/auto-throttle",
214 getAPAutoThrottleLock, setAPAutoThrottleLock);
215 fgTie("/autopilot/control-overrides/rudder",
216 getAPRudderControl, setAPRudderControl);
217 fgTie("/autopilot/control-overrides/elevator",
218 getAPElevatorControl, setAPElevatorControl);
219 fgTie("/autopilot/control-overrides/throttle",
220 getAPThrottleControl, setAPThrottleControl);
223 fgTie("/environment/visibility", getVisibility, setVisibility);
224 fgTie("/environment/wind-north", getWindNorth, setWindNorth);
225 fgTie("/environment/wind-east", getWindEast, setWindEast);
226 fgTie("/environment/wind-down", getWindDown, setWindDown);
229 fgTie("/sim/field-of-view", getFOV, setFOV);
230 fgTie("/sim/view/axes/long", (double(*)())0, setViewAxisLong);
231 fgTie("/sim/view/axes/lat", (double(*)())0, setViewAxisLat);
235 SG_LOG(SG_GENERAL, SG_INFO, "Ending BFI init");
240 * Reinitialize FGFS if required.
242 * Some changes (especially those in aircraft position) require that
243 * FGFS be reinitialized afterwards. Rather than reinitialize after
244 * every change, the setter methods simply set a flag so that there
245 * can be a single reinit at the end of the frame.
250 _set_view_from_axes();
258 ////////////////////////////////////////////////////////////////////////
260 ////////////////////////////////////////////////////////////////////////
264 * Return the current aircraft directory (UIUC) as a string.
267 FGBFI::getAircraftDir ()
274 * Set the current aircraft directory (UIUC).
277 FGBFI::setAircraftDir (string dir)
279 if (getAircraftDir() != dir) {
287 * Get the current view offset in degrees.
290 FGBFI::getViewOffset ()
292 return (globals->get_current_view()
293 ->get_view_offset() * SGD_RADIANS_TO_DEGREES);
297 FGBFI::setViewOffset (double offset)
299 globals->get_current_view()->set_view_offset(offset * SGD_DEGREES_TO_RADIANS);
303 FGBFI::getGoalViewOffset ()
305 return (globals->get_current_view()
306 ->get_goal_view_offset() * SGD_RADIANS_TO_DEGREES);
310 FGBFI::setGoalViewOffset (double offset)
312 globals->get_current_view()
313 ->set_goal_view_offset(offset * SGD_DEGREES_TO_RADIANS);
320 * Return the current Zulu time.
323 FGBFI::getDateString ()
327 struct tm * t = globals->get_time_params()->getGmt();
328 sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
329 t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
330 t->tm_hour, t->tm_min, t->tm_sec);
337 * Set the current Zulu time.
340 FGBFI::setDateString (string date_string)
341 // FGBFI::setTimeGMT (time_t time)
343 SGTime * st = globals->get_time_params();
344 struct tm * current_time = st->getGmt();
347 // Scan for basic ISO format
348 // YYYY-MM-DDTHH:MM:SS
349 int ret = sscanf(date_string.c_str(), "%d-%d-%dT%d:%d:%d",
350 &(new_time.tm_year), &(new_time.tm_mon),
351 &(new_time.tm_mday), &(new_time.tm_hour),
352 &(new_time.tm_min), &(new_time.tm_sec));
354 // Be pretty picky about this, so
355 // that strange things don't happen
356 // if the save file has been edited
359 SG_LOG(SG_INPUT, SG_ALERT, "Date/time string " << date_string
360 << " not in YYYY-MM-DDTHH:MM:SS format; skipped");
364 // OK, it looks like we got six
365 // values, one way or another.
366 new_time.tm_year -= 1900;
367 new_time.tm_mon -= 1;
369 // Now, tell flight gear to use
370 // the new time. This was far
371 // too difficult, by the way.
373 mktime(&new_time) - mktime(current_time) + globals->get_warp();
374 double lon = current_aircraft.fdm_state->get_Longitude();
375 double lat = current_aircraft.fdm_state->get_Latitude();
376 // double alt = current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER;
377 globals->set_warp(warp);
378 st->update(lon, lat, warp);
379 fgUpdateSkyAndLightingParams();
384 * Return the GMT as a string.
387 FGBFI::getGMTString ()
391 struct tm * t = globals->get_time_params()->getGmt();
392 sprintf(buf, " %.2d:%.2d:%.2d",
393 t->tm_hour, t->tm_min, t->tm_sec);
400 ////////////////////////////////////////////////////////////////////////
402 ////////////////////////////////////////////////////////////////////////
406 * Return the current latitude in degrees (negative for south).
409 FGBFI::getLatitude ()
411 return current_aircraft.fdm_state->get_Latitude() * SGD_RADIANS_TO_DEGREES;
416 * Set the current latitude in degrees (negative for south).
419 FGBFI::setLatitude (double latitude)
421 current_aircraft.fdm_state->set_Latitude(latitude * SGD_DEGREES_TO_RADIANS);
426 * Return the current longitude in degrees (negative for west).
429 FGBFI::getLongitude ()
431 return current_aircraft.fdm_state->get_Longitude() * SGD_RADIANS_TO_DEGREES;
436 * Set the current longitude in degrees (negative for west).
439 FGBFI::setLongitude (double longitude)
441 current_aircraft.fdm_state->set_Longitude(longitude * SGD_DEGREES_TO_RADIANS);
446 * Return the current altitude in feet.
449 FGBFI::getAltitude ()
451 return current_aircraft.fdm_state->get_Altitude();
457 * Return the current altitude in above the terrain.
462 return current_aircraft.fdm_state->get_Altitude()
463 - (scenery.cur_elev * SG_METER_TO_FEET);
468 * Set the current altitude in feet.
471 FGBFI::setAltitude (double altitude)
473 current_aircraft.fdm_state->set_Altitude(altitude);
478 ////////////////////////////////////////////////////////////////////////
480 ////////////////////////////////////////////////////////////////////////
484 * Return the current heading in degrees.
489 return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES;
494 * Return the current heading in degrees.
497 FGBFI::getHeadingMag ()
499 return current_aircraft.fdm_state->get_Psi() * SGD_RADIANS_TO_DEGREES - getMagVar();
504 * Set the current heading in degrees.
507 FGBFI::setHeading (double heading)
509 FGInterface * fdm = current_aircraft.fdm_state;
510 fdm->set_Euler_Angles(fdm->get_Phi(), fdm->get_Theta(),
511 heading * SGD_DEGREES_TO_RADIANS);
516 * Return the current pitch in degrees.
521 return current_aircraft.fdm_state->get_Theta() * SGD_RADIANS_TO_DEGREES;
526 * Set the current pitch in degrees.
529 FGBFI::setPitch (double pitch)
531 FGInterface * fdm = current_aircraft.fdm_state;
532 fdm->set_Euler_Angles(fdm->get_Phi(), pitch * SGD_DEGREES_TO_RADIANS, fdm->get_Psi());
537 * Return the current roll in degrees.
542 return current_aircraft.fdm_state->get_Phi() * SGD_RADIANS_TO_DEGREES;
547 * Set the current roll in degrees.
550 FGBFI::setRoll (double roll)
552 FGInterface * fdm = current_aircraft.fdm_state;
553 fdm->set_Euler_Angles(roll * SGD_DEGREES_TO_RADIANS, fdm->get_Theta(), fdm->get_Psi());
558 * Return the current engine0 rpm
563 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
564 return current_aircraft.fdm_state->get_engine(0)->get_RPM();
572 * Set the current engine0 rpm
575 FGBFI::setRPM (double rpm)
577 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
578 if (getRPM() != rpm) {
579 current_aircraft.fdm_state->get_engine(0)->set_RPM( rpm );
586 * Return the current engine0 EGT.
591 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
592 return current_aircraft.fdm_state->get_engine(0)->get_EGT();
600 * Return the current engine0 CHT.
605 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
606 return current_aircraft.fdm_state->get_engine(0)->get_CHT();
614 * Return the current engine0 Manifold Pressure.
619 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
620 return current_aircraft.fdm_state->get_engine(0)->get_Manifold_Pressure();
627 * Return the current engine0 fuel flow
630 FGBFI::getFuelFlow ()
632 if ( current_aircraft.fdm_state->get_engine(0) != NULL ) {
633 return current_aircraft.fdm_state->get_engine(0)->get_Fuel_Flow();
639 ////////////////////////////////////////////////////////////////////////
641 ////////////////////////////////////////////////////////////////////////
644 * Return the fuel level in tank 1
647 FGBFI::getTank1Fuel ()
649 return current_aircraft.fdm_state->get_Tank1Fuel();
653 FGBFI::setTank1Fuel ( double gals )
655 current_aircraft.fdm_state->set_Tank1Fuel( gals );
659 * Return the fuel level in tank 2
662 FGBFI::getTank2Fuel ()
664 return current_aircraft.fdm_state->get_Tank2Fuel();
668 FGBFI::setTank2Fuel ( double gals )
670 current_aircraft.fdm_state->set_Tank2Fuel( gals );
674 ////////////////////////////////////////////////////////////////////////
676 ////////////////////////////////////////////////////////////////////////
680 * Return the current airspeed in knots.
683 FGBFI::getAirspeed ()
685 // FIXME: should we add speed-up?
686 return current_aircraft.fdm_state->get_V_calibrated_kts();
691 * Set the calibrated airspeed in knots.
694 FGBFI::setAirspeed (double speed)
696 current_aircraft.fdm_state->set_V_calibrated_kts(speed);
701 * Return the current sideslip (FIXME: units unknown).
704 FGBFI::getSideSlip ()
706 return current_aircraft.fdm_state->get_Beta();
711 * Return the current climb rate in feet/minute
714 FGBFI::getVerticalSpeed ()
716 // What about meters?
717 return current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
722 * Get the current north velocity (units??).
725 FGBFI::getSpeedNorth ()
727 return current_aircraft.fdm_state->get_V_north();
732 // * Set the current north velocity (units??).
735 // FGBFI::setSpeedNorth (double speed)
737 // FGInterface * fdm = current_aircraft.fdm_state;
738 // // fdm->set_Velocities_Local(speed, fdm->get_V_east(), fdm->get_V_down());
743 * Get the current east velocity (units??).
746 FGBFI::getSpeedEast ()
748 return current_aircraft.fdm_state->get_V_east();
753 // * Set the current east velocity (units??).
756 // FGBFI::setSpeedEast (double speed)
758 // FGInterface * fdm = current_aircraft.fdm_state;
759 // // fdm->set_Velocities_Local(fdm->get_V_north(), speed, fdm->get_V_down());
764 * Get the current down velocity (units??).
767 FGBFI::getSpeedDown ()
769 return current_aircraft.fdm_state->get_V_down();
774 // * Set the current down velocity (units??).
777 // FGBFI::setSpeedDown (double speed)
779 // FGInterface * fdm = current_aircraft.fdm_state;
780 // // fdm->set_Velocities_Local(fdm->get_V_north(), fdm->get_V_east(), speed);
785 ////////////////////////////////////////////////////////////////////////
787 ////////////////////////////////////////////////////////////////////////
791 * Get the autopilot altitude lock (true=on).
794 FGBFI::getAPAltitudeLock ()
796 return current_autopilot->get_AltitudeEnabled();
801 * Set the autopilot altitude lock (true=on).
804 FGBFI::setAPAltitudeLock (bool lock)
806 current_autopilot->set_AltitudeMode(FGAutopilot::FG_ALTITUDE_LOCK);
807 current_autopilot->set_AltitudeEnabled(lock);
812 * Get the autopilot altitude lock (true=on).
815 FGBFI::getAPGSLock ()
817 return current_autopilot->get_AltitudeEnabled();
822 * Set the autopilot altitude lock (true=on).
825 FGBFI::setAPGSLock (bool lock)
827 current_autopilot->set_AltitudeMode(FGAutopilot::FG_ALTITUDE_GS1);
828 current_autopilot->set_AltitudeEnabled(lock);
833 * Get the autopilot target altitude in feet.
836 FGBFI::getAPAltitude ()
838 return current_autopilot->get_TargetAltitude() * SG_METER_TO_FEET;
843 * Set the autopilot target altitude in feet.
846 FGBFI::setAPAltitude (double altitude)
848 current_autopilot->set_TargetAltitude( altitude * SG_FEET_TO_METER );
853 * Get the autopilot target altitude in feet.
858 return current_autopilot->get_TargetClimbRate() * SG_METER_TO_FEET;
863 * Set the autopilot target altitude in feet.
866 FGBFI::setAPClimb (double rate)
868 current_autopilot->set_TargetClimbRate( rate * SG_FEET_TO_METER );
873 * Get the autopilot heading lock (true=on).
876 FGBFI::getAPHeadingLock ()
879 (current_autopilot->get_HeadingEnabled() &&
880 current_autopilot->get_HeadingMode() == DEFAULT_AP_HEADING_LOCK);
885 * Set the autopilot heading lock (true=on).
888 FGBFI::setAPHeadingLock (bool lock)
891 current_autopilot->set_HeadingMode(DEFAULT_AP_HEADING_LOCK);
892 current_autopilot->set_HeadingEnabled(true);
894 current_autopilot->set_HeadingEnabled(false);
900 * Get the autopilot heading bug in degrees.
903 FGBFI::getAPHeadingBug ()
905 return current_autopilot->get_DGTargetHeading();
910 * Set the autopilot heading bug in degrees.
913 FGBFI::setAPHeadingBug (double heading)
915 current_autopilot->set_DGTargetHeading( heading );
920 * Get the autopilot wing leveler lock (true=on).
923 FGBFI::getAPWingLeveler ()
926 (current_autopilot->get_HeadingEnabled() &&
927 current_autopilot->get_HeadingMode() == FGAutopilot::FG_TC_HEADING_LOCK);
932 * Set the autopilot wing leveler lock (true=on).
935 FGBFI::setAPWingLeveler (bool lock)
938 current_autopilot->set_HeadingMode(FGAutopilot::FG_TC_HEADING_LOCK);
939 current_autopilot->set_HeadingEnabled(true);
941 current_autopilot->set_HeadingEnabled(false);
947 * Return true if the autopilot is locked to NAV1.
950 FGBFI::getAPNAV1Lock ()
953 (current_autopilot->get_HeadingEnabled() &&
954 current_autopilot->get_HeadingMode() == FGAutopilot::FG_HEADING_NAV1);
959 * Set the autopilot NAV1 lock.
962 FGBFI::setAPNAV1Lock (bool lock)
965 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_NAV1);
966 current_autopilot->set_HeadingEnabled(true);
967 } else if (current_autopilot->get_HeadingMode() ==
968 FGAutopilot::FG_HEADING_NAV1) {
969 current_autopilot->set_HeadingEnabled(false);
974 * Get the autopilot autothrottle lock.
977 FGBFI::getAPAutoThrottleLock ()
979 return current_autopilot->get_AutoThrottleEnabled();
984 * Set the autothrottle lock.
987 FGBFI::setAPAutoThrottleLock (bool lock)
989 current_autopilot->set_AutoThrottleEnabled(lock);
995 FGBFI::getAPRudderControl ()
997 if (getAPHeadingLock())
998 return current_autopilot->get_TargetHeading();
1000 return controls.get_rudder();
1005 FGBFI::setAPRudderControl (double value)
1007 if (getAPHeadingLock()) {
1008 SG_LOG(SG_GENERAL, SG_DEBUG, "setAPRudderControl " << value );
1009 value -= current_autopilot->get_TargetHeading();
1010 current_autopilot->HeadingAdjust(value < 0.0 ? -1.0 : 1.0);
1012 controls.set_rudder(value);
1018 FGBFI::getAPElevatorControl ()
1020 if (getAPAltitudeLock())
1021 return current_autopilot->get_TargetAltitude();
1023 return controls.get_elevator();
1028 FGBFI::setAPElevatorControl (double value)
1030 if (getAPAltitudeLock()) {
1031 SG_LOG(SG_GENERAL, SG_DEBUG, "setAPElevatorControl " << value );
1032 value -= current_autopilot->get_TargetAltitude();
1033 current_autopilot->AltitudeAdjust(value < 0.0 ? 100.0 : -100.0);
1035 controls.set_elevator(value);
1041 FGBFI::getAPThrottleControl ()
1043 if (getAPAutoThrottleLock())
1044 return 0.0; // always resets
1046 return controls.get_throttle(0);
1051 FGBFI::setAPThrottleControl (double value)
1053 if (getAPAutoThrottleLock())
1054 current_autopilot->AutoThrottleAdjust(value < 0.0 ? -0.01 : 0.01);
1056 controls.set_throttle(0, value);
1061 ////////////////////////////////////////////////////////////////////////
1063 ////////////////////////////////////////////////////////////////////////
1067 * Get the autopilot GPS lock (true=on).
1070 FGBFI::getGPSLock ()
1072 return (current_autopilot->get_HeadingEnabled() &&
1073 (current_autopilot->get_HeadingMode() ==
1074 FGAutopilot::FG_HEADING_WAYPOINT ));
1079 * Set the autopilot GPS lock (true=on).
1082 FGBFI::setGPSLock (bool lock)
1085 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_WAYPOINT);
1086 current_autopilot->set_HeadingEnabled(true);
1087 } else if (current_autopilot->get_HeadingMode() ==
1088 FGAutopilot::FG_HEADING_WAYPOINT) {
1089 current_autopilot->set_HeadingEnabled(false);
1095 * Get the GPS target latitude in degrees (negative for south).
1098 FGBFI::getGPSTargetLatitude ()
1100 return current_autopilot->get_TargetLatitude();
1105 * Get the GPS target longitude in degrees (negative for west).
1108 FGBFI::getGPSTargetLongitude ()
1110 return current_autopilot->get_TargetLongitude();
1115 ////////////////////////////////////////////////////////////////////////
1117 ////////////////////////////////////////////////////////////////////////
1121 * Get the current visibility (meters).
1124 FGBFI::getVisibility ()
1126 #ifndef FG_OLD_WEATHER
1127 return WeatherDatabase->getWeatherVisibility();
1129 return current_weather.get_visibility();
1135 * Set the current visibility (meters).
1138 FGBFI::setVisibility (double visibility)
1140 #ifndef FG_OLD_WEATHER
1141 WeatherDatabase->setWeatherVisibility(visibility);
1143 current_weather.set_visibility(visibility);
1149 * Get the current wind north velocity (feet/second).
1152 FGBFI::getWindNorth ()
1154 return current_aircraft.fdm_state->get_V_north_airmass();
1159 * Set the current wind north velocity (feet/second).
1162 FGBFI::setWindNorth (double speed)
1164 current_aircraft.fdm_state->set_Velocities_Local_Airmass(speed,
1171 * Get the current wind east velocity (feet/second).
1174 FGBFI::getWindEast ()
1176 return current_aircraft.fdm_state->get_V_east_airmass();
1181 * Set the current wind east velocity (feet/second).
1184 FGBFI::setWindEast (double speed)
1186 cout << "Set wind-east to " << speed << endl;
1187 current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
1194 * Get the current wind down velocity (feet/second).
1197 FGBFI::getWindDown ()
1199 return current_aircraft.fdm_state->get_V_down_airmass();
1204 * Set the current wind down velocity (feet/second).
1207 FGBFI::setWindDown (double speed)
1209 current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
1216 ////////////////////////////////////////////////////////////////////////
1218 ////////////////////////////////////////////////////////////////////////
1223 return globals->get_current_view()->get_fov();
1227 FGBFI::setFOV (double fov)
1229 globals->get_current_view()->set_fov( fov );
1233 FGBFI::setViewAxisLong (double axis)
1239 FGBFI::setViewAxisLat (double axis)
1245 ////////////////////////////////////////////////////////////////////////
1247 ////////////////////////////////////////////////////////////////////////
1250 * Return the magnetic variation
1255 return globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES;
1260 * Return the magnetic variation
1265 return globals->get_mag()->get_magdip() * SGD_RADIANS_TO_DEGREES;