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 FG_MATH_EXCEPTION_CLASH
35 #include <simgear/xgl/xgl.h>
40 // work around a stdc++ lib bug in some versions of linux, but doesn't
41 // seem to hurt to have this here for all versions of Linux.
43 # define _G_NO_EXTERN_TEMPLATES
46 #include <simgear/compiler.h>
50 #include <simgear/constants.h>
51 #include <simgear/debug/logstream.hxx>
52 #include <simgear/math/fg_geodesy.hxx>
53 #include <simgear/math/point3d.hxx>
54 #include <simgear/math/polar3d.hxx>
55 #include <simgear/misc/fgpath.hxx>
56 #include <simgear/timing/sg_time.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/light.hxx>
81 #include <Time/sunpos.hxx>
82 #include <Time/moonpos.hxx>
83 #include <Time/tmp.hxx>
85 #ifndef FG_OLD_WEATHER
86 # include <WeatherCM/FGLocalWeatherDatabase.h>
88 # include <Weather/weather.hxx>
91 #include "fg_init.hxx"
93 #include "globals.hxx"
94 #include "options.hxx"
98 #if defined(FX) && defined(XMESA)
102 FG_USING_STD(string);
104 extern const char *default_root;
107 // Read in configuration (file and command line)
108 bool fgInitConfig ( int argc, char **argv ) {
109 // Attempt to locate and parse a config file
110 // First check fg_root
111 FGPath config( current_options.get_fg_root() );
112 config.append( "system.fgfsrc" );
113 current_options.parse_config_file( config.str() );
115 // Next check home directory
116 char* envp = ::getenv( "HOME" );
117 if ( envp != NULL ) {
119 config.append( ".fgfsrc" );
120 current_options.parse_config_file( config.str() );
123 // Parse remaining command line options
124 // These will override anything specified in a config file
125 if ( current_options.parse_command_line(argc, argv) !=
126 fgOPTIONS::FG_OPTIONS_OK )
128 // Something must have gone horribly wrong with the command
129 // line parsing or maybe the user just requested help ... :-)
130 current_options.usage();
131 FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
139 // Set initial position and orientation
140 bool fgInitPosition( void ) {
144 f = current_aircraft.fdm_state;
146 id = current_options.get_airport_id();
148 // set initial position from airport id
150 FGPath path( current_options.get_fg_root() );
151 path.append( "Airports" );
152 path.append( "simple.mk4" );
153 FGAirports airports( path.c_str() );
156 FG_LOG( FG_GENERAL, FG_INFO,
157 "Attempting to set starting position from airport code "
160 // FGPath inpath( current_options.get_fg_root() );
161 // inpath.append( "Airports" );
162 // inpath.append( "apt_simple" );
163 // airports.load( inpath.c_str() );
165 // FGPath outpath( current_options.get_fg_root() );
166 // outpath.append( "Airports" );
167 // outpath.append( "simple.gdbm" );
168 // airports.dump_gdbm( outpath.c_str() );
170 if ( ! airports.search( id, &a ) ) {
171 FG_LOG( FG_GENERAL, FG_ALERT,
172 "Failed to find " << id << " in database." );
175 f->set_Longitude( a.longitude * DEG_TO_RAD );
176 f->set_Latitude( a.latitude * DEG_TO_RAD );
179 // set initial position from default or command line coordinates
181 f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
182 f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
185 FG_LOG( FG_GENERAL, FG_INFO,
186 "starting altitude is = " << current_options.get_altitude() );
188 f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
189 fgFDMSetGroundElevation( current_options.get_flight_model(),
190 (f->get_Altitude() - 3.758099) * FEET_TO_METER );
192 FG_LOG( FG_GENERAL, FG_INFO,
193 "Initial position is: ("
194 << (f->get_Longitude() * RAD_TO_DEG) << ", "
195 << (f->get_Latitude() * RAD_TO_DEG) << ", "
196 << (f->get_Altitude() * FEET_TO_METER) << ")" );
202 // General house keeping initializations
203 bool fgInitGeneral( void ) {
206 #if defined(FX) && defined(XMESA)
207 char *mesa_win_state;
210 FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
211 FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
213 root = current_options.get_fg_root();
214 if ( ! root.length() ) {
215 // No root path set? Then bail ...
216 FG_LOG( FG_GENERAL, FG_ALERT,
217 "Cannot continue without environment variable FG_ROOT"
218 << "being defined." );
221 FG_LOG( FG_GENERAL, FG_INFO, "FG_ROOT = " << '"' << root << '"' << endl );
223 #if defined(FX) && defined(XMESA)
224 // initialize full screen flag
225 global_fullscreen = false;
226 if ( strstr ( general.get_glRenderer(), "Glide" ) ) {
227 // Test for the MESA_GLX_FX env variable
228 if ( (mesa_win_state = getenv( "MESA_GLX_FX" )) != NULL) {
229 // test if we are fullscreen mesa/glide
230 if ( (mesa_win_state[0] == 'f') ||
231 (mesa_win_state[0] == 'F') ) {
232 global_fullscreen = true;
242 // This is the top level init routine which calls all the other
243 // initialization routines. If you are adding a subsystem to flight
244 // gear, its initialization call should located in this routine.
245 // Returns non-zero if a problem encountered.
246 bool fgInitSubsystems( void ) {
247 fgLIGHT *l = &cur_light_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( "fgUpdateLocalTime()", fgUpdateLocalTime,
445 fgEVENT::FG_EVENT_READY, 1800000);
447 // Initialize the weather modeling subsystem
448 #ifndef FG_OLD_WEATHER
449 // Initialize the WeatherDatabase
450 FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
452 sgSetVec3( position, current_aircraft.fdm_state->get_Latitude(),
453 current_aircraft.fdm_state->get_Longitude(),
454 current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
455 FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
456 new FGLocalWeatherDatabase( position, current_options.get_fg_root() );
457 // cout << theFGLocalWeatherDatabase << endl;
458 // cout << "visibility = "
459 // << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
461 WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
463 // register the periodic update of the weather
464 global_events.Register( "weather update", fgUpdateWeatherDatabase,
465 fgEVENT::FG_EVENT_READY, 30000);
467 current_weather.Init();
470 // Initialize vor/ndb/ils/fix list management and query systems
471 FG_LOG(FG_GENERAL, FG_INFO, "Loading Navaids");
473 FG_LOG(FG_GENERAL, FG_INFO, " VOR/NDB");
474 current_navlist = new FGNavList;
475 FGPath p_nav( current_options.get_fg_root() );
476 p_nav.append( "Navaids/default.nav" );
477 current_navlist->init( p_nav );
479 FG_LOG(FG_GENERAL, FG_INFO, " ILS");
480 current_ilslist = new FGILSList;
481 FGPath p_ils( current_options.get_fg_root() );
482 p_ils.append( "Navaids/default.ils" );
483 current_ilslist->init( p_ils );
485 FG_LOG(FG_GENERAL, FG_INFO, " Fixes");
486 current_fixlist = new FGFixList;
487 FGPath p_fix( current_options.get_fg_root() );
488 p_fix.append( "Navaids/default.fix" );
489 current_fixlist->init( p_fix );
491 // Initialize the underlying radio stack model
492 current_radiostack = new FGRadioStack;
494 current_radiostack->set_nav1_freq( 117.30 );
495 current_radiostack->set_nav1_alt_freq( 110.30 );
496 current_radiostack->set_nav1_sel_radial( 119.0 );
498 current_radiostack->set_nav2_freq( 111.80 );
499 current_radiostack->set_nav2_alt_freq( 115.70 );
500 current_radiostack->set_nav2_sel_radial( 029.0 );
502 current_radiostack->set_adf_freq( 266.0 );
505 // This block of settings are Alex's defaults for San Diego
506 current_radiostack->set_nav1_freq( 111.70 );
507 current_radiostack->set_nav1_alt_freq( 115.30 );
508 current_radiostack->set_nav1_sel_radial( 280.0 );
509 current_radiostack->set_nav2_freq( 117.80 );
510 current_radiostack->set_nav2_alt_freq( 114.00 );
511 current_radiostack->set_nav2_sel_radial( 68.0 );
512 current_radiostack->set_adf_freq( 210.0 );
513 // End of Alex's custom settings
516 current_radiostack->search( cur_fdm_state->get_Longitude(),
517 cur_fdm_state->get_Latitude(),
518 cur_fdm_state->get_Altitude() * FEET_TO_METER );
520 current_radiostack->update( cur_fdm_state->get_Longitude(),
521 cur_fdm_state->get_Latitude(),
522 cur_fdm_state->get_Altitude() * FEET_TO_METER );
524 // Search radio database once per second
525 global_events.Register( "fgRadioSearch()", fgRadioSearch,
526 fgEVENT::FG_EVENT_READY, 1000);
529 // Initialize the Cockpit subsystem
530 if( fgCockpitInit( ¤t_aircraft )) {
531 // Cockpit initialized ok.
533 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Cockpit initialization!" );
537 // Initialize the flight model subsystem data structures base on
540 // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
541 // 1.0 / current_options.get_model_hz() );
542 cur_fdm_state->init( 1.0 / current_options.get_model_hz() );
544 // I'm just sticking this here for now, it should probably move
546 scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
548 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
549 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
552 FG_LOG( FG_GENERAL, FG_INFO,
553 "Updated position (after elevation adj): ("
554 << (cur_fdm_state->get_Latitude() * RAD_TO_DEG) << ", "
555 << (cur_fdm_state->get_Longitude() * RAD_TO_DEG) << ", "
556 << (cur_fdm_state->get_Altitude() * FEET_TO_METER) << ")" );
557 // end of thing that I just stuck in that I should probably move
560 if ( fgJoystickInit() ) {
561 // Joystick initialized ok.
563 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!" );
567 current_autopilot = new FGAutopilot;
568 current_autopilot->init();
570 // initialize the gui parts of the autopilot
576 // Initialize I/O channels
577 #if ! defined( MACOS )
581 // Initialize the 2D panel.
582 current_panel = fgCreateSmallSinglePropPanel(0, 0, 1024, 768);
584 // Initialize the BFI
587 FG_LOG( FG_GENERAL, FG_INFO, endl);
593 void fgReInitSubsystems( void )
595 bool freeze = globals->get_freeze();
597 globals->set_freeze( true );
600 if( global_tile_mgr.init() ) {
601 // Load the local scenery data
602 global_tile_mgr.update( cur_fdm_state->get_Longitude(),
603 cur_fdm_state->get_Latitude() );
605 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
608 fgFDMSetGroundElevation( current_options.get_flight_model(),
611 // Reset our altitude if we are below ground
612 FG_LOG( FG_GENERAL, FG_DEBUG, "Current altitude = " << cur_fdm_state->get_Altitude() );
613 FG_LOG( FG_GENERAL, FG_DEBUG, "Current runway altitude = " <<
614 cur_fdm_state->get_Runway_altitude() );
616 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
617 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
619 double sea_level_radius_meters;
621 // Set the FG variables first
622 fgGeodToGeoc( cur_fdm_state->get_Latitude(), cur_fdm_state->get_Altitude(),
623 &sea_level_radius_meters, &lat_geoc);
624 cur_fdm_state->set_Geocentric_Position( lat_geoc, cur_fdm_state->get_Longitude(),
625 cur_fdm_state->get_Altitude() +
626 (sea_level_radius_meters * METER_TO_FEET) );
627 cur_fdm_state->set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET );
629 cur_fdm_state->set_sin_cos_longitude(cur_fdm_state->get_Longitude());
630 cur_fdm_state->set_sin_cos_latitude(cur_fdm_state->get_Latitude());
632 cur_fdm_state->set_sin_lat_geocentric(sin(lat_geoc));
633 cur_fdm_state->set_cos_lat_geocentric(cos(lat_geoc));
635 // The following section sets up the flight model EOM parameters
636 // and should really be read in from one or more files.
639 cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
640 current_options.get_vBody(),
641 current_options.get_wBody());
643 // Initial Orientation
644 cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
645 current_options.get_pitch() * DEG_TO_RAD,
646 current_options.get_heading() * DEG_TO_RAD );
648 // Initial Angular Body rates
649 cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
651 cur_fdm_state->set_Earth_position_angle( 0.0 );
653 // Mass properties and geometry values
654 cur_fdm_state->set_Inertias( 8.547270E+01,
655 1.048000E+03, 3.000000E+03, 3.530000E+03, 0.000000E+00 );
657 // CG position w.r.t. ref. point
658 cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 );
660 // Initialize view parameters
661 current_view.set_view_offset( 0.0 );
662 current_view.set_goal_view_offset( 0.0 );
663 pilot_view.set_view_offset( 0.0 );
664 pilot_view.set_goal_view_offset( 0.0 );
666 FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
667 current_view.UpdateViewMath(*cur_fdm_state);
668 pilot_view.UpdateViewMath(*cur_fdm_state);
669 FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
671 // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
672 // 1.0 / current_options.get_model_hz() );
673 cur_fdm_state->init( 1.0 / current_options.get_model_hz() );
675 scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
677 if ( cur_fdm_state->get_Altitude() < cur_fdm_state->get_Runway_altitude() + 3.758099) {
678 cur_fdm_state->set_Altitude( cur_fdm_state->get_Runway_altitude() + 3.758099 );
681 controls.reset_all();
682 current_autopilot->reset();
685 globals->set_freeze( false );