2 // fg_init.cxx -- Flight Gear top level initialization routines
4 // Written by Curtis Olson, started August 1997.
6 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 // For BC 5.01 this must be included before OpenGL includes.
31 #ifdef FG_MATH_EXCEPTION_CLASH
36 #include <simgear/xgl/xgl.h>
41 // work around a stdc++ lib bug in some versions of linux, but doesn't
42 // seem to hurt to have this here for all versions of Linux.
44 # define _G_NO_EXTERN_TEMPLATES
47 #include <simgear/compiler.h>
51 #include <simgear/constants.h>
52 #include <simgear/debug/logstream.hxx>
53 #include <simgear/math/fg_geodesy.hxx>
54 #include <simgear/math/point3d.hxx>
55 #include <simgear/math/polar3d.hxx>
56 #include <simgear/misc/fgpath.hxx>
58 #include <Aircraft/aircraft.hxx>
59 #include <Airports/simple.hxx>
60 #include <Autopilot/auto_gui.hxx>
61 #include <Autopilot/newauto.hxx>
62 #include <Cockpit/cockpit.hxx>
63 #include <Cockpit/radiostack.hxx>
64 #include <Cockpit/panel.hxx>
65 #include <Cockpit/sp_panel.hxx>
66 #include <FDM/Balloon.h>
67 #include <FDM/External.hxx>
68 #include <FDM/JSBsim.hxx>
69 #include <FDM/LaRCsim.hxx>
70 #include <FDM/MagicCarpet.hxx>
71 #include <Include/general.hxx>
72 #include <Joystick/joystick.hxx>
73 #include <Objects/matlib.hxx>
74 #include <Navaids/fixlist.hxx>
75 #include <Navaids/ilslist.hxx>
76 #include <Navaids/navlist.hxx>
77 #include <Scenery/scenery.hxx>
78 #include <Scenery/tilemgr.hxx>
79 #include <Time/event.hxx>
80 #include <Time/fg_time.hxx>
81 #include <Time/light.hxx>
82 #include <Time/sunpos.hxx>
83 #include <Time/moonpos.hxx>
85 #ifndef FG_OLD_WEATHER
86 # include <WeatherCM/FGLocalWeatherDatabase.h>
88 # include <Weather/weather.hxx>
91 #include "fg_init.hxx"
93 #include "options.hxx"
97 #if defined(FX) && defined(XMESA)
101 FG_USING_STD(string);
103 extern const char *default_root;
106 // Read in configuration (file and command line)
107 bool fgInitConfig ( int argc, char **argv ) {
108 // Attempt to locate and parse a config file
109 // First check fg_root
110 FGPath config( current_options.get_fg_root() );
111 config.append( "system.fgfsrc" );
112 current_options.parse_config_file( config.str() );
114 // Next check home directory
115 char* envp = ::getenv( "HOME" );
116 if ( envp != NULL ) {
118 config.append( ".fgfsrc" );
119 current_options.parse_config_file( config.str() );
122 // Parse remaining command line options
123 // These will override anything specified in a config file
124 if ( current_options.parse_command_line(argc, argv) !=
125 fgOPTIONS::FG_OPTIONS_OK )
127 // Something must have gone horribly wrong with the command
128 // line parsing or maybe the user just requested help ... :-)
129 current_options.usage();
130 FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
138 // Set initial position and orientation
139 bool fgInitPosition( void ) {
143 f = current_aircraft.fdm_state;
145 id = current_options.get_airport_id();
147 // set initial position from airport id
149 FGPath path( current_options.get_fg_root() );
150 path.append( "Airports" );
151 path.append( "simple.mk4" );
152 FGAirports airports( path.c_str() );
155 FG_LOG( FG_GENERAL, FG_INFO,
156 "Attempting to set starting position from airport code "
159 // FGPath inpath( current_options.get_fg_root() );
160 // inpath.append( "Airports" );
161 // inpath.append( "apt_simple" );
162 // airports.load( inpath.c_str() );
164 // FGPath outpath( current_options.get_fg_root() );
165 // outpath.append( "Airports" );
166 // outpath.append( "simple.gdbm" );
167 // airports.dump_gdbm( outpath.c_str() );
169 if ( ! airports.search( id, &a ) ) {
170 FG_LOG( FG_GENERAL, FG_ALERT,
171 "Failed to find " << id << " in database." );
174 f->set_Longitude( a.longitude * DEG_TO_RAD );
175 f->set_Latitude( a.latitude * DEG_TO_RAD );
178 // set initial position from default or command line coordinates
180 f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
181 f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
184 FG_LOG( FG_GENERAL, FG_INFO,
185 "starting altitude is = " << current_options.get_altitude() );
187 f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
188 fgFDMSetGroundElevation( current_options.get_flight_model(),
189 (f->get_Altitude() - 3.758099) * FEET_TO_METER );
191 FG_LOG( FG_GENERAL, FG_INFO,
192 "Initial position is: ("
193 << (f->get_Longitude() * RAD_TO_DEG) << ", "
194 << (f->get_Latitude() * RAD_TO_DEG) << ", "
195 << (f->get_Altitude() * FEET_TO_METER) << ")" );
201 // General house keeping initializations
202 bool fgInitGeneral( void ) {
205 #if defined(FX) && defined(XMESA)
206 char *mesa_win_state;
209 FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
210 FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
212 root = current_options.get_fg_root();
213 if ( ! root.length() ) {
214 // No root path set? Then bail ...
215 FG_LOG( FG_GENERAL, FG_ALERT,
216 "Cannot continue without environment variable FG_ROOT"
217 << "being defined." );
220 FG_LOG( FG_GENERAL, FG_INFO, "FG_ROOT = " << '"' << root << '"' << endl );
222 #if defined(FX) && defined(XMESA)
223 // initialize full screen flag
224 global_fullscreen = false;
225 if ( strstr ( general.get_glRenderer(), "Glide" ) ) {
226 // Test for the MESA_GLX_FX env variable
227 if ( (mesa_win_state = getenv( "MESA_GLX_FX" )) != NULL) {
228 // test if we are fullscreen mesa/glide
229 if ( (mesa_win_state[0] == 'f') ||
230 (mesa_win_state[0] == 'F') ) {
231 global_fullscreen = true;
241 // This is the top level init routine which calls all the other
242 // initialization routines. If you are adding a subsystem to flight
243 // gear, its initialization call should located in this routine.
244 // Returns non-zero if a problem encountered.
245 bool fgInitSubsystems( void ) {
246 fgLIGHT *l = &cur_light_params;
247 FGTime *t = FGTime::cur_time_params;
249 FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
250 FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
252 if ( current_options.get_flight_model() == FGInterface::FG_LARCSIM ) {
253 cur_fdm_state = new FGLaRCsim;
254 } else if ( current_options.get_flight_model() == FGInterface::FG_JSBSIM ) {
255 cur_fdm_state = new FGJSBsim;
256 } else if ( current_options.get_flight_model() ==
257 FGInterface::FG_BALLOONSIM ) {
258 cur_fdm_state = new FGBalloonSim;
259 } else if ( current_options.get_flight_model() ==
260 FGInterface::FG_MAGICCARPET ) {
261 cur_fdm_state = new FGMagicCarpet;
262 } else if ( current_options.get_flight_model() ==
263 FGInterface::FG_EXTERNAL ) {
264 cur_fdm_state = new FGExternal;
266 FG_LOG( FG_GENERAL, FG_ALERT,
267 "No flight model, can't init aircraft" );
271 // allocates structures so must happen before any of the flight
272 // model or control parameters are set
273 fgAircraftInit(); // In the future this might not be the case.
275 // set the initial position
278 // Initialize the material property lib
279 FGPath mpath( current_options.get_fg_root() );
280 mpath.append( "materials" );
281 if ( material_lib.load( mpath.str() ) ) {
283 FG_LOG( FG_GENERAL, FG_ALERT, "Error loading material lib!" );
287 // Initialize the Scenery Management subsystem
288 if ( fgSceneryInit() ) {
289 // Material lib initialized ok.
291 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Scenery initialization!" );
295 if( global_tile_mgr.init() ) {
296 // Load the local scenery data
297 global_tile_mgr.update( cur_fdm_state->get_Longitude(),
298 cur_fdm_state->get_Latitude() );
300 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
304 FG_LOG( FG_GENERAL, FG_DEBUG,
305 "Current terrain elevation after tile mgr init " <<
308 // Calculate ground elevation at starting point (we didn't have
309 // tmp_abs_view_pos calculated when fgTileMgrUpdate() was called above
311 // calculalate a cartesian point somewhere along the line between
312 // the center of the earth and our view position. Doesn't have to
313 // be the exact elevation (this is good because we don't know it
316 // now handled inside of the fgTileMgrUpdate()
319 geod_pos = Point3D( cur_fdm_state->get_Longitude(), cur_fdm_state->get_Latitude(), 0.0);
320 tmp_abs_view_pos = fgGeodToCart(geod_pos);
322 FG_LOG( FG_GENERAL, FG_DEBUG,
323 "Initial abs_view_pos = " << tmp_abs_view_pos );
325 fgTileMgrCurElev( cur_fdm_state->get_Longitude(), cur_fdm_state->get_Latitude(),
327 FG_LOG( FG_GENERAL, FG_DEBUG,
328 "Altitude after update " << scenery.cur_elev );
331 fgFDMSetGroundElevation( current_options.get_flight_model(),
334 // Reset our altitude if we are below ground
335 FG_LOG( FG_GENERAL, FG_DEBUG, "Current altitude = " << cur_fdm_state->get_Altitude() );
336 FG_LOG( FG_GENERAL, FG_DEBUG, "Current runway altitude = " <<
337 cur_fdm_state->get_Runway_altitude() );
339 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
340 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
343 FG_LOG( FG_GENERAL, FG_INFO,
344 "Updated position (after elevation adj): ("
345 << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", "
346 << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", "
347 << (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
349 // We need to calculate a few more values here that would normally
350 // be calculated by the FDM so that the current_view.UpdateViewMath()
351 // routine doesn't get hosed.
353 double sea_level_radius_meters;
355 // Set the FG variables first
356 fgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
357 &sea_level_radius_meters, &lat_geoc);
358 cur_fdm_state->set_Geocentric_Position( lat_geoc, cur_fdm_state->get_Longitude(),
359 cur_fdm_state->get_Altitude() +
360 (sea_level_radius_meters * METER_TO_FEET) );
361 cur_fdm_state->set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET );
363 cur_fdm_state->set_sin_cos_longitude(cur_fdm_state->get_Longitude());
364 cur_fdm_state->set_sin_cos_latitude(cur_fdm_state->get_Latitude());
366 cur_fdm_state->set_sin_lat_geocentric(sin(lat_geoc));
367 cur_fdm_state->set_cos_lat_geocentric(cos(lat_geoc));
369 // The following section sets up the flight model EOM parameters
370 // and should really be read in from one or more files.
373 cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
374 current_options.get_vBody(),
375 current_options.get_wBody());
377 // Initial Orientation
378 cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
379 current_options.get_pitch() * DEG_TO_RAD,
380 current_options.get_heading() * DEG_TO_RAD );
382 // Initial Angular Body rates
383 cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
385 cur_fdm_state->set_Earth_position_angle( 0.0 );
387 // Mass properties and geometry values
388 cur_fdm_state->set_Inertias( 8.547270E+01,
389 1.048000E+03, 3.000000E+03, 3.530000E+03, 0.000000E+00 );
391 // CG position w.r.t. ref. point
392 cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 );
394 // Initialize the event manager
395 global_events.Init();
397 // Output event stats every 60 seconds
398 global_events.Register( "fgEVENT_MGR::PrintStats()",
399 fgMethodCallback<fgEVENT_MGR>( &global_events,
400 &fgEVENT_MGR::PrintStats),
401 fgEVENT::FG_EVENT_READY, 60000 );
403 // Initialize view parameters
404 FG_LOG( FG_GENERAL, FG_DEBUG, "Before current_view.init()");
407 FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
408 current_view.UpdateViewMath(*cur_fdm_state);
409 pilot_view.UpdateViewMath(*cur_fdm_state);
410 FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
411 // current_view.UpdateWorldToEye(f);
413 // Initialize the planetary subsystem
414 // global_events.Register( "fgPlanetsInit()", fgPlanetsInit,
415 // fgEVENT::FG_EVENT_READY, 600000);
417 // Initialize the sun's position
418 // global_events.Register( "fgSunInit()", fgSunInit,
419 // fgEVENT::FG_EVENT_READY, 30000 );
421 // Intialize the moon's position
422 // global_events.Register( "fgMoonInit()", fgMoonInit,
423 // fgEVENT::FG_EVENT_READY, 600000 );
425 // fgUpdateSunPos() needs a few position and view parameters set
426 // so it can calculate local relative sun angle and a few other
427 // things for correctly orienting the sky.
430 global_events.Register( "fgUpdateSunPos()", fgUpdateSunPos,
431 fgEVENT::FG_EVENT_READY, 60000);
432 global_events.Register( "fgUpdateMoonPos()", fgUpdateMoonPos,
433 fgEVENT::FG_EVENT_READY, 60000);
435 // Initialize Lighting interpolation tables
438 // update the lighting parameters (based on sun angle)
439 global_events.Register( "fgLight::Update()",
440 fgMethodCallback<fgLIGHT>( &cur_light_params,
442 fgEVENT::FG_EVENT_READY, 30000 );
443 // update the current timezone each 30 minutes
444 global_events.Register( "fgTIME::updateLocal()",
445 fgMethodCallback<FGTime>(FGTime::cur_time_params,
446 &FGTime::updateLocal),
447 fgEVENT::FG_EVENT_READY, 1800000);
449 // Initialize the weather modeling subsystem
450 #ifndef FG_OLD_WEATHER
451 // Initialize the WeatherDatabase
452 FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
454 sgSetVec3( position, current_aircraft.fdm_state->get_Latitude(),
455 current_aircraft.fdm_state->get_Longitude(),
456 current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
457 FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
458 new FGLocalWeatherDatabase( position );
459 // cout << theFGLocalWeatherDatabase << endl;
460 // cout << "visibility = "
461 // << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
463 WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
465 // register the periodic update of the weather
466 global_events.Register( "weather update", fgUpdateWeatherDatabase,
467 fgEVENT::FG_EVENT_READY, 30000);
469 current_weather.Init();
472 // Initialize vor/ndb/ils/fix list management and query systems
473 FG_LOG(FG_GENERAL, FG_INFO, "Loading Navaids");
475 FG_LOG(FG_GENERAL, FG_INFO, " VOR/NDB");
476 current_navlist = new FGNavList;
477 FGPath p_nav( current_options.get_fg_root() );
478 p_nav.append( "Navaids/default.nav" );
479 current_navlist->init( p_nav );
481 FG_LOG(FG_GENERAL, FG_INFO, " ILS");
482 current_ilslist = new FGILSList;
483 FGPath p_ils( current_options.get_fg_root() );
484 p_ils.append( "Navaids/default.ils" );
485 current_ilslist->init( p_ils );
487 FG_LOG(FG_GENERAL, FG_INFO, " Fixes");
488 current_fixlist = new FGFixList;
489 FGPath p_fix( current_options.get_fg_root() );
490 p_fix.append( "Navaids/default.fix" );
491 current_fixlist->init( p_fix );
493 // Initialize the underlying radio stack model
494 current_radiostack = new FGRadioStack;
496 current_radiostack->set_nav1_freq( 117.30 );
497 current_radiostack->set_nav1_alt_freq( 110.30 );
498 current_radiostack->set_nav1_sel_radial( 119.0 );
500 current_radiostack->set_nav2_freq( 111.80 );
501 current_radiostack->set_nav2_alt_freq( 115.70 );
502 current_radiostack->set_nav2_sel_radial( 029.0 );
504 current_radiostack->set_adf_freq( 266.0 );
507 // This block of settings are Alex's defaults for San Diego
508 current_radiostack->set_nav1_freq( 111.70 );
509 current_radiostack->set_nav1_alt_freq( 115.30 );
510 current_radiostack->set_nav1_sel_radial( 280.0 );
511 current_radiostack->set_nav2_freq( 117.80 );
512 current_radiostack->set_nav2_alt_freq( 114.00 );
513 current_radiostack->set_nav2_sel_radial( 68.0 );
514 current_radiostack->set_adf_freq( 210.0 );
515 // End of Alex's custom settings
518 current_radiostack->search( cur_fdm_state->get_Longitude(),
519 cur_fdm_state->get_Latitude(),
520 cur_fdm_state->get_Altitude() * FEET_TO_METER );
522 current_radiostack->update( cur_fdm_state->get_Longitude(),
523 cur_fdm_state->get_Latitude(),
524 cur_fdm_state->get_Altitude() * FEET_TO_METER );
526 // Search radio database once per second
527 global_events.Register( "fgRadioSearch()", fgRadioSearch,
528 fgEVENT::FG_EVENT_READY, 1000);
531 // Initialize the Cockpit subsystem
532 if( fgCockpitInit( ¤t_aircraft )) {
533 // Cockpit initialized ok.
535 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Cockpit initialization!" );
539 // Initialize the flight model subsystem data structures base on
542 // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
543 // 1.0 / current_options.get_model_hz() );
544 cur_fdm_state->init( 1.0 / current_options.get_model_hz() );
546 // I'm just sticking this here for now, it should probably move
548 scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
550 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
551 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
554 FG_LOG( FG_GENERAL, FG_INFO,
555 "Updated position (after elevation adj): ("
556 << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", "
557 << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", "
558 << (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
559 // end of thing that I just stuck in that I should probably move
562 if ( fgJoystickInit() ) {
563 // Joystick initialized ok.
565 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!" );
569 current_autopilot = new FGAutopilot;
570 current_autopilot->init();
572 // initialize the gui parts of the autopilot
578 // Initialize I/O channels
579 #if ! defined( MACOS )
583 // Initialize the 2D panel.
584 current_panel = fgCreateSmallSinglePropPanel(0, 0, 1024, 768);
586 // Initialize the BFI
589 FG_LOG( FG_GENERAL, FG_INFO, endl);
595 void fgReInitSubsystems( void )
597 FGTime *t = FGTime::cur_time_params;
599 int toggle_pause = t->getPause();
602 t->togglePauseMode();
605 if( global_tile_mgr.init() ) {
606 // Load the local scenery data
607 global_tile_mgr.update( cur_fdm_state->get_Longitude(),
608 cur_fdm_state->get_Latitude() );
610 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
613 fgFDMSetGroundElevation( current_options.get_flight_model(),
616 // Reset our altitude if we are below ground
617 FG_LOG( FG_GENERAL, FG_DEBUG, "Current altitude = " << cur_fdm_state->get_Altitude() );
618 FG_LOG( FG_GENERAL, FG_DEBUG, "Current runway altitude = " <<
619 cur_fdm_state->get_Runway_altitude() );
621 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
622 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
624 double sea_level_radius_meters;
626 // Set the FG variables first
627 fgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
628 &sea_level_radius_meters, &lat_geoc);
629 cur_fdm_state->set_Geocentric_Position( lat_geoc, cur_fdm_state->get_Longitude(),
630 cur_fdm_state->get_Altitude() +
631 (sea_level_radius_meters * METER_TO_FEET) );
632 cur_fdm_state->set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET );
634 cur_fdm_state->set_sin_cos_longitude(cur_fdm_state->get_Longitude());
635 cur_fdm_state->set_sin_cos_latitude(cur_fdm_state->get_Latitude());
637 cur_fdm_state->set_sin_lat_geocentric(sin(lat_geoc));
638 cur_fdm_state->set_cos_lat_geocentric(cos(lat_geoc));
640 // The following section sets up the flight model EOM parameters
641 // and should really be read in from one or more files.
644 cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
645 current_options.get_vBody(),
646 current_options.get_wBody());
648 // Initial Orientation
649 cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
650 current_options.get_pitch() * DEG_TO_RAD,
651 current_options.get_heading() * DEG_TO_RAD );
653 // Initial Angular Body rates
654 cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
656 cur_fdm_state->set_Earth_position_angle( 0.0 );
658 // Mass properties and geometry values
659 cur_fdm_state->set_Inertias( 8.547270E+01,
660 1.048000E+03, 3.000000E+03, 3.530000E+03, 0.000000E+00 );
662 // CG position w.r.t. ref. point
663 cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 );
665 // Initialize view parameters
666 current_view.set_view_offset( 0.0 );
667 current_view.set_goal_view_offset( 0.0 );
668 pilot_view.set_view_offset( 0.0 );
669 pilot_view.set_goal_view_offset( 0.0 );
671 FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
672 current_view.UpdateViewMath(*cur_fdm_state);
673 pilot_view.UpdateViewMath(*cur_fdm_state);
674 FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
676 // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
677 // 1.0 / current_options.get_model_hz() );
678 cur_fdm_state->init( 1.0 / current_options.get_model_hz() );
680 scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
682 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
683 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
686 controls.reset_all();
687 current_autopilot->reset();
690 t->togglePauseMode();