1 // flight.cxx -- a general interface to the various flight models
3 // Written by Curtis Olson, started May 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.
28 #include <simgear/constants.h>
29 #include <simgear/debug/logstream.hxx>
30 #include <simgear/math/sg_geodesy.hxx>
31 #include <simgear/timing/timestamp.hxx>
33 #include <Scenery/scenery.hxx>
34 #include <FDM/LaRCsim/ls_interface.h>
35 #include <Main/globals.hxx>
36 #include <Main/fg_props.hxx>
38 #include "External.hxx"
41 #include "LaRCsim.hxx"
45 // base_fdm_state is the internal state that is updated in integer
46 // multiples of "dt". This leads to "jitter" with respect to the real
47 // world time, so we introduce cur_fdm_state which is extrapolated by
48 // the difference between sim time and real world time
50 FGInterface *cur_fdm_state;
51 FGInterface base_fdm_state;
53 inline void init_vec(FG_VECTOR_3 vec) {
54 vec[0] = 0.0; vec[1] = 0.0; vec[2] = 0.0;
58 FGInterface::FGInterface() {
62 FGInterface::FGInterface( double dt ) {
65 remainder = elapsed = multi_loop = 0;
69 FGInterface::~FGInterface() {
70 // unbind(); // FIXME: should be called explicitly
75 * Set default values for the state of the FDM.
77 * This method is invoked by the constructors.
80 FGInterface::_setup ()
85 init_vec( d_pilot_rp_body_v );
86 init_vec( d_cg_rp_body_v );
87 init_vec( f_body_total_v );
88 init_vec( f_local_total_v );
90 init_vec( f_engine_v );
92 init_vec( m_total_rp_v );
93 init_vec( m_total_cg_v );
95 init_vec( m_engine_v );
97 init_vec( v_dot_local_v );
98 init_vec( v_dot_body_v );
99 init_vec( a_cg_body_v );
100 init_vec( a_pilot_body_v );
101 init_vec( n_cg_body_v );
102 init_vec( n_pilot_body_v );
103 init_vec( omega_dot_body_v );
104 init_vec( v_local_v );
105 init_vec( v_local_rel_ground_v );
106 init_vec( v_local_airmass_v );
107 init_vec( v_local_rel_airmass_v );
108 init_vec( v_local_gust_v );
109 init_vec( v_wind_body_v );
110 init_vec( omega_body_v );
111 init_vec( omega_local_v );
112 init_vec( omega_total_v );
113 init_vec( euler_rates_v );
114 init_vec( geocentric_rates_v );
115 init_vec( geocentric_position_v );
116 init_vec( geodetic_position_v );
117 init_vec( euler_angles_v );
118 init_vec( d_cg_rwy_local_v );
119 init_vec( d_cg_rwy_rwy_v );
120 init_vec( d_pilot_rwy_local_v );
121 init_vec( d_pilot_rwy_rwy_v );
122 init_vec( t_local_to_body_m[0] );
123 init_vec( t_local_to_body_m[1] );
124 init_vec( t_local_to_body_m[2] );
126 mass=i_xx=i_yy=i_zz=i_xz=0;
128 v_rel_wind=v_true_kts=v_rel_ground=v_inertial=0;
129 v_ground_speed=v_equiv=v_equiv_kts=0;
130 v_calibrated=v_calibrated_kts=0;
132 centrifugal_relief=0;
133 alpha=beta=alpha_dot=beta_dot=0;
134 cos_alpha=sin_alpha=cos_beta=sin_beta=0;
135 cos_phi=sin_phi=cos_theta=sin_theta=cos_psi=sin_psi=0;
136 gamma_vert_rad=gamma_horiz_rad=0;
137 sigma=density=v_sound=mach_number=0;
138 static_pressure=total_pressure=impact_pressure=0;
140 static_temperature=total_temperature=0;
141 sea_level_radius=earth_position_angle=0;
142 runway_altitude=runway_latitude=runway_longitude=0;
146 sin_lat_geocentric=cos_lat_geocentric=0;
147 sin_latitude=cos_latitude=0;
148 sin_longitude=cos_longitude=0;
153 FGInterface::init () {}
156 * Initialize the state of the FDM.
158 * Subclasses of FGInterface may do their own, additional initialization,
159 * but there is some that is common to all. Normally, they should call
160 * this before they begin their own init to make sure the basic structures
161 * are set up properly.
164 FGInterface::common_init ()
166 SG_LOG( SG_FLIGHT, SG_INFO, "Start common FDM init" );
173 // Set initial position
174 SG_LOG( SG_FLIGHT, SG_INFO, "...initializing position..." );
175 set_Longitude( fgGetDouble("/position/longitude-deg")
176 * SGD_DEGREES_TO_RADIANS );
177 set_Latitude( fgGetDouble("/position/latitude-deg")
178 * SGD_DEGREES_TO_RADIANS );
179 double ground_elev_m = scenery.get_cur_elev();
180 double ground_elev_ft = ground_elev_m * SG_METER_TO_FEET;
181 if ( fgGetBool("/sim/startup/onground")
182 || fgGetDouble("/position/altitude-ft") < ground_elev_ft ) {
183 fgSetDouble("/position/altitude-ft", ground_elev_ft);
185 set_Altitude( fgGetDouble("/position/altitude-ft") );
187 // Set ground elevation
188 SG_LOG( SG_FLIGHT, SG_INFO,
189 "...initializing ground elevation to " << ground_elev_ft
191 SG_LOG( SG_FLIGHT, SG_INFO, "common_init(): set ground elevation "
193 base_fdm_state.set_Runway_altitude( ground_elev_ft );
194 set_Runway_altitude( ground_elev_ft );
196 // Set sea-level radius
197 SG_LOG( SG_FLIGHT, SG_INFO, "...initializing sea-level radius..." );
198 SG_LOG( SG_FLIGHT, SG_INFO, " lat = "
199 << fgGetDouble("/position/latitude-deg")
200 << " alt = " << fgGetDouble("/position/altitude-ft") );
201 double sea_level_radius_meters;
203 sgGeodToGeoc( fgGetDouble("/position/latitude-deg")
204 * SGD_DEGREES_TO_RADIANS,
205 fgGetDouble("/position/altitude-ft") * SG_FEET_TO_METER,
206 &sea_level_radius_meters, &lat_geoc );
207 set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
209 // Set initial velocities
210 SG_LOG( SG_FLIGHT, SG_INFO, "...initializing velocities..." );
211 if ( !fgHasNode("/sim/startup/speed-set") ) {
212 set_V_calibrated_kts(0.0);
214 const string speedset = fgGetString("/sim/startup/speed-set");
215 if ( speedset == "knots" || speedset == "KNOTS" ) {
216 set_V_calibrated_kts( fgGetDouble("/velocities/airspeed-kt") );
217 } else if ( speedset == "mach" || speedset == "MACH" ) {
218 set_Mach_number( fgGetDouble("/velocities/mach") );
219 } else if ( speedset == "UVW" || speedset == "uvw" ) {
220 set_Velocities_Wind_Body(
221 fgGetDouble("/velocities/uBody-fps"),
222 fgGetDouble("/velocities/vBody-fps"),
223 fgGetDouble("/velocities/wBody-fps") );
224 } else if ( speedset == "NED" || speedset == "ned" ) {
225 set_Velocities_Local(
226 fgGetDouble("/velocities/speed-north-fps"),
227 fgGetDouble("/velocities/speed-east-fps"),
228 fgGetDouble("/velocities/speed-down-fps") );
230 SG_LOG( SG_FLIGHT, SG_ALERT,
231 "Unrecognized value for /sim/startup/speed-set: "
233 set_V_calibrated_kts( 0.0 );
237 // Set initial Euler angles
238 SG_LOG( SG_FLIGHT, SG_INFO, "...initializing Euler angles..." );
239 set_Euler_Angles( fgGetDouble("/orientation/roll-deg")
240 * SGD_DEGREES_TO_RADIANS,
241 fgGetDouble("/orientation/pitch-deg")
242 * SGD_DEGREES_TO_RADIANS,
243 fgGetDouble("/orientation/heading-deg")
244 * SGD_DEGREES_TO_RADIANS );
246 SG_LOG( SG_FLIGHT, SG_INFO, "End common FDM init" );
251 * Bind getters and setters to properties.
253 * The bind() method will be invoked after init(). Note that unlike
254 * the usual implementations of FGSubsystem::bind(), this method does
255 * not automatically pick up existing values for the properties at
256 * bind time; instead, all values are set explicitly in the init()
264 // Time management (read-only)
265 fgTie("/fdm/time/delta_t", this,
266 &FGInterface::get_delta_t); // read-only
267 fgTie("/fdm/time/elapsed", this,
268 &FGInterface::get_elapsed); // read-only
269 fgTie("/fdm/time/remainder", this,
270 &FGInterface::get_remainder); // read-only
271 fgTie("/fdm/time/multi_loop", this,
272 &FGInterface::get_multi_loop); // read-only
275 fgTie("/position/latitude-deg", this,
276 &FGInterface::get_Latitude_deg,
277 &FGInterface::set_Latitude_deg,
279 fgSetArchivable("/position/latitude-deg");
280 fgTie("/position/longitude-deg", this,
281 &FGInterface::get_Longitude_deg,
282 &FGInterface::set_Longitude_deg,
284 fgSetArchivable("/position/longitude-deg");
285 fgTie("/position/altitude-ft", this,
286 &FGInterface::get_Altitude,
287 &FGInterface::set_Altitude,
289 fgSetArchivable("/position/altitude-ft");
290 fgTie("/position/altitude-agl-ft", this,
291 &FGInterface::get_Altitude_AGL); // read-only
294 fgTie("/orientation/roll-deg", this,
295 &FGInterface::get_Phi_deg,
296 &FGInterface::set_Phi_deg);
297 fgSetArchivable("/orientation/roll-deg");
298 fgTie("/orientation/pitch-deg", this,
299 &FGInterface::get_Theta_deg,
300 &FGInterface::set_Theta_deg);
301 fgSetArchivable("/orientation/pitch-deg");
302 fgTie("/orientation/heading-deg", this,
303 &FGInterface::get_Psi_deg,
304 &FGInterface::set_Psi_deg);
305 fgSetArchivable("/orientation/heading-deg");
307 // Calibrated airspeed
308 fgTie("/velocities/airspeed-kt", this,
309 &FGInterface::get_V_calibrated_kts,
310 &FGInterface::set_V_calibrated_kts,
314 // fgTie("/velocities/speed-north-fps", this,
315 // &FGInterface::get_V_north,
316 // &FGInterface::set_V_north);
317 // fgSetArchivable("/velocities/speed-north-fps");
318 // fgTie("/velocities/speed-east-fps", this,
319 // &FGInterface::get_V_east,
320 // &FGInterface::set_V_east);
321 // fgSetArchivable("/velocities/speed-east-fps");
322 // fgTie("/velocities/speed-down-fps", this,
323 // &FGInterface::get_V_down,
324 // &FGInterface::set_V_down);
325 // fgSetArchivable("/velocities/speed-down-fps");
326 // FIXME: Temporarily read-only, until the
327 // incompatibilities between JSBSim and
328 // LaRCSim are fixed (LaRCSim adds the
329 // earth's rotation to the east velocity).
330 fgTie("/velocities/speed-north-fps", this,
331 &FGInterface::get_V_north);
332 fgTie("/velocities/speed-east-fps", this,
333 &FGInterface::get_V_east);
334 fgTie("/velocities/speed-down-fps", this,
335 &FGInterface::get_V_down);
338 // FIXME: temporarily archivable, until
339 // the NED problem is fixed.
340 fgTie("/velocities/uBody-fps", this,
341 &FGInterface::get_uBody,
342 &FGInterface::set_uBody,
344 fgSetArchivable("/velocities/uBody-fps");
345 fgTie("/velocities/vBody-fps", this,
346 &FGInterface::get_vBody,
347 &FGInterface::set_vBody,
349 fgSetArchivable("/velocities/vBody-fps");
350 fgTie("/velocities/wBody-fps", this,
351 &FGInterface::get_wBody,
352 &FGInterface::set_wBody,
354 fgSetArchivable("/velocities/wBody-fps");
356 // Climb and slip (read-only)
357 fgTie("/velocities/vertical-speed-fps", this,
358 &FGInterface::get_Climb_Rate); // read-only
359 fgTie("/velocities/side-slip-rad", this,
360 &FGInterface::get_Beta); // read-only
365 * Unbind any properties bound to this FDM.
367 * This method allows the FDM to release properties so that a new
368 * FDM can bind them instead.
371 FGInterface::unbind ()
375 fgUntie("/fdm/time/delta_t");
376 fgUntie("/fdm/time/elapsed");
377 fgUntie("/fdm/time/remainder");
378 fgUntie("/fdm/time/multi_loop");
379 fgUntie("/position/latitude-deg");
380 fgUntie("/position/longitude-deg");
381 fgUntie("/position/altitude-ft");
382 fgUntie("/position/altitude-agl-ft");
383 fgUntie("/orientation/heading-deg");
384 fgUntie("/orientation/pitch-deg");
385 fgUntie("/orientation/roll-deg");
386 fgUntie("/velocities/airspeed-kt");
387 fgUntie("/velocities/speed-north-fps");
388 fgUntie("/velocities/speed-east-fps");
389 fgUntie("/velocities/speed-down-fps");
390 fgUntie("/velocities/uBody-fps");
391 fgUntie("/velocities/vBody-fps");
392 fgUntie("/velocities/wBody-fps");
393 fgUntie("/velocities/vertical-speed-fps");
394 fgUntie("/velocities/side-slip-rad");
398 * Update the state of the FDM (i.e. run the equations of motion).
401 FGInterface::update (int dt)
403 cout << "dummy update() ... SHOULDN'T BE CALLED!" << endl;
407 void FGInterface::_updateGeodeticPosition( double lat, double lon, double alt )
409 double lat_geoc, sl_radius;
411 // cout << "starting sea level rad = " << get_Sea_level_radius() << endl;
413 sgGeodToGeoc( lat, alt * SG_FEET_TO_METER, &sl_radius, &lat_geoc );
415 SG_LOG( SG_FLIGHT, SG_DEBUG, "lon = " << lon
416 << " lat_geod = " << lat
417 << " lat_geoc = " << lat_geoc
419 << " sl_radius = " << sl_radius * SG_METER_TO_FEET
420 << " Equator = " << SG_EQUATORIAL_RADIUS_FT );
422 _set_Geocentric_Position( lat_geoc, lon,
423 sl_radius * SG_METER_TO_FEET + alt );
425 _set_Geodetic_Position( lat, lon, alt );
427 _set_Sea_level_radius( sl_radius * SG_METER_TO_FEET );
428 _set_Runway_altitude( scenery.get_cur_elev() * SG_METER_TO_FEET );
430 _set_sin_lat_geocentric( lat_geoc );
431 _set_cos_lat_geocentric( lat_geoc );
433 _set_sin_cos_longitude( lon );
435 _set_sin_cos_latitude( lat );
437 /* Norman's code for slope of the terrain */
438 /* needs to be tested -- get it on the HUD and taxi around */
439 /* double *tnorm = scenery.cur_normal;
441 double sy = sin ( -get_Psi() ) ;
442 double cy = cos ( -get_Psi() ) ;
444 double phitb, thetatb, psitb;
445 if ( tnorm[1] != 0.0 ) {
446 psitb = -atan2 ( tnorm[0], tnorm[1] );
448 if ( tnorm[2] != 0.0 ) {
449 thetatb = atan2 ( tnorm[0] * cy - tnorm[1] * sy, tnorm[2] );
450 phitb = -atan2 ( tnorm[1] * cy + tnorm[0] * sy, tnorm[2] );
453 _set_terrain_slope(phitb, thetatb, psitb)
458 void FGInterface::_updateGeocentricPosition( double lat_geoc, double lon,
461 double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
463 // cout << "starting sea level rad = " << get_Sea_level_radius() << endl;
465 sgGeocToGeod( lat_geoc, ( get_Sea_level_radius() + alt ) * SG_FEET_TO_METER,
466 &lat_geod, &tmp_alt, &sl_radius1 );
467 sgGeodToGeoc( lat_geod, alt * SG_FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
469 SG_LOG( SG_FLIGHT, SG_DEBUG, "lon = " << lon
470 << " lat_geod = " << lat_geod
471 << " lat_geoc = " << lat_geoc
473 << " tmp_alt = " << tmp_alt * SG_METER_TO_FEET
474 << " sl_radius1 = " << sl_radius1 * SG_METER_TO_FEET
475 << " sl_radius2 = " << sl_radius2 * SG_METER_TO_FEET
476 << " Equator = " << SG_EQUATORIAL_RADIUS_FT );
478 _set_Geocentric_Position( lat_geoc, lon,
479 sl_radius2 * SG_METER_TO_FEET + alt );
481 _set_Geodetic_Position( lat_geod, lon, alt );
483 _set_Sea_level_radius( sl_radius2 * SG_METER_TO_FEET );
484 _set_Runway_altitude( scenery.get_cur_elev() * SG_METER_TO_FEET );
486 _set_sin_lat_geocentric( lat_geoc );
487 _set_cos_lat_geocentric( lat_geoc );
489 _set_sin_cos_longitude( lon );
491 _set_sin_cos_latitude( lat_geod );
493 /* Norman's code for slope of the terrain */
494 /* needs to be tested -- get it on the HUD and taxi around */
495 /* double *tnorm = scenery.cur_normal;
497 double sy = sin ( -get_Psi() ) ;
498 double cy = cos ( -get_Psi() ) ;
500 double phitb, thetatb, psitb;
501 if ( tnorm[1] != 0.0 ) {
502 psitb = -atan2 ( tnorm[0], tnorm[1] );
504 if ( tnorm[2] != 0.0 ) {
505 thetatb = atan2 ( tnorm[0] * cy - tnorm[1] * sy, tnorm[2] );
506 phitb = -atan2 ( tnorm[1] * cy + tnorm[0] * sy, tnorm[2] );
509 _set_terrain_slope(phitb, thetatb, psitb)
514 // Extrapolate fdm based on time_offset (in usec)
515 void FGInterface::extrapolate( int time_offset ) {
516 double dt = time_offset / 1000000.0;
518 // -dw- metrowerks complains about ambiguous access, not critical
521 cout << "extrapolating FDM by dt = " << dt << endl;
524 double lat = geodetic_position_v[0] + geocentric_rates_v[0] * dt;
525 double lat_geoc = geocentric_position_v[0] + geocentric_rates_v[0] * dt;
527 double lon = geodetic_position_v[1] + geocentric_rates_v[1] * dt;
528 double lon_geoc = geocentric_position_v[1] + geocentric_rates_v[1] * dt;
530 double alt = geodetic_position_v[2] + geocentric_rates_v[2] * dt;
531 double radius = geocentric_position_v[2] + geocentric_rates_v[2] * dt;
533 geodetic_position_v[0] = lat;
534 geocentric_position_v[0] = lat_geoc;
536 geodetic_position_v[1] = lon;
537 geocentric_position_v[1] = lon_geoc;
539 geodetic_position_v[2] = alt;
540 geocentric_position_v[2] = radius;
544 // Set the altitude (force)
545 void fgFDMForceAltitude(const string &model, double alt_meters) {
546 SG_LOG(SG_FLIGHT,SG_INFO, "fgFDMForceAltitude: " << alt_meters );
548 double sea_level_radius_meters;
551 // Set the FG variables first
552 sgGeodToGeoc( base_fdm_state.get_Latitude(), alt_meters,
553 &sea_level_radius_meters, &lat_geoc);
555 base_fdm_state.set_Altitude( alt_meters * SG_METER_TO_FEET );
556 base_fdm_state.set_Sea_level_radius( sea_level_radius_meters *
559 cur_fdm_state->set_Altitude( alt_meters * SG_METER_TO_FEET );
560 cur_fdm_state->set_Sea_level_radius( sea_level_radius_meters *
563 // additional work needed for some flight models
564 if ( model == "larcsim" ) {
565 ls_ForceAltitude( base_fdm_state.get_Altitude() );
571 void FGInterface::set_Latitude(double lat) {
572 geodetic_position_v[0] = lat;
575 void FGInterface::set_Longitude(double lon) {
576 geodetic_position_v[1] = lon;
579 void FGInterface::set_Altitude(double alt) {
580 geodetic_position_v[2] = alt;
583 void FGInterface::set_AltitudeAGL(double altagl) {
588 void FGInterface::set_V_calibrated_kts(double vc) {
589 v_calibrated_kts = vc;
592 void FGInterface::set_Mach_number(double mach) {
596 void FGInterface::set_Velocities_Local( double north,
599 v_local_v[0] = north;
604 void FGInterface::set_Velocities_Wind_Body( double u,
607 v_wind_body_v[0] = u;
608 v_wind_body_v[1] = v;
609 v_wind_body_v[2] = w;
613 void FGInterface::set_Euler_Angles( double phi,
616 euler_angles_v[0] = phi;
617 euler_angles_v[1] = theta;
618 euler_angles_v[2] = psi;
622 void FGInterface::set_Climb_Rate( double roc) {
626 void FGInterface::set_Gamma_vert_rad( double gamma) {
627 gamma_vert_rad = gamma;
631 void FGInterface::set_Sea_level_radius(double slr) {
632 sea_level_radius = slr;
635 void FGInterface::set_Runway_altitude(double ralt) {
636 runway_altitude = ralt;
639 void FGInterface::set_Static_pressure(double p) { static_pressure = p; }
640 void FGInterface::set_Static_temperature(double T) { static_temperature = T; }
641 void FGInterface::set_Density(double rho) { density = rho; }
643 void FGInterface::set_Velocities_Local_Airmass (double wnorth,
646 v_local_airmass_v[0] = wnorth;
647 v_local_airmass_v[1] = weast;
648 v_local_airmass_v[2] = wdown;
652 void FGInterface::_busdump(void) {
654 SG_LOG(SG_FLIGHT,SG_INFO,"d_pilot_rp_body_v[3]: " << d_pilot_rp_body_v[0] << ", " << d_pilot_rp_body_v[1] << ", " << d_pilot_rp_body_v[2]);
655 SG_LOG(SG_FLIGHT,SG_INFO,"d_cg_rp_body_v[3]: " << d_cg_rp_body_v[0] << ", " << d_cg_rp_body_v[1] << ", " << d_cg_rp_body_v[2]);
656 SG_LOG(SG_FLIGHT,SG_INFO,"f_body_total_v[3]: " << f_body_total_v[0] << ", " << f_body_total_v[1] << ", " << f_body_total_v[2]);
657 SG_LOG(SG_FLIGHT,SG_INFO,"f_local_total_v[3]: " << f_local_total_v[0] << ", " << f_local_total_v[1] << ", " << f_local_total_v[2]);
658 SG_LOG(SG_FLIGHT,SG_INFO,"f_aero_v[3]: " << f_aero_v[0] << ", " << f_aero_v[1] << ", " << f_aero_v[2]);
659 SG_LOG(SG_FLIGHT,SG_INFO,"f_engine_v[3]: " << f_engine_v[0] << ", " << f_engine_v[1] << ", " << f_engine_v[2]);
660 SG_LOG(SG_FLIGHT,SG_INFO,"f_gear_v[3]: " << f_gear_v[0] << ", " << f_gear_v[1] << ", " << f_gear_v[2]);
661 SG_LOG(SG_FLIGHT,SG_INFO,"m_total_rp_v[3]: " << m_total_rp_v[0] << ", " << m_total_rp_v[1] << ", " << m_total_rp_v[2]);
662 SG_LOG(SG_FLIGHT,SG_INFO,"m_total_cg_v[3]: " << m_total_cg_v[0] << ", " << m_total_cg_v[1] << ", " << m_total_cg_v[2]);
663 SG_LOG(SG_FLIGHT,SG_INFO,"m_aero_v[3]: " << m_aero_v[0] << ", " << m_aero_v[1] << ", " << m_aero_v[2]);
664 SG_LOG(SG_FLIGHT,SG_INFO,"m_engine_v[3]: " << m_engine_v[0] << ", " << m_engine_v[1] << ", " << m_engine_v[2]);
665 SG_LOG(SG_FLIGHT,SG_INFO,"m_gear_v[3]: " << m_gear_v[0] << ", " << m_gear_v[1] << ", " << m_gear_v[2]);
666 SG_LOG(SG_FLIGHT,SG_INFO,"v_dot_local_v[3]: " << v_dot_local_v[0] << ", " << v_dot_local_v[1] << ", " << v_dot_local_v[2]);
667 SG_LOG(SG_FLIGHT,SG_INFO,"v_dot_body_v[3]: " << v_dot_body_v[0] << ", " << v_dot_body_v[1] << ", " << v_dot_body_v[2]);
668 SG_LOG(SG_FLIGHT,SG_INFO,"a_cg_body_v[3]: " << a_cg_body_v[0] << ", " << a_cg_body_v[1] << ", " << a_cg_body_v[2]);
669 SG_LOG(SG_FLIGHT,SG_INFO,"a_pilot_body_v[3]: " << a_pilot_body_v[0] << ", " << a_pilot_body_v[1] << ", " << a_pilot_body_v[2]);
670 SG_LOG(SG_FLIGHT,SG_INFO,"n_cg_body_v[3]: " << n_cg_body_v[0] << ", " << n_cg_body_v[1] << ", " << n_cg_body_v[2]);
671 SG_LOG(SG_FLIGHT,SG_INFO,"n_pilot_body_v[3]: " << n_pilot_body_v[0] << ", " << n_pilot_body_v[1] << ", " << n_pilot_body_v[2]);
672 SG_LOG(SG_FLIGHT,SG_INFO,"omega_dot_body_v[3]: " << omega_dot_body_v[0] << ", " << omega_dot_body_v[1] << ", " << omega_dot_body_v[2]);
673 SG_LOG(SG_FLIGHT,SG_INFO,"v_local_v[3]: " << v_local_v[0] << ", " << v_local_v[1] << ", " << v_local_v[2]);
674 SG_LOG(SG_FLIGHT,SG_INFO,"v_local_rel_ground_v[3]: " << v_local_rel_ground_v[0] << ", " << v_local_rel_ground_v[1] << ", " << v_local_rel_ground_v[2]);
675 SG_LOG(SG_FLIGHT,SG_INFO,"v_local_airmass_v[3]: " << v_local_airmass_v[0] << ", " << v_local_airmass_v[1] << ", " << v_local_airmass_v[2]);
676 SG_LOG(SG_FLIGHT,SG_INFO,"v_local_rel_airmass_v[3]: " << v_local_rel_airmass_v[0] << ", " << v_local_rel_airmass_v[1] << ", " << v_local_rel_airmass_v[2]);
677 SG_LOG(SG_FLIGHT,SG_INFO,"v_local_gust_v[3]: " << v_local_gust_v[0] << ", " << v_local_gust_v[1] << ", " << v_local_gust_v[2]);
678 SG_LOG(SG_FLIGHT,SG_INFO,"v_wind_body_v[3]: " << v_wind_body_v[0] << ", " << v_wind_body_v[1] << ", " << v_wind_body_v[2]);
679 SG_LOG(SG_FLIGHT,SG_INFO,"omega_body_v[3]: " << omega_body_v[0] << ", " << omega_body_v[1] << ", " << omega_body_v[2]);
680 SG_LOG(SG_FLIGHT,SG_INFO,"omega_local_v[3]: " << omega_local_v[0] << ", " << omega_local_v[1] << ", " << omega_local_v[2]);
681 SG_LOG(SG_FLIGHT,SG_INFO,"omega_total_v[3]: " << omega_total_v[0] << ", " << omega_total_v[1] << ", " << omega_total_v[2]);
682 SG_LOG(SG_FLIGHT,SG_INFO,"euler_rates_v[3]: " << euler_rates_v[0] << ", " << euler_rates_v[1] << ", " << euler_rates_v[2]);
683 SG_LOG(SG_FLIGHT,SG_INFO,"geocentric_rates_v[3]: " << geocentric_rates_v[0] << ", " << geocentric_rates_v[1] << ", " << geocentric_rates_v[2]);
684 SG_LOG(SG_FLIGHT,SG_INFO,"geocentric_position_v[3]: " << geocentric_position_v[0] << ", " << geocentric_position_v[1] << ", " << geocentric_position_v[2]);
685 SG_LOG(SG_FLIGHT,SG_INFO,"geodetic_position_v[3]: " << geodetic_position_v[0] << ", " << geodetic_position_v[1] << ", " << geodetic_position_v[2]);
686 SG_LOG(SG_FLIGHT,SG_INFO,"euler_angles_v[3]: " << euler_angles_v[0] << ", " << euler_angles_v[1] << ", " << euler_angles_v[2]);
687 SG_LOG(SG_FLIGHT,SG_INFO,"d_cg_rwy_local_v[3]: " << d_cg_rwy_local_v[0] << ", " << d_cg_rwy_local_v[1] << ", " << d_cg_rwy_local_v[2]);
688 SG_LOG(SG_FLIGHT,SG_INFO,"d_cg_rwy_rwy_v[3]: " << d_cg_rwy_rwy_v[0] << ", " << d_cg_rwy_rwy_v[1] << ", " << d_cg_rwy_rwy_v[2]);
689 SG_LOG(SG_FLIGHT,SG_INFO,"d_pilot_rwy_local_v[3]: " << d_pilot_rwy_local_v[0] << ", " << d_pilot_rwy_local_v[1] << ", " << d_pilot_rwy_local_v[2]);
690 SG_LOG(SG_FLIGHT,SG_INFO,"d_pilot_rwy_rwy_v[3]: " << d_pilot_rwy_rwy_v[0] << ", " << d_pilot_rwy_rwy_v[1] << ", " << d_pilot_rwy_rwy_v[2]);
692 SG_LOG(SG_FLIGHT,SG_INFO,"t_local_to_body_m[0][3]: " << t_local_to_body_m[0][0] << ", " << t_local_to_body_m[0][1] << ", " << t_local_to_body_m[0][2]);
693 SG_LOG(SG_FLIGHT,SG_INFO,"t_local_to_body_m[1][3]: " << t_local_to_body_m[1][0] << ", " << t_local_to_body_m[1][1] << ", " << t_local_to_body_m[1][2]);
694 SG_LOG(SG_FLIGHT,SG_INFO,"t_local_to_body_m[2][3]: " << t_local_to_body_m[2][0] << ", " << t_local_to_body_m[2][1] << ", " << t_local_to_body_m[2][2]);
696 SG_LOG(SG_FLIGHT,SG_INFO,"mass: " << mass );
697 SG_LOG(SG_FLIGHT,SG_INFO,"i_xx: " << i_xx );
698 SG_LOG(SG_FLIGHT,SG_INFO,"i_yy: " << i_yy );
699 SG_LOG(SG_FLIGHT,SG_INFO,"i_zz: " << i_zz );
700 SG_LOG(SG_FLIGHT,SG_INFO,"i_xz: " << i_xz );
701 SG_LOG(SG_FLIGHT,SG_INFO,"nlf: " << nlf );
702 SG_LOG(SG_FLIGHT,SG_INFO,"v_rel_wind: " << v_rel_wind );
703 SG_LOG(SG_FLIGHT,SG_INFO,"v_true_kts: " << v_true_kts );
704 SG_LOG(SG_FLIGHT,SG_INFO,"v_rel_ground: " << v_rel_ground );
705 SG_LOG(SG_FLIGHT,SG_INFO,"v_inertial: " << v_inertial );
706 SG_LOG(SG_FLIGHT,SG_INFO,"v_ground_speed: " << v_ground_speed );
707 SG_LOG(SG_FLIGHT,SG_INFO,"v_equiv: " << v_equiv );
708 SG_LOG(SG_FLIGHT,SG_INFO,"v_equiv_kts: " << v_equiv_kts );
709 SG_LOG(SG_FLIGHT,SG_INFO,"v_calibrated: " << v_calibrated );
710 SG_LOG(SG_FLIGHT,SG_INFO,"v_calibrated_kts: " << v_calibrated_kts );
711 SG_LOG(SG_FLIGHT,SG_INFO,"gravity: " << gravity );
712 SG_LOG(SG_FLIGHT,SG_INFO,"centrifugal_relief: " << centrifugal_relief );
713 SG_LOG(SG_FLIGHT,SG_INFO,"alpha: " << alpha );
714 SG_LOG(SG_FLIGHT,SG_INFO,"beta: " << beta );
715 SG_LOG(SG_FLIGHT,SG_INFO,"alpha_dot: " << alpha_dot );
716 SG_LOG(SG_FLIGHT,SG_INFO,"beta_dot: " << beta_dot );
717 SG_LOG(SG_FLIGHT,SG_INFO,"cos_alpha: " << cos_alpha );
718 SG_LOG(SG_FLIGHT,SG_INFO,"sin_alpha: " << sin_alpha );
719 SG_LOG(SG_FLIGHT,SG_INFO,"cos_beta: " << cos_beta );
720 SG_LOG(SG_FLIGHT,SG_INFO,"sin_beta: " << sin_beta );
721 SG_LOG(SG_FLIGHT,SG_INFO,"cos_phi: " << cos_phi );
722 SG_LOG(SG_FLIGHT,SG_INFO,"sin_phi: " << sin_phi );
723 SG_LOG(SG_FLIGHT,SG_INFO,"cos_theta: " << cos_theta );
724 SG_LOG(SG_FLIGHT,SG_INFO,"sin_theta: " << sin_theta );
725 SG_LOG(SG_FLIGHT,SG_INFO,"cos_psi: " << cos_psi );
726 SG_LOG(SG_FLIGHT,SG_INFO,"sin_psi: " << sin_psi );
727 SG_LOG(SG_FLIGHT,SG_INFO,"gamma_vert_rad: " << gamma_vert_rad );
728 SG_LOG(SG_FLIGHT,SG_INFO,"gamma_horiz_rad: " << gamma_horiz_rad );
729 SG_LOG(SG_FLIGHT,SG_INFO,"sigma: " << sigma );
730 SG_LOG(SG_FLIGHT,SG_INFO,"density: " << density );
731 SG_LOG(SG_FLIGHT,SG_INFO,"v_sound: " << v_sound );
732 SG_LOG(SG_FLIGHT,SG_INFO,"mach_number: " << mach_number );
733 SG_LOG(SG_FLIGHT,SG_INFO,"static_pressure: " << static_pressure );
734 SG_LOG(SG_FLIGHT,SG_INFO,"total_pressure: " << total_pressure );
735 SG_LOG(SG_FLIGHT,SG_INFO,"impact_pressure: " << impact_pressure );
736 SG_LOG(SG_FLIGHT,SG_INFO,"dynamic_pressure: " << dynamic_pressure );
737 SG_LOG(SG_FLIGHT,SG_INFO,"static_temperature: " << static_temperature );
738 SG_LOG(SG_FLIGHT,SG_INFO,"total_temperature: " << total_temperature );
739 SG_LOG(SG_FLIGHT,SG_INFO,"sea_level_radius: " << sea_level_radius );
740 SG_LOG(SG_FLIGHT,SG_INFO,"earth_position_angle: " << earth_position_angle );
741 SG_LOG(SG_FLIGHT,SG_INFO,"runway_altitude: " << runway_altitude );
742 SG_LOG(SG_FLIGHT,SG_INFO,"runway_latitude: " << runway_latitude );
743 SG_LOG(SG_FLIGHT,SG_INFO,"runway_longitude: " << runway_longitude );
744 SG_LOG(SG_FLIGHT,SG_INFO,"runway_heading: " << runway_heading );
745 SG_LOG(SG_FLIGHT,SG_INFO,"radius_to_rwy: " << radius_to_rwy );
746 SG_LOG(SG_FLIGHT,SG_INFO,"climb_rate: " << climb_rate );
747 SG_LOG(SG_FLIGHT,SG_INFO,"sin_lat_geocentric: " << sin_lat_geocentric );
748 SG_LOG(SG_FLIGHT,SG_INFO,"cos_lat_geocentric: " << cos_lat_geocentric );
749 SG_LOG(SG_FLIGHT,SG_INFO,"sin_longitude: " << sin_longitude );
750 SG_LOG(SG_FLIGHT,SG_INFO,"cos_longitude: " << cos_longitude );
751 SG_LOG(SG_FLIGHT,SG_INFO,"sin_latitude: " << sin_latitude );
752 SG_LOG(SG_FLIGHT,SG_INFO,"cos_latitude: " << cos_latitude );
753 SG_LOG(SG_FLIGHT,SG_INFO,"altitude_agl: " << altitude_agl );
757 void fgToggleFDMdataLogging(void) {
758 cur_fdm_state->ToggleDataLogging();