1
0
Fork 0

Fixed AOA reading on HUD.

Continued work on time jitter compensation.
This commit is contained in:
curt 1999-01-08 19:27:34 +00:00
parent 529e57a87c
commit 442fb251e4
4 changed files with 71 additions and 12 deletions

View file

@ -150,7 +150,7 @@ double get_aoa( void )
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 )
@ -303,6 +303,10 @@ void fgCockpitUpdate( void ) {
// $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.
//

View 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_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,
@ -335,7 +335,7 @@ int fgLaRCsim_2_FGState (FGState& f) {
// 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 );
@ -389,6 +389,10 @@ int fgLaRCsim_2_FGState (FGState& f) {
// $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

View 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;
@ -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 );
}
f = base_fdm_state;
f = extrapolate_fdm( base_fdm_state, jitter );
return 1;
}
@ -147,6 +184,10 @@ void fgFlightModelSetAltitude(int model, double alt_meters) {
// $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".
//

View file

@ -52,6 +52,7 @@
`FGState::get_Gamma_vert_rad ()'
`FGState::get_Climb_Rate ()'
`FGState::get_Alpha ()'
`FGState::get_Beta ()'
`FGState::get_Runway_altitude ()'
@ -61,6 +62,10 @@
`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 ()'
@ -511,14 +516,14 @@ public:
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;
} */
}
/*=============================== Positions ===============================*/
@ -538,7 +543,8 @@ public:
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;
@ -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 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; }
@ -791,6 +797,10 @@ void fgFlightModelSetAltitude(int model, double alt_meters);
// $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".
//