]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/LaRCsim/LaRCsim.cxx
Improve timing statistics
[flightgear.git] / src / FDM / LaRCsim / LaRCsim.cxx
index 5683feb48896dff609928e8d790fea90d1262d67..850532f34532e698e28c3bbb84cca0899f846377 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started October 1998.
 //
-// Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
+// Copyright (C) 1998  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <math.h>
 #include <string.h>            // strcmp()
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/scene/model/location.hxx>
 #include <simgear/scene/model/placement.hxx>
 
-#include <Aircraft/aircraft.hxx>
-#include <Controls/controls.hxx>
+#include <Aircraft/controls.hxx>
 #include <FDM/flight.hxx>
 #include <FDM/UIUCModel/uiuc_aircraft.h>
 #include <Main/fg_props.hxx>
@@ -46,6 +48,8 @@
 
 
 FGLaRCsim::FGLaRCsim( double dt ) {
+    mass=i_xx=i_yy=i_zz=i_xz=0;
+
 //     set_delta_t( dt );
 
     speed_up = fgGetNode("/sim/speed-up", true);
@@ -281,12 +285,14 @@ void FGLaRCsim::update( double dt ) {
 
     Throttle_pct = globals->get_controls()->get_throttle( 0 ) * 1.0;
 
-    Brake_pct[0] = globals->get_controls()->get_brake( 1 );
-    Brake_pct[1] = globals->get_controls()->get_brake( 0 );
+    Brake_pct[0] = globals->get_controls()->get_brake_right();
+    Brake_pct[1] = globals->get_controls()->get_brake_left();
 
     // Inform LaRCsim of the local terrain altitude
-    // Runway_altitude = get_Runway_altitude();
-    Runway_altitude = getACModel()->get3DModel()->getSGLocation()->get_cur_elev_m() * SG_METER_TO_FEET;
+    Runway_altitude
+      = get_groundlevel_m(Latitude, Longitude, Altitude * SG_FEET_TO_METER)
+      * SG_METER_TO_FEET;
+
     // Weather
     /* V_north_airmass = get_V_north_airmass();
        V_east_airmass =  get_V_east_airmass();
@@ -325,7 +331,7 @@ void FGLaRCsim::update( double dt ) {
 
       // flaps with transition occuring in uiuc_aerodeflections.cpp
       if (use_flaps) {
-      fgSetDouble("/surface-positions/flight/flap-pos-norm",               flap_pos_pct);
+      fgSetDouble("/surface-positions/flight/flap-pos-norm",               flap_pos_norm);
       }
 
       // spoilers with transition occurring in uiuc_aerodeflections.cpp
@@ -690,7 +696,6 @@ bool FGLaRCsim::copy_from_LaRCsim() {
     _set_Altitude_AGL( Altitude - Runway_altitude );
 
     // Miscellaneous quantities
-    _set_T_Local_to_Body(T_local_to_body_m);
     // set_Gravity( Gravity );
     // set_Centrifugal_relief( Centrifugal_relief );
 
@@ -704,9 +709,9 @@ bool FGLaRCsim::copy_from_LaRCsim() {
     // set_Cos_beta( Cos_beta );
     // set_Sin_beta( Sin_beta );
 
-    _set_Cos_phi( Cos_phi );
+    // _set_Cos_phi( Cos_phi );
     // set_Sin_phi( Sin_phi );
-    _set_Cos_theta( Cos_theta );
+    // _set_Cos_theta( Cos_theta );
     // set_Sin_theta( Sin_theta );
     // set_Cos_psi( Cos_psi );
     // set_Sin_psi( Sin_psi );
@@ -742,11 +747,6 @@ bool FGLaRCsim::copy_from_LaRCsim() {
     //                        D_pilot_above_rwy );
     // set_Pilot_Rwy_Rwy( X_pilot_rwy, Y_pilot_rwy, H_pilot_rwy );
 
-    _set_sin_lat_geocentric(Lat_geocentric);
-    _set_cos_lat_geocentric(Lat_geocentric);
-    _set_sin_cos_longitude(Longitude);
-    _set_sin_cos_latitude(Latitude);
-
     // printf("sin_lat_geo %f  cos_lat_geo %f\n", sin_Lat_geoc, cos_Lat_geoc);
     // printf("sin_lat     %f  cos_lat     %f\n", 
     //        get_sin_latitude(), get_cos_latitude());