]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed AOA reading on HUD.
authorcurt <curt>
Fri, 8 Jan 1999 19:27:34 +0000 (19:27 +0000)
committercurt <curt>
Fri, 8 Jan 1999 19:27:34 +0000 (19:27 +0000)
Continued work on time jitter compensation.

Cockpit/cockpit.cxx
FDM/LaRCsim.cxx
FDM/flight.cxx
FDM/flight.hxx

index 1b4c4c92eb4ddb83e6954b10dbbde21845cfe6fe..a489474b9840849370b6291dbe2c0002d7639a3b 100644 (file)
@@ -150,7 +150,7 @@ double get_aoa( void )
        FGState *f;
               
        f = current_aircraft.fdm_state;
        FGState *f;
               
        f = current_aircraft.fdm_state;
-       return( f->get_Gamma_vert_rad() * RAD_TO_DEG );
+       return( f->get_Alpha() * RAD_TO_DEG );
 }
 
 double get_roll( void )
 }
 
 double get_roll( void )
@@ -303,6 +303,10 @@ void fgCockpitUpdate( void ) {
 
 
 // $Log$
 
 
 // $Log$
+// Revision 1.29  1999/01/08 19:27:34  curt
+// Fixed AOA reading on HUD.
+// Continued work on time jitter compensation.
+//
 // Revision 1.28  1999/01/07 20:24:17  curt
 // Update fgGENERAL to FGGeneral.
 //
 // Revision 1.28  1999/01/07 20:24:17  curt
 // Update fgGENERAL to FGGeneral.
 //
index fe6034f42e59237e3817838209bab4a0c0fb21c7..5a714f9fcbf9bea53cc5ec1b970ebfdf6378604a 100644 (file)
@@ -322,7 +322,7 @@ int fgLaRCsim_2_FGState (FGState& f) {
     // f.set_Omega_Total( P_total, Q_total, R_total );
     
     // f.set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
     // f.set_Omega_Total( P_total, Q_total, R_total );
     
     // f.set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
-    // f.set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
+    f.set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
 
     // Positions
     f.set_Geocentric_Position( Lat_geocentric, Lon_geocentric, 
 
     // Positions
     f.set_Geocentric_Position( Lat_geocentric, Lon_geocentric, 
@@ -335,7 +335,7 @@ int fgLaRCsim_2_FGState (FGState& f) {
     // f.set_Gravity( Gravity );
     // f.set_Centrifugal_relief( Centrifugal_relief );
 
     // f.set_Gravity( Gravity );
     // f.set_Centrifugal_relief( Centrifugal_relief );
 
-    // f.set_Alpha( Alpha );
+    f.set_Alpha( Alpha );
     f.set_Beta( Beta );
     // f.set_Alpha_dot( Alpha_dot );
     // f.set_Beta_dot( Beta_dot );
     f.set_Beta( Beta );
     // f.set_Alpha_dot( Alpha_dot );
     // f.set_Beta_dot( Beta_dot );
@@ -389,6 +389,10 @@ int fgLaRCsim_2_FGState (FGState& f) {
 
 
 // $Log$
 
 
 // $Log$
+// Revision 1.9  1999/01/08 19:27:36  curt
+// Fixed AOA reading on HUD.
+// Continued work on time jitter compensation.
+//
 // Revision 1.8  1998/12/18 23:37:06  curt
 // Collapsed out the FGState variables not currently needed.  They are just
 // commented out and can be readded easily at any time.  The point of this
 // Revision 1.8  1998/12/18 23:37:06  curt
 // Collapsed out the FGState variables not currently needed.  They are just
 // commented out and can be readded easily at any time.  The point of this
index 3225b32270a7f5ca0e08b1b5ff97374e4fbcc9fa..07f756fd2af041b1c8f8d1c7314962617447ca29 100644 (file)
@@ -90,6 +90,43 @@ int fgFlightModelInit(int model, FGState& f, double dt) {
 }
 
 
 }
 
 
+// Extrapolate fdm based on jitter time (in milliseconds)
+static FGState extrapolate_fdm( FGState &base, int jitter ) {
+    FGState result;
+
+    double dt = jitter / 1000.0;
+    // cout << "dt = " << dt << endl;
+
+    // start by making a straight up copy
+    result = base;
+
+    double lon = base.get_Longitude() + base.get_Longitude_dot() * dt;
+    double lon_geoc = base.get_Lon_geocentric() + base.get_Longitude_dot() * dt;
+
+    double lat = base.get_Latitude() + base.get_Latitude_dot() * dt;
+    double lat_geoc = base.get_Lat_geocentric() + base.get_Latitude_dot() * dt;
+
+    /*
+    cout << "( " << base.get_Longitude() << ", " << 
+       base.get_Latitude() << " )" << endl;
+    cout << "( " << lon << ", " << lat << " )" << endl;
+    cout << "( " << base.get_Longitude_dot() * dt << ", " << 
+       base.get_Latitude_dot() * dt << ", " << 
+       base.get_Radius_dot() * dt << " )" << endl;
+       */
+
+    double alt = base.get_Altitude() + base.get_Radius_dot() * dt;
+    double radius = base.get_Radius_to_vehicle() + base.get_Radius_dot() * dt;
+
+    result.set_Longitude( lon );
+    result.set_Latitude( lat );
+    result.set_Altitude( alt );
+    // result.set_Geocentric_Position( lon_geoc, lat_geoc, radius );
+
+    return result;
+}
+
+
 // Run multiloop iterations of the flight model
 int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter) {
     double time_step, start_elev, end_elev;
 // Run multiloop iterations of the flight model
 int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter) {
     double time_step, start_elev, end_elev;
@@ -119,7 +156,7 @@ int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter) {
        base_fdm_state.set_Climb_Rate( (end_elev - start_elev) / time_step );
     }
 
        base_fdm_state.set_Climb_Rate( (end_elev - start_elev) / time_step );
     }
 
-    f = base_fdm_state;
+    f = extrapolate_fdm( base_fdm_state, jitter );
 
     return 1;
 }
 
     return 1;
 }
@@ -147,6 +184,10 @@ void fgFlightModelSetAltitude(int model, double alt_meters) {
 
 
 // $Log$
 
 
 // $Log$
+// Revision 1.9  1999/01/08 19:27:37  curt
+// Fixed AOA reading on HUD.
+// Continued work on time jitter compensation.
+//
 // Revision 1.8  1999/01/08 03:23:51  curt
 // Beginning work on compensating for sim time vs. real world time "jitter".
 //
 // Revision 1.8  1999/01/08 03:23:51  curt
 // Beginning work on compensating for sim time vs. real world time "jitter".
 //
index 17d3c47332b45fab30f7433d429ca2b6866f8400..9cd463723144bc80d1c95be2167757582c66fce8 100644 (file)
@@ -52,6 +52,7 @@
 
    `FGState::get_Gamma_vert_rad ()'
    `FGState::get_Climb_Rate ()'
 
    `FGState::get_Gamma_vert_rad ()'
    `FGState::get_Climb_Rate ()'
+   `FGState::get_Alpha ()'
    `FGState::get_Beta ()'
 
    `FGState::get_Runway_altitude ()'
    `FGState::get_Beta ()'
 
    `FGState::get_Runway_altitude ()'
    `FGState::get_Sea_level_radius ()'
    `FGState::get_Earth_position_angle ()'
 
    `FGState::get_Sea_level_radius ()'
    `FGState::get_Earth_position_angle ()'
 
+   `FGState::get_Latitude_dot()'
+   `FGState::get_Longitude_dot()'
+   `FGState::get_Radius_dot()'
+
    `FGState::get_Dx_cg ()'
    `FGState::get_Dy_cg ()'
    `FGState::get_Dz_cg ()'
    `FGState::get_Dx_cg ()'
    `FGState::get_Dy_cg ()'
    `FGState::get_Dz_cg ()'
@@ -511,14 +516,14 @@ public:
 
     FG_VECTOR_3    geocentric_rates_v;     // Geocentric linear velocities
     // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
 
     FG_VECTOR_3    geocentric_rates_v;     // Geocentric linear velocities
     // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
-    // inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
-    // inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
-    // inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
-    /* inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
+    inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
+    inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
+    inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
+    inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
        geocentric_rates_v[0] = lat;
        geocentric_rates_v[1] = lon;
        geocentric_rates_v[2] = rad;
        geocentric_rates_v[0] = lat;
        geocentric_rates_v[1] = lon;
        geocentric_rates_v[2] = rad;
-    } */
+    }
     
     /*=============================== Positions ===============================*/
 
     
     /*=============================== Positions ===============================*/
 
@@ -538,7 +543,8 @@ public:
     inline void set_Radius_to_vehicle(double radius) {
        geocentric_position_v[2] = radius;
     }
     inline void set_Radius_to_vehicle(double radius) {
        geocentric_position_v[2] = radius;
     }
-    inline void set_Geocentric_Position( double lat, double lon, double rad ) {
+
+//     inline void set_Geocentric_Position( double lat, double lon, double rad ) {
        geocentric_position_v[0] = lat;
        geocentric_position_v[1] = lon;
        geocentric_position_v[2] = rad;
        geocentric_position_v[0] = lat;
        geocentric_position_v[1] = lon;
        geocentric_position_v[2] = rad;
@@ -621,8 +627,8 @@ public:
     // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
 
     double    alpha, beta, alpha_dot, beta_dot;   // in radians  
     // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
 
     double    alpha, beta, alpha_dot, beta_dot;   // in radians  
-    // inline double get_Alpha() const { return alpha; }
-    // inline void set_Alpha( double a ) { alpha = a; }
+    inline double get_Alpha() const { return alpha; }
+    inline void set_Alpha( double a ) { alpha = a; }
     inline double get_Beta() const { return beta; }
     inline void set_Beta( double b ) { beta = b; }
     // inline double get_Alpha_dot() const { return alpha_dot; }
     inline double get_Beta() const { return beta; }
     inline void set_Beta( double b ) { beta = b; }
     // inline double get_Alpha_dot() const { return alpha_dot; }
@@ -791,6 +797,10 @@ void fgFlightModelSetAltitude(int model, double alt_meters);
 
 
 // $Log$
 
 
 // $Log$
+// Revision 1.9  1999/01/08 19:27:38  curt
+// Fixed AOA reading on HUD.
+// Continued work on time jitter compensation.
+//
 // Revision 1.8  1999/01/08 03:23:52  curt
 // Beginning work on compensating for sim time vs. real world time "jitter".
 //
 // Revision 1.8  1999/01/08 03:23:52  curt
 // Beginning work on compensating for sim time vs. real world time "jitter".
 //