1 // fg_init.cxx -- Flight Gear top level initialization routines
3 // Written by Curtis Olson, started August 1997.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
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., 675 Mass Ave, Cambridge, MA 02139, USA.
29 // For BC 5.01 this must be included before OpenGL includes.
30 #ifdef SG_MATH_EXCEPTION_CLASH
44 #if defined( unix ) || defined( __CYGWIN__ )
45 # include <unistd.h> // for gethostname()
48 // work around a stdc++ lib bug in some versions of linux, but doesn't
49 // seem to hurt to have this here for all versions of Linux.
51 # define _G_NO_EXTERN_TEMPLATES
54 #include <simgear/compiler.h>
58 #include <simgear/constants.h>
59 #include <simgear/debug/logstream.hxx>
60 #include <simgear/math/point3d.hxx>
61 #include <simgear/math/polar3d.hxx>
62 #include <simgear/math/sg_geodesy.hxx>
63 #include <simgear/misc/sg_path.hxx>
64 #include <simgear/timing/sg_time.hxx>
66 #include <Aircraft/aircraft.hxx>
67 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
68 #include <Airports/runways.hxx>
69 #include <Airports/simple.hxx>
70 #include <Autopilot/auto_gui.hxx>
71 #include <Autopilot/newauto.hxx>
72 #include <Cockpit/cockpit.hxx>
73 #include <Cockpit/radiostack.hxx>
74 #include <Cockpit/panel.hxx>
75 #include <Cockpit/panel_io.hxx>
76 #include <FDM/ADA.hxx>
77 #include <FDM/Balloon.h>
78 #include <FDM/External.hxx>
79 #include <FDM/JSBSim.hxx>
80 #include <FDM/LaRCsim.hxx>
81 #include <FDM/MagicCarpet.hxx>
82 #include <Include/general.hxx>
83 #include <Joystick/joystick.hxx>
84 #include <Objects/matlib.hxx>
85 #include <Navaids/fixlist.hxx>
86 #include <Navaids/ilslist.hxx>
87 #include <Navaids/mkrbeacons.hxx>
88 #include <Navaids/navlist.hxx>
89 #include <Scenery/scenery.hxx>
90 #include <Scenery/tilemgr.hxx>
91 #include <Time/event.hxx>
92 #include <Time/light.hxx>
93 #include <Time/sunpos.hxx>
94 #include <Time/moonpos.hxx>
95 #include <Time/tmp.hxx>
97 #ifndef FG_OLD_WEATHER
98 # include <WeatherCM/FGLocalWeatherDatabase.h>
100 # include <Weather/weather.hxx>
103 #include "fg_init.hxx"
105 #include "options.hxx"
106 #include "globals.hxx"
109 #if defined(FX) && defined(XMESA)
110 #include <GL/xmesa.h>
113 SG_USING_STD(string);
115 extern const char *default_root;
118 // Read in configuration (file and command line) and just set fg_root
119 bool fgInitFGRoot ( int argc, char **argv ) {
123 // First parse command line options looking for fg-root, this will
124 // override anything specified in a config file
125 root = fgScanForRoot(argc, argv);
127 #if defined( unix ) || defined( __CYGWIN__ )
128 // Next check home directory for .fgfsrc.hostname file
130 envp = ::getenv( "HOME" );
131 if ( envp != NULL ) {
132 SGPath config( envp );
133 config.append( ".fgfsrc" );
135 gethostname( name, 256 );
136 config.concat( "." );
137 config.concat( name );
138 root = fgScanForRoot(config.str());
143 // Next check home directory for .fgfsrc file
145 envp = ::getenv( "HOME" );
146 if ( envp != NULL ) {
147 SGPath config( envp );
148 config.append( ".fgfsrc" );
149 root = fgScanForRoot(config.str());
153 // Next check if fg-root is set as an env variable
155 envp = ::getenv( "FG_ROOT" );
156 if ( envp != NULL ) {
161 // Otherwise, default to a random compiled-in location if we can't
162 // find fg-root any other way.
164 #if defined( __CYGWIN__ )
165 root = "/FlightGear";
166 #elif defined( WIN32 )
167 root = "\\FlightGear";
168 #elif defined( macintosh )
175 SG_LOG(SG_INPUT, SG_INFO, "fg_root = " << root );
176 globals->set_fg_root(root);
182 // Read in configuration (file and command line)
183 bool fgInitConfig ( int argc, char **argv ) {
185 // First, set some sane default values
188 // Read global preferences from $FG_ROOT/preferences.xml
189 SGPath props_path(globals->get_fg_root());
190 props_path.append("preferences.xml");
191 SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
192 if (!readProperties(props_path.str(), globals->get_props())) {
193 SG_LOG(SG_INPUT, SG_ALERT, "Failed to read global preferences from "
194 << props_path.str());
196 SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
199 // Attempt to locate and parse the various config files in order
200 // from least precidence to greatest precidence
202 // Check for $fg_root/system.fgfsrc
203 SGPath config( globals->get_fg_root() );
204 config.append( "system.fgfsrc" );
205 fgParseOptions(config.str());
208 #if defined( unix ) || defined( __CYGWIN__ )
209 // Check for $fg_root/system.fgfsrc.hostname
210 gethostname( name, 256 );
211 config.concat( "." );
212 config.concat( name );
213 fgParseOptions(config.str());
216 // Check for ~/.fgfsrc
217 char* envp = ::getenv( "HOME" );
218 if ( envp != NULL ) {
220 config.append( ".fgfsrc" );
221 fgParseOptions(config.str());
224 #if defined( unix ) || defined( __CYGWIN__ )
225 // Check for ~/.fgfsrc.hostname
226 gethostname( name, 256 );
227 config.concat( "." );
228 config.concat( name );
229 fgParseOptions(config.str());
232 // Parse remaining command line options
233 // These will override anything specified in a config file
234 fgParseOptions(argc, argv);
240 // find basic airport location info from airport database
241 bool fgFindAirportID( const string& id, FGAirport *a ) {
243 SGPath path( globals->get_fg_root() );
244 path.append( "Airports" );
245 path.append( "simple.mk4" );
246 FGAirports airports( path.c_str() );
248 SG_LOG( SG_GENERAL, SG_INFO, "Searching for airport code = " << id );
250 if ( ! airports.search( id, a ) ) {
251 SG_LOG( SG_GENERAL, SG_ALERT,
252 "Failed to find " << id << " in " << path.str() );
259 SG_LOG( SG_GENERAL, SG_INFO,
260 "Position for " << id << " is ("
261 << a->longitude << ", "
262 << a->latitude << ")" );
268 // Set current_options lon/lat given an airport id
269 bool fgSetPosFromAirportID( const string& id ) {
273 SG_LOG( SG_GENERAL, SG_INFO,
274 "Attempting to set starting position from airport code " << id );
276 if ( fgFindAirportID( id, &a ) ) {
277 fgSetDouble("/position/longitude", a.longitude );
278 fgSetDouble("/position/latitude", a.latitude );
279 SG_LOG( SG_GENERAL, SG_INFO,
280 "Position for " << id << " is ("
281 << a.longitude << ", "
282 << a.latitude << ")" );
292 // Set current_options lon/lat given an airport id and heading (degrees)
293 bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
296 double found_dir = 0.0;
299 // set initial position from runway and heading
301 SGPath path( globals->get_fg_root() );
302 path.append( "Airports" );
303 path.append( "runways.mk4" );
304 FGRunways runways( path.c_str() );
306 SG_LOG( SG_GENERAL, SG_INFO,
307 "Attempting to set starting position from runway code "
308 << id << " heading " << tgt_hdg );
310 // SGPath inpath( globals->get_fg_root() );
311 // inpath.append( "Airports" );
312 // inpath.append( "apt_simple" );
313 // airports.load( inpath.c_str() );
315 // SGPath outpath( globals->get_fg_root() );
316 // outpath.append( "Airports" );
317 // outpath.append( "simple.gdbm" );
318 // airports.dump_gdbm( outpath.c_str() );
320 if ( ! runways.search( id, &r ) ) {
321 SG_LOG( SG_GENERAL, SG_ALERT,
322 "Failed to find " << id << " in database." );
327 double min_diff = 360.0;
329 while ( r.id == id ) {
331 diff = tgt_hdg - r.heading;
332 while ( diff < -180.0 ) { diff += 360.0; }
333 while ( diff > 180.0 ) { diff -= 360.0; }
335 SG_LOG( SG_GENERAL, SG_INFO,
336 "Runway " << r.rwy_no << " heading = " << r.heading <<
337 " diff = " << diff );
338 if ( diff < min_diff ) {
345 diff = tgt_hdg - r.heading - 180.0;
346 while ( diff < -180.0 ) { diff += 360.0; }
347 while ( diff > 180.0 ) { diff -= 360.0; }
349 SG_LOG( SG_GENERAL, SG_INFO,
350 "Runway -" << r.rwy_no << " heading = " <<
352 " diff = " << diff );
353 if ( diff < min_diff ) {
362 SG_LOG( SG_GENERAL, SG_INFO, "closest runway = " << found_r.rwy_no
363 << " + " << found_dir );
369 double heading = found_r.heading + found_dir;
370 while ( heading >= 360.0 ) { heading -= 360.0; }
372 double lat2, lon2, az2;
373 double azimuth = found_r.heading + found_dir + 180.0;
374 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
376 SG_LOG( SG_GENERAL, SG_INFO,
377 "runway = " << found_r.lon << ", " << found_r.lat
378 << " length = " << found_r.length * SG_FEET_TO_METER * 0.5
379 << " heading = " << azimuth );
381 geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon,
382 azimuth, found_r.length * SG_FEET_TO_METER * 0.5 - 5.0,
383 &lat2, &lon2, &az2 );
385 if ( fabs( fgGetDouble("/sim/startup/offset-distance") ) > SG_EPSILON ) {
387 double odist = fgGetDouble("/sim/startup/offset-distance");
388 odist *= SG_NM_TO_METER;
389 double oaz = azimuth;
390 if ( fabs(fgGetDouble("/sim/startup/offset-azimuth")) > SG_EPSILON ) {
391 oaz = fgGetDouble("/sim/startup/offset-azimuth") + 180;
393 while ( oaz >= 360.0 ) { oaz -= 360.0; }
394 geo_direct_wgs_84 ( 0, lat2, lon2, oaz, odist, &olat, &olon, &az2 );
398 fgSetDouble("/position/longitude", lon2 );
399 fgSetDouble("/position/latitude", lat2 );
400 fgSetDouble("/orientation/heading", heading );
402 SG_LOG( SG_GENERAL, SG_INFO,
403 "Position for " << id << " is ("
405 << lat2 << ") new heading is "
412 // General house keeping initializations
413 bool fgInitGeneral( void ) {
416 #if defined(FX) && defined(XMESA)
417 char *mesa_win_state;
420 SG_LOG( SG_GENERAL, SG_INFO, "General Initialization" );
421 SG_LOG( SG_GENERAL, SG_INFO, "======= ==============" );
423 root = globals->get_fg_root();
424 if ( ! root.length() ) {
425 // No root path set? Then bail ...
426 SG_LOG( SG_GENERAL, SG_ALERT,
427 "Cannot continue without environment variable FG_ROOT"
428 << "being defined." );
431 SG_LOG( SG_GENERAL, SG_INFO, "FG_ROOT = " << '"' << root << '"' << endl );
433 #if defined(FX) && defined(XMESA)
434 // initialize full screen flag
435 global_fullscreen = false;
436 if ( strstr ( general.get_glRenderer(), "Glide" ) ) {
437 // Test for the MESA_GLX_FX env variable
438 if ( (mesa_win_state = getenv( "MESA_GLX_FX" )) != NULL) {
439 // test if we are fullscreen mesa/glide
440 if ( (mesa_win_state[0] == 'f') ||
441 (mesa_win_state[0] == 'F') ) {
442 global_fullscreen = true;
452 // This is the top level init routine which calls all the other
453 // initialization routines. If you are adding a subsystem to flight
454 // gear, its initialization call should located in this routine.
455 // Returns non-zero if a problem encountered.
456 bool fgInitSubsystems( void ) {
457 fgLIGHT *l = &cur_light_params;
459 SG_LOG( SG_GENERAL, SG_INFO, "Initialize Subsystems");
460 SG_LOG( SG_GENERAL, SG_INFO, "========== ==========");
463 ////////////////////////////////////////////////////////////////////
464 // Initialize the material property subsystem.
465 ////////////////////////////////////////////////////////////////////
467 SGPath mpath( globals->get_fg_root() );
468 mpath.append( "materials" );
469 if ( material_lib.load( mpath.str() ) ) {
471 SG_LOG( SG_GENERAL, SG_ALERT, "Error loading material lib!" );
476 ////////////////////////////////////////////////////////////////////
477 // Initialize the scenery management subsystem.
478 ////////////////////////////////////////////////////////////////////
480 if ( fgSceneryInit() ) {
481 // Material lib initialized ok.
483 SG_LOG( SG_GENERAL, SG_ALERT, "Error in Scenery initialization!" );
487 if ( global_tile_mgr.init() ) {
488 // Load the local scenery data
489 global_tile_mgr.update( fgGetDouble("/position/longitude"),
490 fgGetDouble("/position/latitude") );
492 SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
496 SG_LOG( SG_GENERAL, SG_DEBUG,
497 "Current terrain elevation after tile mgr init " <<
501 ////////////////////////////////////////////////////////////////////
502 // Initialize the flight model subsystem.
503 ////////////////////////////////////////////////////////////////////
505 double dt = 1.0 / fgGetInt("/sim/model-hz");
506 // cout << "dt = " << dt << endl;
508 aircraft_dir = fgGetString("/sim/aircraft-dir");
509 const string &model = fgGetString("/sim/flight-model");
510 if (model == "larcsim") {
511 cur_fdm_state = new FGLaRCsim( dt );
512 } else if (model == "jsb") {
513 cur_fdm_state = new FGJSBsim( dt );
514 } else if (model == "ada") {
515 cur_fdm_state = new FGADA( dt );
516 } else if (model == "balloon") {
517 cur_fdm_state = new FGBalloonSim( dt );
518 } else if (model == "magic") {
519 cur_fdm_state = new FGMagicCarpet( dt );
520 } else if (model == "external") {
521 cur_fdm_state = new FGExternal( dt );
523 SG_LOG(SG_GENERAL, SG_ALERT,
524 "Unrecognized flight model '" << model
525 << ", can't init aircraft");
528 cur_fdm_state->init();
529 cur_fdm_state->bind();
531 // allocates structures so must happen before any of the flight
532 // model or control parameters are set
533 fgAircraftInit(); // In the future this might not be the case.
536 ////////////////////////////////////////////////////////////////////
537 // Initialize the event manager subsystem.
538 ////////////////////////////////////////////////////////////////////
540 global_events.Init();
542 // Output event stats every 60 seconds
543 global_events.Register( "fgEVENT_MGR::PrintStats()",
544 fgMethodCallback<fgEVENT_MGR>( &global_events,
545 &fgEVENT_MGR::PrintStats),
546 fgEVENT::FG_EVENT_READY, 60000 );
549 ////////////////////////////////////////////////////////////////////
550 // Initialize the view manager subsystem.
551 ////////////////////////////////////////////////////////////////////
553 // Initialize win_ratio parameters
554 for ( int i = 0; i < globals->get_viewmgr()->size(); ++i ) {
555 globals->get_viewmgr()->get_view(i)->
556 set_win_ratio( fgGetInt("/sim/startup/xsize") /
557 fgGetInt("/sim/startup/ysize") );
560 // Initialize pilot view
561 FGViewerRPH *pilot_view =
562 (FGViewerRPH *)globals->get_viewmgr()->get_view( 0 );
564 pilot_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
565 cur_fdm_state->get_Lat_geocentric(),
566 cur_fdm_state->get_Altitude() *
568 pilot_view->set_sea_level_radius( cur_fdm_state->get_Sea_level_radius() *
570 pilot_view->set_rph( cur_fdm_state->get_Phi(),
571 cur_fdm_state->get_Theta(),
572 cur_fdm_state->get_Psi() );
574 // set current view to 0 (first) which is our main pilot view
575 globals->set_current_view( pilot_view );
577 SG_LOG( SG_GENERAL, SG_DEBUG, " abs_view_pos = "
578 << globals->get_current_view()->get_abs_view_pos());
581 ////////////////////////////////////////////////////////////////////
582 // Initialize the lighting subsystem.
583 ////////////////////////////////////////////////////////////////////
585 // fgUpdateSunPos() needs a few position and view parameters set
586 // so it can calculate local relative sun angle and a few other
587 // things for correctly orienting the sky.
590 global_events.Register( "fgUpdateSunPos()", fgUpdateSunPos,
591 fgEVENT::FG_EVENT_READY, 60000);
592 global_events.Register( "fgUpdateMoonPos()", fgUpdateMoonPos,
593 fgEVENT::FG_EVENT_READY, 60000);
595 // Initialize Lighting interpolation tables
598 // update the lighting parameters (based on sun angle)
599 global_events.Register( "fgLight::Update()",
600 fgMethodCallback<fgLIGHT>( &cur_light_params,
602 fgEVENT::FG_EVENT_READY, 30000 );
605 ////////////////////////////////////////////////////////////////////
606 // Initialize the local time subsystem.
607 ////////////////////////////////////////////////////////////////////
609 // update the current timezone each 30 minutes
610 global_events.Register( "fgUpdateLocalTime()", fgUpdateLocalTime,
611 fgEVENT::FG_EVENT_READY, 1800000);
614 ////////////////////////////////////////////////////////////////////
615 // Initialize the weather subsystem.
616 ////////////////////////////////////////////////////////////////////
618 // Initialize the weather modeling subsystem
619 #ifndef FG_OLD_WEATHER
620 // Initialize the WeatherDatabase
621 SG_LOG(SG_GENERAL, SG_INFO, "Creating LocalWeatherDatabase");
623 sgSetVec3( position, current_aircraft.fdm_state->get_Latitude(),
624 current_aircraft.fdm_state->get_Longitude(),
625 current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER );
626 FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
627 new FGLocalWeatherDatabase( position,
628 globals->get_fg_root() );
629 // cout << theFGLocalWeatherDatabase << endl;
630 // cout << "visibility = "
631 // << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
633 WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
635 double init_vis = fgGetDouble("/environment/visibility");
636 if ( init_vis > 0 ) {
637 WeatherDatabase->setWeatherVisibility( init_vis );
640 // register the periodic update of the weather
641 global_events.Register( "weather update", fgUpdateWeatherDatabase,
642 fgEVENT::FG_EVENT_READY, 30000);
644 current_weather.Init();
647 ////////////////////////////////////////////////////////////////////
648 // Initialize vor/ndb/ils/fix list management and query systems
649 ////////////////////////////////////////////////////////////////////
651 SG_LOG(SG_GENERAL, SG_INFO, "Loading Navaids");
653 SG_LOG(SG_GENERAL, SG_INFO, " VOR/NDB");
654 current_navlist = new FGNavList;
655 SGPath p_nav( globals->get_fg_root() );
656 p_nav.append( "Navaids/default.nav" );
657 current_navlist->init( p_nav );
659 SG_LOG(SG_GENERAL, SG_INFO, " ILS and Marker Beacons");
660 current_beacons = new FGMarkerBeacons;
661 current_beacons->init();
662 current_ilslist = new FGILSList;
663 SGPath p_ils( globals->get_fg_root() );
664 p_ils.append( "Navaids/default.ils" );
665 current_ilslist->init( p_ils );
667 SG_LOG(SG_GENERAL, SG_INFO, " Fixes");
668 current_fixlist = new FGFixList;
669 SGPath p_fix( globals->get_fg_root() );
670 p_fix.append( "Navaids/default.fix" );
671 current_fixlist->init( p_fix );
674 ////////////////////////////////////////////////////////////////////
675 // Initialize the radio stack subsystem.
676 ////////////////////////////////////////////////////////////////////
678 // A textbook example of how FGSubsystem
680 current_radiostack = new FGRadioStack;
681 current_radiostack->init();
682 current_radiostack->bind();
685 ////////////////////////////////////////////////////////////////////
686 // Initialize the cockpit subsystem
687 ////////////////////////////////////////////////////////////////////
689 if( fgCockpitInit( ¤t_aircraft )) {
690 // Cockpit initialized ok.
692 SG_LOG( SG_GENERAL, SG_ALERT, "Error in Cockpit initialization!" );
697 ////////////////////////////////////////////////////////////////////
698 // Initialize the joystick subsystem.
699 ////////////////////////////////////////////////////////////////////
701 if ( ! fgJoystickInit() ) {
702 SG_LOG( SG_GENERAL, SG_ALERT, "Error in Joystick initialization!" );
706 ////////////////////////////////////////////////////////////////////
707 // Initialize the autopilot subsystem.
708 ////////////////////////////////////////////////////////////////////
710 current_autopilot = new FGAutopilot;
711 current_autopilot->init();
713 // initialize the gui parts of the autopilot
720 ////////////////////////////////////////////////////////////////////
721 // Initialize I/O subsystem.
722 ////////////////////////////////////////////////////////////////////
724 #if ! defined( macintosh )
728 // Initialize the 2D panel.
729 string panel_path = fgGetString("/sim/panel/path",
730 "Panels/Default/default.xml");
731 current_panel = fgReadPanel(panel_path);
732 if (current_panel == 0) {
733 SG_LOG( SG_INPUT, SG_ALERT,
734 "Error reading new panel from " << panel_path );
736 SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path );
737 current_panel->init();
738 current_panel->bind();
742 ////////////////////////////////////////////////////////////////////
743 // Initialize the BFI.
744 ////////////////////////////////////////////////////////////////////
749 ////////////////////////////////////////////////////////////////////
750 // Initialize the controls subsystem.
751 ////////////////////////////////////////////////////////////////////
757 ////////////////////////////////////////////////////////////////////////
758 // End of subsystem initialization.
759 ////////////////////////////////////////////////////////////////////
761 SG_LOG( SG_GENERAL, SG_INFO, endl);
763 // Save the initial state for future
765 globals->saveInitialState();
771 void fgReInitSubsystems( void )
773 SG_LOG( SG_GENERAL, SG_INFO,
774 "/position/altitude = " << fgGetDouble("/position/altitude") );
776 bool freeze = globals->get_freeze();
778 globals->set_freeze( true );
780 // Initialize the Scenery Management subsystem
781 if ( ! fgSceneryInit() ) {
782 SG_LOG( SG_GENERAL, SG_ALERT, "Error in Scenery initialization!" );
786 if( global_tile_mgr.init() ) {
787 // Load the local scenery data
788 global_tile_mgr.update( fgGetDouble("/position/longitude"),
789 fgGetDouble("/position/latitude") );
791 SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
795 // Initialize view parameters
796 FGViewerRPH *pilot_view =
797 (FGViewerRPH *)globals->get_viewmgr()->get_view( 0 );
799 pilot_view->set_view_offset( 0.0 );
800 pilot_view->set_goal_view_offset( 0.0 );
802 pilot_view->set_geod_view_pos( cur_fdm_state->get_Longitude(),
803 cur_fdm_state->get_Lat_geocentric(),
804 cur_fdm_state->get_Altitude() *
806 pilot_view->set_sea_level_radius( cur_fdm_state->get_Sea_level_radius() *
808 pilot_view->set_rph( cur_fdm_state->get_Phi(),
809 cur_fdm_state->get_Theta(),
810 cur_fdm_state->get_Psi() );
812 // set current view to 0 (first) which is our main pilot view
813 globals->set_current_view( pilot_view );
815 SG_LOG( SG_GENERAL, SG_DEBUG, " abs_view_pos = "
816 << globals->get_current_view()->get_abs_view_pos());
818 cur_fdm_state->init();
820 controls.reset_all();
821 current_autopilot->reset();
825 cur_light_params.Update();
829 globals->set_freeze( false );