Fixed AOA reading on HUD.
Continued work on time jitter compensation.
This commit is contained in:
parent
529e57a87c
commit
442fb251e4
4 changed files with 71 additions and 12 deletions
|
@ -150,7 +150,7 @@ double get_aoa( void )
|
||||||
FGState *f;
|
FGState *f;
|
||||||
|
|
||||||
f = current_aircraft.fdm_state;
|
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
|
// Revision 1.28 1999/01/07 20:24:17 curt
|
||||||
// Update fgGENERAL to FGGeneral.
|
// Update fgGENERAL to FGGeneral.
|
||||||
//
|
//
|
||||||
|
|
|
@ -322,7 +322,7 @@ int fgLaRCsim_2_FGState (FGState& f) {
|
||||||
// f.set_Omega_Total( P_total, Q_total, R_total );
|
// f.set_Omega_Total( P_total, Q_total, R_total );
|
||||||
|
|
||||||
// f.set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
|
// 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
|
// Positions
|
||||||
f.set_Geocentric_Position( Lat_geocentric, Lon_geocentric,
|
f.set_Geocentric_Position( Lat_geocentric, Lon_geocentric,
|
||||||
|
@ -335,7 +335,7 @@ int fgLaRCsim_2_FGState (FGState& f) {
|
||||||
// f.set_Gravity( Gravity );
|
// f.set_Gravity( Gravity );
|
||||||
// f.set_Centrifugal_relief( Centrifugal_relief );
|
// f.set_Centrifugal_relief( Centrifugal_relief );
|
||||||
|
|
||||||
// f.set_Alpha( Alpha );
|
f.set_Alpha( Alpha );
|
||||||
f.set_Beta( Beta );
|
f.set_Beta( Beta );
|
||||||
// f.set_Alpha_dot( Alpha_dot );
|
// f.set_Alpha_dot( Alpha_dot );
|
||||||
// f.set_Beta_dot( Beta_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
|
// Revision 1.8 1998/12/18 23:37:06 curt
|
||||||
// Collapsed out the FGState variables not currently needed. They are just
|
// 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
|
// commented out and can be readded easily at any time. The point of this
|
||||||
|
|
|
@ -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
|
// Run multiloop iterations of the flight model
|
||||||
int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter) {
|
int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter) {
|
||||||
double time_step, start_elev, end_elev;
|
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
|
// Revision 1.8 1999/01/08 03:23:51 curt
|
||||||
// Beginning work on compensating for sim time vs. real world time "jitter".
|
// Beginning work on compensating for sim time vs. real world time "jitter".
|
||||||
//
|
//
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
|
|
||||||
`FGState::get_Gamma_vert_rad ()'
|
`FGState::get_Gamma_vert_rad ()'
|
||||||
`FGState::get_Climb_Rate ()'
|
`FGState::get_Climb_Rate ()'
|
||||||
|
`FGState::get_Alpha ()'
|
||||||
`FGState::get_Beta ()'
|
`FGState::get_Beta ()'
|
||||||
|
|
||||||
`FGState::get_Runway_altitude ()'
|
`FGState::get_Runway_altitude ()'
|
||||||
|
@ -61,6 +62,10 @@
|
||||||
`FGState::get_Sea_level_radius ()'
|
`FGState::get_Sea_level_radius ()'
|
||||||
`FGState::get_Earth_position_angle ()'
|
`FGState::get_Earth_position_angle ()'
|
||||||
|
|
||||||
|
`FGState::get_Latitude_dot()'
|
||||||
|
`FGState::get_Longitude_dot()'
|
||||||
|
`FGState::get_Radius_dot()'
|
||||||
|
|
||||||
`FGState::get_Dx_cg ()'
|
`FGState::get_Dx_cg ()'
|
||||||
`FGState::get_Dy_cg ()'
|
`FGState::get_Dy_cg ()'
|
||||||
`FGState::get_Dz_cg ()'
|
`FGState::get_Dz_cg ()'
|
||||||
|
@ -511,14 +516,14 @@ public:
|
||||||
|
|
||||||
FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
|
FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
|
||||||
// inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
|
// inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
|
||||||
// inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
|
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_Longitude_dot() const { return geocentric_rates_v[1]; }
|
||||||
// inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
|
inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
|
||||||
/* inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
|
inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
|
||||||
geocentric_rates_v[0] = lat;
|
geocentric_rates_v[0] = lat;
|
||||||
geocentric_rates_v[1] = lon;
|
geocentric_rates_v[1] = lon;
|
||||||
geocentric_rates_v[2] = rad;
|
geocentric_rates_v[2] = rad;
|
||||||
} */
|
}
|
||||||
|
|
||||||
/*=============================== Positions ===============================*/
|
/*=============================== Positions ===============================*/
|
||||||
|
|
||||||
|
@ -538,7 +543,8 @@ public:
|
||||||
inline void set_Radius_to_vehicle(double radius) {
|
inline void set_Radius_to_vehicle(double radius) {
|
||||||
geocentric_position_v[2] = 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[0] = lat;
|
||||||
geocentric_position_v[1] = lon;
|
geocentric_position_v[1] = lon;
|
||||||
geocentric_position_v[2] = rad;
|
geocentric_position_v[2] = rad;
|
||||||
|
@ -621,8 +627,8 @@ public:
|
||||||
// inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
|
// inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
|
||||||
|
|
||||||
double alpha, beta, alpha_dot, beta_dot; // in radians
|
double alpha, beta, alpha_dot, beta_dot; // in radians
|
||||||
// inline double get_Alpha() const { return alpha; }
|
inline double get_Alpha() const { return alpha; }
|
||||||
// inline void set_Alpha( double a ) { alpha = a; }
|
inline void set_Alpha( double a ) { alpha = a; }
|
||||||
inline double get_Beta() const { return beta; }
|
inline double get_Beta() const { return beta; }
|
||||||
inline void set_Beta( double b ) { beta = b; }
|
inline void set_Beta( double b ) { beta = b; }
|
||||||
// inline double get_Alpha_dot() const { return alpha_dot; }
|
// 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
|
// Revision 1.8 1999/01/08 03:23:52 curt
|
||||||
// Beginning work on compensating for sim time vs. real world time "jitter".
|
// Beginning work on compensating for sim time vs. real world time "jitter".
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue