Converted fgFLIGHT to a class.
This commit is contained in:
parent
711080b063
commit
7fbb963a39
15 changed files with 916 additions and 753 deletions
|
@ -50,14 +50,16 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
|
||||||
|
|
||||||
FG_LOG( FG_FLIGHT, FG_DEBUG,
|
FG_LOG( FG_FLIGHT, FG_DEBUG,
|
||||||
"Pos = ("
|
"Pos = ("
|
||||||
<< (FG_Longitude * 3600.0 * RAD_TO_DEG) << ","
|
<< (f->get_Longitude() * 3600.0 * RAD_TO_DEG) << ","
|
||||||
<< (FG_Latitude * 3600.0 * RAD_TO_DEG) << ","
|
<< (f->get_Latitude() * 3600.0 * RAD_TO_DEG) << ","
|
||||||
<< FG_Altitude
|
<< f->get_Altitude()
|
||||||
<< ") (Phi,Theta,Psi)=("
|
<< ") (Phi,Theta,Psi)=("
|
||||||
<< FG_Phi << "," << FG_Theta << "," << FG_Psi << ")" );
|
<< f->get_Phi() << ","
|
||||||
|
<< f->get_Theta() << ","
|
||||||
|
<< f->get_Psi() << ")" );
|
||||||
|
|
||||||
FG_LOG( FG_FLIGHT, FG_DEBUG,
|
FG_LOG( FG_FLIGHT, FG_DEBUG,
|
||||||
"Kts = " << FG_V_equiv_kts
|
"Kts = " << f->get_V_equiv_kts()
|
||||||
<< " Elev = " << controls.get_elevator()
|
<< " Elev = " << controls.get_elevator()
|
||||||
<< " Aileron = " << controls.get_aileron()
|
<< " Aileron = " << controls.get_aileron()
|
||||||
<< " Rudder = " << controls.get_rudder()
|
<< " Rudder = " << controls.get_rudder()
|
||||||
|
@ -66,6 +68,9 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.5 1998/12/03 01:14:58 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.4 1998/11/06 21:17:31 curt
|
// Revision 1.4 1998/11/06 21:17:31 curt
|
||||||
// Converted to new logstream debugging facility. This allows release
|
// Converted to new logstream debugging facility. This allows release
|
||||||
// builds with no messages at all (and no performance impact) by using
|
// builds with no messages at all (and no performance impact) by using
|
||||||
|
|
|
@ -53,7 +53,7 @@ static double get_speed( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_V_equiv_kts ); // Make an explicit function call.
|
return( f->get_V_equiv_kts() ); // Make an explicit function call.
|
||||||
}
|
}
|
||||||
|
|
||||||
static double get_aoa( void )
|
static double get_aoa( void )
|
||||||
|
@ -61,7 +61,7 @@ static double get_aoa( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Gamma_vert_rad * RAD_TO_DEG );
|
return( f->get_Gamma_vert_rad() * RAD_TO_DEG );
|
||||||
}
|
}
|
||||||
|
|
||||||
static double fgAPget_roll( void )
|
static double fgAPget_roll( void )
|
||||||
|
@ -69,7 +69,7 @@ static double fgAPget_roll( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Phi * RAD_TO_DEG );
|
return( f->get_Phi() * RAD_TO_DEG );
|
||||||
}
|
}
|
||||||
|
|
||||||
static double get_pitch( void )
|
static double get_pitch( void )
|
||||||
|
@ -77,7 +77,7 @@ static double get_pitch( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Theta );
|
return( f->get_Theta() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double fgAPget_heading( void )
|
double fgAPget_heading( void )
|
||||||
|
@ -85,7 +85,7 @@ double fgAPget_heading( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Psi * RAD_TO_DEG );
|
return( f->get_Psi() * RAD_TO_DEG );
|
||||||
}
|
}
|
||||||
|
|
||||||
static double fgAPget_altitude( void )
|
static double fgAPget_altitude( void )
|
||||||
|
@ -94,7 +94,7 @@ static double fgAPget_altitude( void )
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
return( FG_Altitude * FEET_TO_METER /* -rough_elev */ );
|
return( f->get_Altitude() * FEET_TO_METER /* -rough_elev */ );
|
||||||
}
|
}
|
||||||
|
|
||||||
static double fgAPget_climb( void )
|
static double fgAPget_climb( void )
|
||||||
|
@ -104,7 +104,7 @@ static double fgAPget_climb( void )
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
// return in meters per minute
|
// return in meters per minute
|
||||||
return( FG_Climb_Rate * FEET_TO_METER * 60 );
|
return( f->get_Climb_Rate() * FEET_TO_METER * 60 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static double get_sideslip( void )
|
static double get_sideslip( void )
|
||||||
|
@ -113,7 +113,7 @@ static double get_sideslip( void )
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
return( FG_Beta );
|
return( f->get_Beta() );
|
||||||
}
|
}
|
||||||
|
|
||||||
static double fgAPget_agl( void )
|
static double fgAPget_agl( void )
|
||||||
|
@ -122,7 +122,7 @@ static double fgAPget_agl( void )
|
||||||
double agl;
|
double agl;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
agl = FG_Altitude * FEET_TO_METER - scenery.cur_elev;
|
agl = f->get_Altitude() * FEET_TO_METER - scenery.cur_elev;
|
||||||
|
|
||||||
return( agl );
|
return( agl );
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,9 @@ double get_latitude( void )
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
// return( toDM(FG_Latitude * RAD_TO_DEG) );
|
// return( toDM(FG_Latitude * RAD_TO_DEG) );
|
||||||
return((double)((int)( FG_Latitude * RAD_TO_DEG)) );
|
return((double)((int)( f->get_Latitude() * RAD_TO_DEG)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_lat_min( void )
|
double get_lat_min( void )
|
||||||
{
|
{
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
@ -79,7 +80,7 @@ double get_lat_min( void )
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
a = FG_Latitude * RAD_TO_DEG;
|
a = f->get_Latitude() * RAD_TO_DEG;
|
||||||
if (a < 0.0) {
|
if (a < 0.0) {
|
||||||
a = -a;
|
a = -a;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ double get_longitude( void )
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
// return( toDM(FG_Longitude * RAD_TO_DEG) );
|
// return( toDM(FG_Longitude * RAD_TO_DEG) );
|
||||||
return((double)((int) (FG_Longitude * RAD_TO_DEG)) );
|
return((double)((int) (f->get_Longitude() * RAD_TO_DEG)) );
|
||||||
}
|
}
|
||||||
double get_long_min( void )
|
double get_long_min( void )
|
||||||
{
|
{
|
||||||
|
@ -103,7 +104,7 @@ double get_long_min( void )
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
a = FG_Longitude * RAD_TO_DEG;
|
a = f->get_Longitude() * RAD_TO_DEG;
|
||||||
if (a < 0.0) {
|
if (a < 0.0) {
|
||||||
a = -a;
|
a = -a;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,7 @@ double get_speed( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_V_equiv_kts ); // Make an explicit function call.
|
return( f->get_V_equiv_kts() ); // Make an explicit function call.
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_aoa( void )
|
double get_aoa( void )
|
||||||
|
@ -149,7 +150,7 @@ double get_aoa( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Gamma_vert_rad * RAD_TO_DEG );
|
return( f->get_Gamma_vert_rad() * RAD_TO_DEG );
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_roll( void )
|
double get_roll( void )
|
||||||
|
@ -157,7 +158,7 @@ double get_roll( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Phi );
|
return( f->get_Phi() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_pitch( void )
|
double get_pitch( void )
|
||||||
|
@ -165,7 +166,7 @@ double get_pitch( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Theta );
|
return( f->get_Theta() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_heading( void )
|
double get_heading( void )
|
||||||
|
@ -173,7 +174,7 @@ double get_heading( void )
|
||||||
fgFLIGHT *f;
|
fgFLIGHT *f;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
return( FG_Psi * RAD_TO_DEG );
|
return( f->get_Psi() * RAD_TO_DEG );
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_altitude( void )
|
double get_altitude( void )
|
||||||
|
@ -182,13 +183,13 @@ double get_altitude( void )
|
||||||
// double rough_elev;
|
// double rough_elev;
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
// rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
|
// rough_elev = mesh_altitude(f->get_Longitude() * RAD_TO_ARCSEC,
|
||||||
// FG_Latitude * RAD_TO_ARCSEC);
|
// f->get_Latitude() * RAD_TO_ARCSEC);
|
||||||
|
|
||||||
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
||||||
return FG_Altitude;
|
return f->get_Altitude();
|
||||||
} else {
|
} else {
|
||||||
return FG_Altitude * FEET_TO_METER;
|
return f->get_Altitude() * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,9 +200,9 @@ double get_agl( void )
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
||||||
return FG_Altitude - scenery.cur_elev * METER_TO_FEET;
|
return f->get_Altitude() - scenery.cur_elev * METER_TO_FEET;
|
||||||
} else {
|
} else {
|
||||||
return FG_Altitude * FEET_TO_METER - scenery.cur_elev;
|
return f->get_Altitude() * FEET_TO_METER - scenery.cur_elev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +212,7 @@ double get_sideslip( void )
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
return( FG_Beta );
|
return( f->get_Beta() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_frame_rate( void )
|
double get_frame_rate( void )
|
||||||
|
@ -249,9 +250,9 @@ double get_climb_rate( void )
|
||||||
f = current_aircraft.flight;
|
f = current_aircraft.flight;
|
||||||
|
|
||||||
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
||||||
return FG_Climb_Rate * 60.0;
|
return f->get_Climb_Rate() * 60.0;
|
||||||
} else {
|
} else {
|
||||||
return FG_Climb_Rate * FEET_TO_METER * 60.0;
|
return f->get_Climb_Rate() * FEET_TO_METER * 60.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,6 +312,9 @@ void fgCockpitUpdate( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.24 1998/12/03 01:16:00 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.23 1998/11/09 23:38:50 curt
|
// Revision 1.23 1998/11/09 23:38:50 curt
|
||||||
// Panel updates from Friedemann.
|
// Panel updates from Friedemann.
|
||||||
//
|
//
|
||||||
|
|
693
FDM/LaRCsim.cxx
693
FDM/LaRCsim.cxx
|
@ -42,13 +42,13 @@ int fgLaRCsimInit(double dt) {
|
||||||
|
|
||||||
|
|
||||||
// Run an iteration of the EOM (equations of motion)
|
// Run an iteration of the EOM (equations of motion)
|
||||||
int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) {
|
int fgLaRCsimUpdate(fgFLIGHT& f, int multiloop) {
|
||||||
double save_alt = 0.0;
|
double save_alt = 0.0;
|
||||||
|
|
||||||
// lets try to avoid really screwing up the LaRCsim model
|
// lets try to avoid really screwing up the LaRCsim model
|
||||||
if ( FG_Altitude < -9000 ) {
|
if ( f.get_Altitude() < -9000 ) {
|
||||||
save_alt = FG_Altitude;
|
save_alt = f.get_Altitude();
|
||||||
FG_Altitude = 0;
|
f.set_Altitude( 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// translate FG to LaRCsim structure
|
// translate FG to LaRCsim structure
|
||||||
|
@ -68,8 +68,8 @@ int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) {
|
||||||
fgLaRCsim_2_Flight(f);
|
fgLaRCsim_2_Flight(f);
|
||||||
|
|
||||||
// but lets restore our original bogus altitude when we are done
|
// but lets restore our original bogus altitude when we are done
|
||||||
if ( save_alt < -9000 ) {
|
if ( save_alt < -9000.0 ) {
|
||||||
FG_Altitude = save_alt;
|
f.set_Altitude( save_alt );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -77,7 +77,7 @@ int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) {
|
||||||
|
|
||||||
|
|
||||||
// Convert from the fgFLIGHT struct to the LaRCsim generic_ struct
|
// Convert from the fgFLIGHT struct to the LaRCsim generic_ struct
|
||||||
int fgFlight_2_LaRCsim (fgFLIGHT *f) {
|
int fgFlight_2_LaRCsim (fgFLIGHT& f) {
|
||||||
|
|
||||||
Lat_control = controls.get_aileron();
|
Lat_control = controls.get_aileron();
|
||||||
Long_control = controls.get_elevator();
|
Long_control = controls.get_elevator();
|
||||||
|
@ -86,357 +86,358 @@ int fgFlight_2_LaRCsim (fgFLIGHT *f) {
|
||||||
Throttle_pct = controls.get_throttle( 0 );
|
Throttle_pct = controls.get_throttle( 0 );
|
||||||
Brake_pct = controls.get_brake( 0 );
|
Brake_pct = controls.get_brake( 0 );
|
||||||
|
|
||||||
Mass = FG_Mass;
|
Mass = f.get_Mass();
|
||||||
I_xx = FG_I_xx;
|
I_xx = f.get_I_xx();
|
||||||
I_yy = FG_I_yy;
|
I_yy = f.get_I_yy();
|
||||||
I_zz = FG_I_zz;
|
I_zz = f.get_I_zz();
|
||||||
I_xz = FG_I_xz;
|
I_xz = f.get_I_xz();
|
||||||
Dx_pilot = FG_Dx_pilot;
|
Dx_pilot = f.get_Dx_pilot();
|
||||||
Dy_pilot = FG_Dy_pilot;
|
Dy_pilot = f.get_Dy_pilot();
|
||||||
Dz_pilot = FG_Dz_pilot;
|
Dz_pilot = f.get_Dz_pilot();
|
||||||
Dx_cg = FG_Dx_cg;
|
Dx_cg = f.get_Dx_cg();
|
||||||
Dy_cg = FG_Dy_cg;
|
Dy_cg = f.get_Dy_cg();
|
||||||
Dz_cg = FG_Dz_cg;
|
Dz_cg = f.get_Dz_cg();
|
||||||
F_X = FG_F_X;
|
F_X = f.get_F_X();
|
||||||
F_Y = FG_F_Y;
|
F_Y = f.get_F_Y();
|
||||||
F_Z = FG_F_Z;
|
F_Z = f.get_F_Z();
|
||||||
F_north = FG_F_north;
|
F_north = f.get_F_north();
|
||||||
F_east = FG_F_east;
|
F_east = f.get_F_east();
|
||||||
F_down = FG_F_down;
|
F_down = f.get_F_down();
|
||||||
F_X_aero = FG_F_X_aero;
|
F_X_aero = f.get_F_X_aero();
|
||||||
F_Y_aero = FG_F_Y_aero;
|
F_Y_aero = f.get_F_Y_aero();
|
||||||
F_Z_aero = FG_F_Z_aero;
|
F_Z_aero = f.get_F_Z_aero();
|
||||||
F_X_engine = FG_F_X_engine;
|
F_X_engine = f.get_F_X_engine();
|
||||||
F_Y_engine = FG_F_Y_engine;
|
F_Y_engine = f.get_F_Y_engine();
|
||||||
F_Z_engine = FG_F_Z_engine;
|
F_Z_engine = f.get_F_Z_engine();
|
||||||
F_X_gear = FG_F_X_gear;
|
F_X_gear = f.get_F_X_gear();
|
||||||
F_Y_gear = FG_F_Y_gear;
|
F_Y_gear = f.get_F_Y_gear();
|
||||||
F_Z_gear = FG_F_Z_gear;
|
F_Z_gear = f.get_F_Z_gear();
|
||||||
M_l_rp = FG_M_l_rp;
|
M_l_rp = f.get_M_l_rp();
|
||||||
M_m_rp = FG_M_m_rp;
|
M_m_rp = f.get_M_m_rp();
|
||||||
M_n_rp = FG_M_n_rp;
|
M_n_rp = f.get_M_n_rp();
|
||||||
M_l_cg = FG_M_l_cg;
|
M_l_cg = f.get_M_l_cg();
|
||||||
M_m_cg = FG_M_m_cg;
|
M_m_cg = f.get_M_m_cg();
|
||||||
M_n_cg = FG_M_n_cg;
|
M_n_cg = f.get_M_n_cg();
|
||||||
M_l_aero = FG_M_l_aero;
|
M_l_aero = f.get_M_l_aero();
|
||||||
M_m_aero = FG_M_m_aero;
|
M_m_aero = f.get_M_m_aero();
|
||||||
M_n_aero = FG_M_n_aero;
|
M_n_aero = f.get_M_n_aero();
|
||||||
M_l_engine = FG_M_l_engine;
|
M_l_engine = f.get_M_l_engine();
|
||||||
M_m_engine = FG_M_m_engine;
|
M_m_engine = f.get_M_m_engine();
|
||||||
M_n_engine = FG_M_n_engine;
|
M_n_engine = f.get_M_n_engine();
|
||||||
M_l_gear = FG_M_l_gear;
|
M_l_gear = f.get_M_l_gear();
|
||||||
M_m_gear = FG_M_m_gear;
|
M_m_gear = f.get_M_m_gear();
|
||||||
M_n_gear = FG_M_n_gear;
|
M_n_gear = f.get_M_n_gear();
|
||||||
V_dot_north = FG_V_dot_north;
|
V_dot_north = f.get_V_dot_north();
|
||||||
V_dot_east = FG_V_dot_east;
|
V_dot_east = f.get_V_dot_east();
|
||||||
V_dot_down = FG_V_dot_down;
|
V_dot_down = f.get_V_dot_down();
|
||||||
U_dot_body = FG_U_dot_body;
|
U_dot_body = f.get_U_dot_body();
|
||||||
V_dot_body = FG_V_dot_body;
|
V_dot_body = f.get_V_dot_body();
|
||||||
W_dot_body = FG_W_dot_body;
|
W_dot_body = f.get_W_dot_body();
|
||||||
A_X_cg = FG_A_X_cg;
|
A_X_cg = f.get_A_X_cg();
|
||||||
A_Y_cg = FG_A_Y_cg;
|
A_Y_cg = f.get_A_Y_cg();
|
||||||
A_Z_cg = FG_A_Z_cg;
|
A_Z_cg = f.get_A_Z_cg();
|
||||||
A_X_pilot = FG_A_X_pilot;
|
A_X_pilot = f.get_A_X_pilot();
|
||||||
A_Y_pilot = FG_A_Y_pilot;
|
A_Y_pilot = f.get_A_Y_pilot();
|
||||||
A_Z_pilot = FG_A_Z_pilot;
|
A_Z_pilot = f.get_A_Z_pilot();
|
||||||
N_X_cg = FG_N_X_cg;
|
N_X_cg = f.get_N_X_cg();
|
||||||
N_Y_cg = FG_N_Y_cg;
|
N_Y_cg = f.get_N_Y_cg();
|
||||||
N_Z_cg = FG_N_Z_cg;
|
N_Z_cg = f.get_N_Z_cg();
|
||||||
N_X_pilot = FG_N_X_pilot;
|
N_X_pilot = f.get_N_X_pilot();
|
||||||
N_Y_pilot = FG_N_Y_pilot;
|
N_Y_pilot = f.get_N_Y_pilot();
|
||||||
N_Z_pilot = FG_N_Z_pilot;
|
N_Z_pilot = f.get_N_Z_pilot();
|
||||||
P_dot_body = FG_P_dot_body;
|
P_dot_body = f.get_P_dot_body();
|
||||||
Q_dot_body = FG_Q_dot_body;
|
Q_dot_body = f.get_Q_dot_body();
|
||||||
R_dot_body = FG_R_dot_body;
|
R_dot_body = f.get_R_dot_body();
|
||||||
V_north = FG_V_north;
|
V_north = f.get_V_north();
|
||||||
V_east = FG_V_east;
|
V_east = f.get_V_east();
|
||||||
V_down = FG_V_down;
|
V_down = f.get_V_down();
|
||||||
V_north_rel_ground = FG_V_north_rel_ground;
|
V_north_rel_ground = f.get_V_north_rel_ground();
|
||||||
V_east_rel_ground = FG_V_east_rel_ground;
|
V_east_rel_ground = f.get_V_east_rel_ground();
|
||||||
V_down_rel_ground = FG_V_down_rel_ground;
|
V_down_rel_ground = f.get_V_down_rel_ground();
|
||||||
V_north_airmass = FG_V_north_airmass;
|
V_north_airmass = f.get_V_north_airmass();
|
||||||
V_east_airmass = FG_V_east_airmass;
|
V_east_airmass = f.get_V_east_airmass();
|
||||||
V_down_airmass = FG_V_down_airmass;
|
V_down_airmass = f.get_V_down_airmass();
|
||||||
V_north_rel_airmass = FG_V_north_rel_airmass;
|
V_north_rel_airmass = f.get_V_north_rel_airmass();
|
||||||
V_east_rel_airmass = FG_V_east_rel_airmass;
|
V_east_rel_airmass = f.get_V_east_rel_airmass();
|
||||||
V_down_rel_airmass = FG_V_down_rel_airmass;
|
V_down_rel_airmass = f.get_V_down_rel_airmass();
|
||||||
U_gust = FG_U_gust;
|
U_gust = f.get_U_gust();
|
||||||
V_gust = FG_V_gust;
|
V_gust = f.get_V_gust();
|
||||||
W_gust = FG_W_gust;
|
W_gust = f.get_W_gust();
|
||||||
U_body = FG_U_body;
|
U_body = f.get_U_body();
|
||||||
V_body = FG_V_body;
|
V_body = f.get_V_body();
|
||||||
W_body = FG_W_body;
|
W_body = f.get_W_body();
|
||||||
V_rel_wind = FG_V_rel_wind;
|
V_rel_wind = f.get_V_rel_wind();
|
||||||
V_true_kts = FG_V_true_kts;
|
V_true_kts = f.get_V_true_kts();
|
||||||
V_rel_ground = FG_V_rel_ground;
|
V_rel_ground = f.get_V_rel_ground();
|
||||||
V_inertial = FG_V_inertial;
|
V_inertial = f.get_V_inertial();
|
||||||
V_ground_speed = FG_V_ground_speed;
|
V_ground_speed = f.get_V_ground_speed();
|
||||||
V_equiv = FG_V_equiv;
|
V_equiv = f.get_V_equiv();
|
||||||
V_equiv_kts = FG_V_equiv_kts;
|
V_equiv_kts = f.get_V_equiv_kts();
|
||||||
V_calibrated = FG_V_calibrated;
|
V_calibrated = f.get_V_calibrated();
|
||||||
V_calibrated_kts = FG_V_calibrated_kts;
|
V_calibrated_kts = f.get_V_calibrated_kts();
|
||||||
P_body = FG_P_body;
|
P_body = f.get_P_body();
|
||||||
Q_body = FG_Q_body;
|
Q_body = f.get_Q_body();
|
||||||
R_body = FG_R_body;
|
R_body = f.get_R_body();
|
||||||
P_local = FG_P_local;
|
P_local = f.get_P_local();
|
||||||
Q_local = FG_Q_local;
|
Q_local = f.get_Q_local();
|
||||||
R_local = FG_R_local;
|
R_local = f.get_R_local();
|
||||||
P_total = FG_P_total;
|
P_total = f.get_P_total();
|
||||||
Q_total = FG_Q_total;
|
Q_total = f.get_Q_total();
|
||||||
R_total = FG_R_total;
|
R_total = f.get_R_total();
|
||||||
Phi_dot = FG_Phi_dot;
|
Phi_dot = f.get_Phi_dot();
|
||||||
Theta_dot = FG_Theta_dot;
|
Theta_dot = f.get_Theta_dot();
|
||||||
Psi_dot = FG_Psi_dot;
|
Psi_dot = f.get_Psi_dot();
|
||||||
Latitude_dot = FG_Latitude_dot;
|
Latitude_dot = f.get_Latitude_dot();
|
||||||
Longitude_dot = FG_Longitude_dot;
|
Longitude_dot = f.get_Longitude_dot();
|
||||||
Radius_dot = FG_Radius_dot;
|
Radius_dot = f.get_Radius_dot();
|
||||||
Lat_geocentric = FG_Lat_geocentric;
|
Lat_geocentric = f.get_Lat_geocentric();
|
||||||
Lon_geocentric = FG_Lon_geocentric;
|
Lon_geocentric = f.get_Lon_geocentric();
|
||||||
Radius_to_vehicle = FG_Radius_to_vehicle;
|
Radius_to_vehicle = f.get_Radius_to_vehicle();
|
||||||
Latitude = FG_Latitude;
|
Latitude = f.get_Latitude();
|
||||||
Longitude = FG_Longitude;
|
Longitude = f.get_Longitude();
|
||||||
Altitude = FG_Altitude;
|
Altitude = f.get_Altitude();
|
||||||
Phi = FG_Phi;
|
Phi = f.get_Phi();
|
||||||
Theta = FG_Theta;
|
Theta = f.get_Theta();
|
||||||
Psi = FG_Psi;
|
Psi = f.get_Psi();
|
||||||
T_local_to_body_11 = FG_T_local_to_body_11;
|
T_local_to_body_11 = f.get_T_local_to_body_11();
|
||||||
T_local_to_body_12 = FG_T_local_to_body_12;
|
T_local_to_body_12 = f.get_T_local_to_body_12();
|
||||||
T_local_to_body_13 = FG_T_local_to_body_13;
|
T_local_to_body_13 = f.get_T_local_to_body_13();
|
||||||
T_local_to_body_21 = FG_T_local_to_body_21;
|
T_local_to_body_21 = f.get_T_local_to_body_21();
|
||||||
T_local_to_body_22 = FG_T_local_to_body_22;
|
T_local_to_body_22 = f.get_T_local_to_body_22();
|
||||||
T_local_to_body_23 = FG_T_local_to_body_23;
|
T_local_to_body_23 = f.get_T_local_to_body_23();
|
||||||
T_local_to_body_31 = FG_T_local_to_body_31;
|
T_local_to_body_31 = f.get_T_local_to_body_31();
|
||||||
T_local_to_body_32 = FG_T_local_to_body_32;
|
T_local_to_body_32 = f.get_T_local_to_body_32();
|
||||||
T_local_to_body_33 = FG_T_local_to_body_33;
|
T_local_to_body_33 = f.get_T_local_to_body_33();
|
||||||
Gravity = FG_Gravity;
|
Gravity = f.get_Gravity();
|
||||||
Centrifugal_relief = FG_Centrifugal_relief;
|
Centrifugal_relief = f.get_Centrifugal_relief();
|
||||||
Alpha = FG_Alpha;
|
Alpha = f.get_Alpha();
|
||||||
Beta = FG_Beta;
|
Beta = f.get_Beta();
|
||||||
Alpha_dot = FG_Alpha_dot;
|
Alpha_dot = f.get_Alpha_dot();
|
||||||
Beta_dot = FG_Beta_dot;
|
Beta_dot = f.get_Beta_dot();
|
||||||
Cos_alpha = FG_Cos_alpha;
|
Cos_alpha = f.get_Cos_alpha();
|
||||||
Sin_alpha = FG_Sin_alpha;
|
Sin_alpha = f.get_Sin_alpha();
|
||||||
Cos_beta = FG_Cos_beta;
|
Cos_beta = f.get_Cos_beta();
|
||||||
Sin_beta = FG_Sin_beta;
|
Sin_beta = f.get_Sin_beta();
|
||||||
Cos_phi = FG_Cos_phi;
|
Cos_phi = f.get_Cos_phi();
|
||||||
Sin_phi = FG_Sin_phi;
|
Sin_phi = f.get_Sin_phi();
|
||||||
Cos_theta = FG_Cos_theta;
|
Cos_theta = f.get_Cos_theta();
|
||||||
Sin_theta = FG_Sin_theta;
|
Sin_theta = f.get_Sin_theta();
|
||||||
Cos_psi = FG_Cos_psi;
|
Cos_psi = f.get_Cos_psi();
|
||||||
Sin_psi = FG_Sin_psi;
|
Sin_psi = f.get_Sin_psi();
|
||||||
Gamma_vert_rad = FG_Gamma_vert_rad;
|
Gamma_vert_rad = f.get_Gamma_vert_rad();
|
||||||
Gamma_horiz_rad = FG_Gamma_horiz_rad;
|
Gamma_horiz_rad = f.get_Gamma_horiz_rad();
|
||||||
Sigma = FG_Sigma;
|
Sigma = f.get_Sigma();
|
||||||
Density = FG_Density;
|
Density = f.get_Density();
|
||||||
V_sound = FG_V_sound;
|
V_sound = f.get_V_sound();
|
||||||
Mach_number = FG_Mach_number;
|
Mach_number = f.get_Mach_number();
|
||||||
Static_pressure = FG_Static_pressure;
|
Static_pressure = f.get_Static_pressure();
|
||||||
Total_pressure = FG_Total_pressure;
|
Total_pressure = f.get_Total_pressure();
|
||||||
Impact_pressure = FG_Impact_pressure;
|
Impact_pressure = f.get_Impact_pressure();
|
||||||
Dynamic_pressure = FG_Dynamic_pressure;
|
Dynamic_pressure = f.get_Dynamic_pressure();
|
||||||
Static_temperature = FG_Static_temperature;
|
Static_temperature = f.get_Static_temperature();
|
||||||
Total_temperature = FG_Total_temperature;
|
Total_temperature = f.get_Total_temperature();
|
||||||
Sea_level_radius = FG_Sea_level_radius;
|
Sea_level_radius = f.get_Sea_level_radius();
|
||||||
Earth_position_angle = FG_Earth_position_angle;
|
Earth_position_angle = f.get_Earth_position_angle();
|
||||||
Runway_altitude = FG_Runway_altitude;
|
Runway_altitude = f.get_Runway_altitude();
|
||||||
Runway_latitude = FG_Runway_latitude;
|
Runway_latitude = f.get_Runway_latitude();
|
||||||
Runway_longitude = FG_Runway_longitude;
|
Runway_longitude = f.get_Runway_longitude();
|
||||||
Runway_heading = FG_Runway_heading;
|
Runway_heading = f.get_Runway_heading();
|
||||||
Radius_to_rwy = FG_Radius_to_rwy;
|
Radius_to_rwy = f.get_Radius_to_rwy();
|
||||||
D_cg_north_of_rwy = FG_D_cg_north_of_rwy;
|
D_cg_north_of_rwy = f.get_D_cg_north_of_rwy();
|
||||||
D_cg_east_of_rwy = FG_D_cg_east_of_rwy;
|
D_cg_east_of_rwy = f.get_D_cg_east_of_rwy();
|
||||||
D_cg_above_rwy = FG_D_cg_above_rwy;
|
D_cg_above_rwy = f.get_D_cg_above_rwy();
|
||||||
X_cg_rwy = FG_X_cg_rwy;
|
X_cg_rwy = f.get_X_cg_rwy();
|
||||||
Y_cg_rwy = FG_Y_cg_rwy;
|
Y_cg_rwy = f.get_Y_cg_rwy();
|
||||||
H_cg_rwy = FG_H_cg_rwy;
|
H_cg_rwy = f.get_H_cg_rwy();
|
||||||
D_pilot_north_of_rwy = FG_D_pilot_north_of_rwy;
|
D_pilot_north_of_rwy = f.get_D_pilot_north_of_rwy();
|
||||||
D_pilot_east_of_rwy = FG_D_pilot_east_of_rwy;
|
D_pilot_east_of_rwy = f.get_D_pilot_east_of_rwy();
|
||||||
D_pilot_above_rwy = FG_D_pilot_above_rwy;
|
D_pilot_above_rwy = f.get_D_pilot_above_rwy();
|
||||||
X_pilot_rwy = FG_X_pilot_rwy;
|
X_pilot_rwy = f.get_X_pilot_rwy();
|
||||||
Y_pilot_rwy = FG_Y_pilot_rwy;
|
Y_pilot_rwy = f.get_Y_pilot_rwy();
|
||||||
H_pilot_rwy = FG_H_pilot_rwy;
|
H_pilot_rwy = f.get_H_pilot_rwy();
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert from the LaRCsim generic_ struct to the fgFLIGHT struct
|
// Convert from the LaRCsim generic_ struct to the fgFLIGHT struct
|
||||||
int fgLaRCsim_2_Flight (fgFLIGHT *f) {
|
int fgLaRCsim_2_Flight (fgFLIGHT& f) {
|
||||||
FG_Mass = Mass;
|
f.set_Inertias( Mass, I_xx, I_yy, I_zz, I_xz );
|
||||||
FG_I_xx = I_xx;
|
|
||||||
FG_I_yy = I_yy;
|
|
||||||
FG_I_zz = I_zz;
|
|
||||||
FG_I_xz = I_xz;
|
|
||||||
FG_Dx_pilot = Dx_pilot;
|
|
||||||
FG_Dy_pilot = Dy_pilot;
|
|
||||||
FG_Dz_pilot = Dz_pilot;
|
|
||||||
FG_Dx_cg = Dx_cg;
|
|
||||||
FG_Dy_cg = Dy_cg;
|
|
||||||
FG_Dz_cg = Dz_cg;
|
|
||||||
FG_F_X = F_X;
|
|
||||||
FG_F_Y = F_Y;
|
|
||||||
FG_F_Z = F_Z;
|
|
||||||
FG_F_north = F_north;
|
|
||||||
FG_F_east = F_east;
|
|
||||||
FG_F_down = F_down;
|
|
||||||
FG_F_X_aero = F_X_aero;
|
|
||||||
FG_F_Y_aero = F_Y_aero;
|
|
||||||
FG_F_Z_aero = F_Z_aero;
|
|
||||||
FG_F_X_engine = F_X_engine;
|
|
||||||
FG_F_Y_engine = F_Y_engine;
|
|
||||||
FG_F_Z_engine = F_Z_engine;
|
|
||||||
FG_F_X_gear = F_X_gear;
|
|
||||||
FG_F_Y_gear = F_Y_gear;
|
|
||||||
FG_F_Z_gear = F_Z_gear;
|
|
||||||
FG_M_l_rp = M_l_rp;
|
|
||||||
FG_M_m_rp = M_m_rp;
|
|
||||||
FG_M_n_rp = M_n_rp;
|
|
||||||
FG_M_l_cg = M_l_cg;
|
|
||||||
FG_M_m_cg = M_m_cg;
|
|
||||||
FG_M_n_cg = M_n_cg;
|
|
||||||
FG_M_l_aero = M_l_aero;
|
|
||||||
FG_M_m_aero = M_m_aero;
|
|
||||||
FG_M_n_aero = M_n_aero;
|
|
||||||
FG_M_l_engine = M_l_engine;
|
|
||||||
FG_M_m_engine = M_m_engine;
|
|
||||||
FG_M_n_engine = M_n_engine;
|
|
||||||
FG_M_l_gear = M_l_gear;
|
|
||||||
FG_M_m_gear = M_m_gear;
|
|
||||||
FG_M_n_gear = M_n_gear;
|
|
||||||
FG_V_dot_north = V_dot_north;
|
|
||||||
FG_V_dot_east = V_dot_east;
|
|
||||||
FG_V_dot_down = V_dot_down;
|
|
||||||
FG_U_dot_body = U_dot_body;
|
|
||||||
FG_V_dot_body = V_dot_body;
|
|
||||||
FG_W_dot_body = W_dot_body;
|
|
||||||
FG_A_X_cg = A_X_cg;
|
|
||||||
FG_A_Y_cg = A_Y_cg;
|
|
||||||
FG_A_Z_cg = A_Z_cg;
|
|
||||||
FG_A_X_pilot = A_X_pilot;
|
|
||||||
FG_A_Y_pilot = A_Y_pilot;
|
|
||||||
FG_A_Z_pilot = A_Z_pilot;
|
|
||||||
FG_N_X_cg = N_X_cg;
|
|
||||||
FG_N_Y_cg = N_Y_cg;
|
|
||||||
FG_N_Z_cg = N_Z_cg;
|
|
||||||
FG_N_X_pilot = N_X_pilot;
|
|
||||||
FG_N_Y_pilot = N_Y_pilot;
|
|
||||||
FG_N_Z_pilot = N_Z_pilot;
|
|
||||||
FG_P_dot_body = P_dot_body;
|
|
||||||
FG_Q_dot_body = Q_dot_body;
|
|
||||||
FG_R_dot_body = R_dot_body;
|
|
||||||
FG_V_north = V_north;
|
|
||||||
FG_V_east = V_east;
|
|
||||||
FG_V_down = V_down;
|
|
||||||
FG_V_north_rel_ground = V_north_rel_ground;
|
|
||||||
FG_V_east_rel_ground = V_east_rel_ground;
|
|
||||||
FG_V_down_rel_ground = V_down_rel_ground;
|
|
||||||
FG_V_north_airmass = V_north_airmass;
|
|
||||||
FG_V_east_airmass = V_east_airmass;
|
|
||||||
FG_V_down_airmass = V_down_airmass;
|
|
||||||
FG_V_north_rel_airmass = V_north_rel_airmass;
|
|
||||||
FG_V_east_rel_airmass = V_east_rel_airmass;
|
|
||||||
FG_V_down_rel_airmass = V_down_rel_airmass;
|
|
||||||
FG_U_gust = U_gust;
|
|
||||||
FG_V_gust = V_gust;
|
|
||||||
FG_W_gust = W_gust;
|
|
||||||
FG_U_body = U_body;
|
|
||||||
FG_V_body = V_body;
|
|
||||||
FG_W_body = W_body;
|
|
||||||
FG_V_rel_wind = V_rel_wind;
|
|
||||||
FG_V_true_kts = V_true_kts;
|
|
||||||
FG_V_rel_ground = V_rel_ground;
|
|
||||||
FG_V_inertial = V_inertial;
|
|
||||||
FG_V_ground_speed = V_ground_speed;
|
|
||||||
FG_V_equiv = V_equiv;
|
|
||||||
FG_V_equiv_kts = V_equiv_kts;
|
|
||||||
FG_V_calibrated = V_calibrated;
|
|
||||||
FG_V_calibrated_kts = V_calibrated_kts;
|
|
||||||
FG_P_body = P_body;
|
|
||||||
FG_Q_body = Q_body;
|
|
||||||
FG_R_body = R_body;
|
|
||||||
FG_P_local = P_local;
|
|
||||||
FG_Q_local = Q_local;
|
|
||||||
FG_R_local = R_local;
|
|
||||||
FG_P_total = P_total;
|
|
||||||
FG_Q_total = Q_total;
|
|
||||||
FG_R_total = R_total;
|
|
||||||
FG_Phi_dot = Phi_dot;
|
|
||||||
FG_Theta_dot = Theta_dot;
|
|
||||||
FG_Psi_dot = Psi_dot;
|
|
||||||
FG_Latitude_dot = Latitude_dot;
|
|
||||||
FG_Longitude_dot = Longitude_dot;
|
|
||||||
FG_Radius_dot = Radius_dot;
|
|
||||||
FG_Lat_geocentric = Lat_geocentric;
|
|
||||||
FG_Lon_geocentric = Lon_geocentric;
|
|
||||||
FG_Radius_to_vehicle = Radius_to_vehicle;
|
|
||||||
FG_Latitude = Latitude;
|
|
||||||
FG_Longitude = Longitude;
|
|
||||||
FG_Altitude = Altitude;
|
|
||||||
FG_Phi = Phi;
|
|
||||||
FG_Theta = Theta;
|
|
||||||
FG_Psi = Psi;
|
|
||||||
FG_T_local_to_body_11 = T_local_to_body_11;
|
|
||||||
FG_T_local_to_body_12 = T_local_to_body_12;
|
|
||||||
FG_T_local_to_body_13 = T_local_to_body_13;
|
|
||||||
FG_T_local_to_body_21 = T_local_to_body_21;
|
|
||||||
FG_T_local_to_body_22 = T_local_to_body_22;
|
|
||||||
FG_T_local_to_body_23 = T_local_to_body_23;
|
|
||||||
FG_T_local_to_body_31 = T_local_to_body_31;
|
|
||||||
FG_T_local_to_body_32 = T_local_to_body_32;
|
|
||||||
FG_T_local_to_body_33 = T_local_to_body_33;
|
|
||||||
FG_Gravity = Gravity;
|
|
||||||
FG_Centrifugal_relief = Centrifugal_relief;
|
|
||||||
FG_Alpha = Alpha;
|
|
||||||
FG_Beta = Beta;
|
|
||||||
FG_Alpha_dot = Alpha_dot;
|
|
||||||
FG_Beta_dot = Beta_dot;
|
|
||||||
FG_Cos_alpha = Cos_alpha;
|
|
||||||
FG_Sin_alpha = Sin_alpha;
|
|
||||||
FG_Cos_beta = Cos_beta;
|
|
||||||
FG_Sin_beta = Sin_beta;
|
|
||||||
FG_Cos_phi = Cos_phi;
|
|
||||||
FG_Sin_phi = Sin_phi;
|
|
||||||
FG_Cos_theta = Cos_theta;
|
|
||||||
FG_Sin_theta = Sin_theta;
|
|
||||||
FG_Cos_psi = Cos_psi;
|
|
||||||
FG_Sin_psi = Sin_psi;
|
|
||||||
FG_Gamma_vert_rad = Gamma_vert_rad;
|
|
||||||
FG_Gamma_horiz_rad = Gamma_horiz_rad;
|
|
||||||
FG_Sigma = Sigma;
|
|
||||||
FG_Density = Density;
|
|
||||||
FG_V_sound = V_sound;
|
|
||||||
FG_Mach_number = Mach_number;
|
|
||||||
FG_Static_pressure = Static_pressure;
|
|
||||||
FG_Total_pressure = Total_pressure;
|
|
||||||
FG_Impact_pressure = Impact_pressure;
|
|
||||||
FG_Dynamic_pressure = Dynamic_pressure;
|
|
||||||
FG_Static_temperature = Static_temperature;
|
|
||||||
FG_Total_temperature = Total_temperature;
|
|
||||||
FG_Sea_level_radius = Sea_level_radius;
|
|
||||||
FG_Earth_position_angle = Earth_position_angle;
|
|
||||||
FG_Runway_altitude = Runway_altitude;
|
|
||||||
FG_Runway_latitude = Runway_latitude;
|
|
||||||
FG_Runway_longitude = Runway_longitude;
|
|
||||||
FG_Runway_heading = Runway_heading;
|
|
||||||
FG_Radius_to_rwy = Radius_to_rwy;
|
|
||||||
FG_D_cg_north_of_rwy = D_cg_north_of_rwy;
|
|
||||||
FG_D_cg_east_of_rwy = D_cg_east_of_rwy;
|
|
||||||
FG_D_cg_above_rwy = D_cg_above_rwy;
|
|
||||||
FG_X_cg_rwy = X_cg_rwy;
|
|
||||||
FG_Y_cg_rwy = Y_cg_rwy;
|
|
||||||
FG_H_cg_rwy = H_cg_rwy;
|
|
||||||
FG_D_pilot_north_of_rwy = D_pilot_north_of_rwy;
|
|
||||||
FG_D_pilot_east_of_rwy = D_pilot_east_of_rwy;
|
|
||||||
FG_D_pilot_above_rwy = D_pilot_above_rwy;
|
|
||||||
FG_X_pilot_rwy = X_pilot_rwy;
|
|
||||||
FG_Y_pilot_rwy = Y_pilot_rwy;
|
|
||||||
FG_H_pilot_rwy = H_pilot_rwy;
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
f.get_Dx_pilot() = Dx_pilot;
|
||||||
|
f.get_Dy_pilot() = Dy_pilot;
|
||||||
|
f.get_Dz_pilot() = Dz_pilot;
|
||||||
|
f.get_Dx_cg() = Dx_cg;
|
||||||
|
f.get_Dy_cg() = Dy_cg;
|
||||||
|
f.get_Dz_cg() = Dz_cg;
|
||||||
|
f.get_F_X() = F_X;
|
||||||
|
f.get_F_Y() = F_Y;
|
||||||
|
f.get_F_Z() = F_Z;
|
||||||
|
f.get_F_north() = F_north;
|
||||||
|
f.get_F_east() = F_east;
|
||||||
|
f.get_F_down() = F_down;
|
||||||
|
f.get_F_X_aero() = F_X_aero;
|
||||||
|
f.get_F_Y_aero() = F_Y_aero;
|
||||||
|
f.get_F_Z_aero() = F_Z_aero;
|
||||||
|
f.get_F_X_engine() = F_X_engine;
|
||||||
|
f.get_F_Y_engine() = F_Y_engine;
|
||||||
|
f.get_F_Z_engine() = F_Z_engine;
|
||||||
|
f.get_F_X_gear() = F_X_gear;
|
||||||
|
f.get_F_Y_gear() = F_Y_gear;
|
||||||
|
f.get_F_Z_gear() = F_Z_gear;
|
||||||
|
f.get_M_l_rp() = M_l_rp;
|
||||||
|
f.get_M_m_rp() = M_m_rp;
|
||||||
|
f.get_M_n_rp() = M_n_rp;
|
||||||
|
f.get_M_l_cg() = M_l_cg;
|
||||||
|
f.get_M_m_cg() = M_m_cg;
|
||||||
|
f.get_M_n_cg() = M_n_cg;
|
||||||
|
f.get_M_l_aero() = M_l_aero;
|
||||||
|
f.get_M_m_aero() = M_m_aero;
|
||||||
|
f.get_M_n_aero() = M_n_aero;
|
||||||
|
f.get_M_l_engine() = M_l_engine;
|
||||||
|
f.get_M_m_engine() = M_m_engine;
|
||||||
|
f.get_M_n_engine() = M_n_engine;
|
||||||
|
f.get_M_l_gear() = M_l_gear;
|
||||||
|
f.get_M_m_gear() = M_m_gear;
|
||||||
|
f.get_M_n_gear() = M_n_gear;
|
||||||
|
f.get_V_dot_north() = V_dot_north;
|
||||||
|
f.get_V_dot_east() = V_dot_east;
|
||||||
|
f.get_V_dot_down() = V_dot_down;
|
||||||
|
f.get_U_dot_body() = U_dot_body;
|
||||||
|
f.get_V_dot_body() = V_dot_body;
|
||||||
|
f.get_W_dot_body() = W_dot_body;
|
||||||
|
f.get_A_X_cg() = A_X_cg;
|
||||||
|
f.get_A_Y_cg() = A_Y_cg;
|
||||||
|
f.get_A_Z_cg() = A_Z_cg;
|
||||||
|
f.get_A_X_pilot() = A_X_pilot;
|
||||||
|
f.get_A_Y_pilot() = A_Y_pilot;
|
||||||
|
f.get_A_Z_pilot() = A_Z_pilot;
|
||||||
|
f.get_N_X_cg() = N_X_cg;
|
||||||
|
f.get_N_Y_cg() = N_Y_cg;
|
||||||
|
f.get_N_Z_cg() = N_Z_cg;
|
||||||
|
f.get_N_X_pilot() = N_X_pilot;
|
||||||
|
f.get_N_Y_pilot() = N_Y_pilot;
|
||||||
|
f.get_N_Z_pilot() = N_Z_pilot;
|
||||||
|
f.get_P_dot_body() = P_dot_body;
|
||||||
|
f.get_Q_dot_body() = Q_dot_body;
|
||||||
|
f.get_R_dot_body() = R_dot_body;
|
||||||
|
f.get_V_north() = V_north;
|
||||||
|
f.get_V_east() = V_east;
|
||||||
|
f.get_V_down() = V_down;
|
||||||
|
f.get_V_north_rel_ground() = V_north_rel_ground;
|
||||||
|
f.get_V_east_rel_ground() = V_east_rel_ground;
|
||||||
|
f.get_V_down_rel_ground() = V_down_rel_ground;
|
||||||
|
f.get_V_north_airmass() = V_north_airmass;
|
||||||
|
f.get_V_east_airmass() = V_east_airmass;
|
||||||
|
f.get_V_down_airmass() = V_down_airmass;
|
||||||
|
f.get_V_north_rel_airmass() = V_north_rel_airmass;
|
||||||
|
f.get_V_east_rel_airmass() = V_east_rel_airmass;
|
||||||
|
f.get_V_down_rel_airmass() = V_down_rel_airmass;
|
||||||
|
f.get_U_gust() = U_gust;
|
||||||
|
f.get_V_gust() = V_gust;
|
||||||
|
f.get_W_gust() = W_gust;
|
||||||
|
f.get_U_body() = U_body;
|
||||||
|
f.get_V_body() = V_body;
|
||||||
|
f.get_W_body() = W_body;
|
||||||
|
f.get_V_rel_wind() = V_rel_wind;
|
||||||
|
f.get_V_true_kts() = V_true_kts;
|
||||||
|
f.get_V_rel_ground() = V_rel_ground;
|
||||||
|
f.get_V_inertial() = V_inertial;
|
||||||
|
f.get_V_ground_speed() = V_ground_speed;
|
||||||
|
f.get_V_equiv() = V_equiv;
|
||||||
|
f.get_V_equiv_kts() = V_equiv_kts;
|
||||||
|
f.get_V_calibrated() = V_calibrated;
|
||||||
|
f.get_V_calibrated_kts() = V_calibrated_kts;
|
||||||
|
f.get_P_body() = P_body;
|
||||||
|
f.get_Q_body() = Q_body;
|
||||||
|
f.get_R_body() = R_body;
|
||||||
|
f.get_P_local() = P_local;
|
||||||
|
f.get_Q_local() = Q_local;
|
||||||
|
f.get_R_local() = R_local;
|
||||||
|
f.get_P_total() = P_total;
|
||||||
|
f.get_Q_total() = Q_total;
|
||||||
|
f.get_R_total() = R_total;
|
||||||
|
f.get_Phi_dot() = Phi_dot;
|
||||||
|
f.get_Theta_dot() = Theta_dot;
|
||||||
|
f.get_Psi_dot() = Psi_dot;
|
||||||
|
f.get_Latitude_dot() = Latitude_dot;
|
||||||
|
f.get_Longitude_dot() = Longitude_dot;
|
||||||
|
f.get_Radius_dot() = Radius_dot;
|
||||||
|
f.get_Lat_geocentric() = Lat_geocentric;
|
||||||
|
f.get_Lon_geocentric() = Lon_geocentric;
|
||||||
|
f.get_Radius_to_vehicle() = Radius_to_vehicle;
|
||||||
|
f.get_Latitude() = Latitude;
|
||||||
|
f.get_Longitude() = Longitude;
|
||||||
|
f.get_Altitude() = Altitude;
|
||||||
|
f.get_Phi() = Phi;
|
||||||
|
f.get_Theta() = Theta;
|
||||||
|
f.get_Psi() = Psi;
|
||||||
|
f.get_T_local_to_body_11() = T_local_to_body_11;
|
||||||
|
f.get_T_local_to_body_12() = T_local_to_body_12;
|
||||||
|
f.get_T_local_to_body_13() = T_local_to_body_13;
|
||||||
|
f.get_T_local_to_body_21() = T_local_to_body_21;
|
||||||
|
f.get_T_local_to_body_22() = T_local_to_body_22;
|
||||||
|
f.get_T_local_to_body_23() = T_local_to_body_23;
|
||||||
|
f.get_T_local_to_body_31() = T_local_to_body_31;
|
||||||
|
f.get_T_local_to_body_32() = T_local_to_body_32;
|
||||||
|
f.get_T_local_to_body_33() = T_local_to_body_33;
|
||||||
|
f.get_Gravity() = Gravity;
|
||||||
|
f.get_Centrifugal_relief() = Centrifugal_relief;
|
||||||
|
f.get_Alpha() = Alpha;
|
||||||
|
f.get_Beta() = Beta;
|
||||||
|
f.get_Alpha_dot() = Alpha_dot;
|
||||||
|
f.get_Beta_dot() = Beta_dot;
|
||||||
|
f.get_Cos_alpha() = Cos_alpha;
|
||||||
|
f.get_Sin_alpha() = Sin_alpha;
|
||||||
|
f.get_Cos_beta() = Cos_beta;
|
||||||
|
f.get_Sin_beta() = Sin_beta;
|
||||||
|
f.get_Cos_phi() = Cos_phi;
|
||||||
|
f.get_Sin_phi() = Sin_phi;
|
||||||
|
f.get_Cos_theta() = Cos_theta;
|
||||||
|
f.get_Sin_theta() = Sin_theta;
|
||||||
|
f.get_Cos_psi() = Cos_psi;
|
||||||
|
f.get_Sin_psi() = Sin_psi;
|
||||||
|
f.get_Gamma_vert_rad() = Gamma_vert_rad;
|
||||||
|
f.get_Gamma_horiz_rad() = Gamma_horiz_rad;
|
||||||
|
f.get_Sigma() = Sigma;
|
||||||
|
f.get_Density() = Density;
|
||||||
|
f.get_V_sound() = V_sound;
|
||||||
|
f.get_Mach_number() = Mach_number;
|
||||||
|
f.get_Static_pressure() = Static_pressure;
|
||||||
|
f.get_Total_pressure() = Total_pressure;
|
||||||
|
f.get_Impact_pressure() = Impact_pressure;
|
||||||
|
f.get_Dynamic_pressure() = Dynamic_pressure;
|
||||||
|
f.get_Static_temperature() = Static_temperature;
|
||||||
|
f.get_Total_temperature() = Total_temperature;
|
||||||
|
f.get_Sea_level_radius() = Sea_level_radius;
|
||||||
|
f.get_Earth_position_angle() = Earth_position_angle;
|
||||||
|
f.get_Runway_altitude() = Runway_altitude;
|
||||||
|
f.get_Runway_latitude() = Runway_latitude;
|
||||||
|
f.get_Runway_longitude() = Runway_longitude;
|
||||||
|
f.get_Runway_heading() = Runway_heading;
|
||||||
|
f.get_Radius_to_rwy() = Radius_to_rwy;
|
||||||
|
f.get_D_cg_north_of_rwy() = D_cg_north_of_rwy;
|
||||||
|
f.get_D_cg_east_of_rwy() = D_cg_east_of_rwy;
|
||||||
|
f.get_D_cg_above_rwy() = D_cg_above_rwy;
|
||||||
|
f.get_X_cg_rwy() = X_cg_rwy;
|
||||||
|
f.get_Y_cg_rwy() = Y_cg_rwy;
|
||||||
|
f.get_H_cg_rwy() = H_cg_rwy;
|
||||||
|
f.get_D_pilot_north_of_rwy() = D_pilot_north_of_rwy;
|
||||||
|
f.get_D_pilot_east_of_rwy() = D_pilot_east_of_rwy;
|
||||||
|
f.get_D_pilot_above_rwy() = D_pilot_above_rwy;
|
||||||
|
f.get_X_pilot_rwy() = X_pilot_rwy;
|
||||||
|
f.get_Y_pilot_rwy() = Y_pilot_rwy;
|
||||||
|
f.get_H_pilot_rwy() = H_pilot_rwy;
|
||||||
|
*/
|
||||||
return ( 0 );
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.4 1998/12/03 01:16:37 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.3 1998/10/25 14:08:43 curt
|
// Revision 1.3 1998/10/25 14:08:43 curt
|
||||||
// Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
|
// Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
|
||||||
//
|
//
|
||||||
|
|
|
@ -35,19 +35,22 @@
|
||||||
int fgLaRCsimInit(double dt);
|
int fgLaRCsimInit(double dt);
|
||||||
|
|
||||||
// update position based on inputs, positions, velocities, etc.
|
// update position based on inputs, positions, velocities, etc.
|
||||||
int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop);
|
int fgLaRCsimUpdate(fgFLIGHT& f, int multiloop);
|
||||||
|
|
||||||
// Convert from the fgFLIGHT struct to the LaRCsim generic_ struct
|
// Convert from the fgFLIGHT struct to the LaRCsim generic_ struct
|
||||||
int fgFlight_2_LaRCsim (fgFLIGHT *f);
|
int fgFlight_2_LaRCsim (fgFLIGHT& f);
|
||||||
|
|
||||||
// Convert from the LaRCsim generic_ struct to the fgFLIGHT struct
|
// Convert from the LaRCsim generic_ struct to the fgFLIGHT struct
|
||||||
int fgLaRCsim_2_Flight (fgFLIGHT *f);
|
int fgLaRCsim_2_Flight (fgFLIGHT& f);
|
||||||
|
|
||||||
|
|
||||||
#endif // _LARCSIM_HXX
|
#endif // _LARCSIM_HXX
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.3 1998/12/03 01:16:38 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.2 1998/10/17 01:34:13 curt
|
// Revision 1.2 1998/10/17 01:34:13 curt
|
||||||
// C++ ifying ...
|
// C++ ifying ...
|
||||||
//
|
//
|
||||||
|
|
|
@ -37,7 +37,7 @@ fgFLIGHT cur_flight_params;
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the flight model parameters */
|
/* Initialize the flight model parameters */
|
||||||
int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
|
int fgFlightModelInit(int model, fgFLIGHT& f, double dt) {
|
||||||
double save_alt = 0.0;
|
double save_alt = 0.0;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
@ -47,19 +47,19 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
|
||||||
// fgSlewInit(dt);
|
// fgSlewInit(dt);
|
||||||
} else if ( model == FG_LARCSIM ) {
|
} else if ( model == FG_LARCSIM ) {
|
||||||
/* lets try to avoid really screwing up the LaRCsim model */
|
/* lets try to avoid really screwing up the LaRCsim model */
|
||||||
if ( FG_Altitude < -9000 ) {
|
if ( f.get_Altitude() < -9000.0 ) {
|
||||||
save_alt = FG_Altitude;
|
save_alt = f.get_Altitude();
|
||||||
FG_Altitude = 0;
|
f.set_Altitude( 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
|
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
|
||||||
fgLaRCsimInit(dt);
|
fgLaRCsimInit(dt);
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << FG_Latitude );
|
FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << f.get_Latitude() );
|
||||||
fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
|
fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
|
||||||
|
|
||||||
/* but lets restore our original bogus altitude when we are done */
|
/* but lets restore our original bogus altitude when we are done */
|
||||||
if ( save_alt < -9000 ) {
|
if ( save_alt < -9000.0 ) {
|
||||||
FG_Altitude = save_alt;
|
f.set_Altitude( save_alt );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FG_LOG( FG_FLIGHT, FG_WARN,
|
FG_LOG( FG_FLIGHT, FG_WARN,
|
||||||
|
@ -73,13 +73,13 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
|
||||||
|
|
||||||
|
|
||||||
/* Run multiloop iterations of the flight model */
|
/* Run multiloop iterations of the flight model */
|
||||||
int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
|
int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) {
|
||||||
double time_step, start_elev, end_elev;
|
double time_step, start_elev, end_elev;
|
||||||
int result;
|
int result;
|
||||||
// printf("Altitude = %.2f\n", FG_Altitude * 0.3048);
|
// printf("Altitude = %.2f\n", FG_Altitude * 0.3048);
|
||||||
|
|
||||||
time_step = (1.0 / DEFAULT_MODEL_HZ) * multiloop;
|
time_step = (1.0 / DEFAULT_MODEL_HZ) * multiloop;
|
||||||
start_elev = FG_Altitude;
|
start_elev = f.get_Altitude();
|
||||||
|
|
||||||
if ( model == FG_SLEW ) {
|
if ( model == FG_SLEW ) {
|
||||||
// fgSlewUpdate(f, multiloop);
|
// fgSlewUpdate(f, multiloop);
|
||||||
|
@ -90,9 +90,10 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
|
||||||
"Unimplemented flight model == " << model );
|
"Unimplemented flight model == " << model );
|
||||||
}
|
}
|
||||||
|
|
||||||
end_elev = FG_Altitude;
|
end_elev = f.get_Altitude();
|
||||||
|
|
||||||
FG_Climb_Rate = (end_elev - start_elev) / time_step; /* feet per second */
|
// feet per second
|
||||||
|
f.set_Climb_Rate( (end_elev - start_elev) / time_step );
|
||||||
|
|
||||||
result = 1;
|
result = 1;
|
||||||
|
|
||||||
|
@ -101,30 +102,33 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
|
||||||
|
|
||||||
|
|
||||||
/* Set the altitude (force) */
|
/* Set the altitude (force) */
|
||||||
void fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) {
|
void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) {
|
||||||
double sea_level_radius_meters;
|
double sea_level_radius_meters;
|
||||||
double lat_geoc;
|
double lat_geoc;
|
||||||
// Set the FG variables first
|
// Set the FG variables first
|
||||||
fgGeodToGeoc( FG_Latitude, alt_meters,
|
fgGeodToGeoc( f.get_Latitude(), alt_meters,
|
||||||
&sea_level_radius_meters, &lat_geoc);
|
&sea_level_radius_meters, &lat_geoc);
|
||||||
|
|
||||||
FG_Altitude = alt_meters * METER_TO_FEET;
|
f.set_Altitude( alt_meters * METER_TO_FEET );
|
||||||
FG_Radius_to_vehicle = FG_Altitude +
|
f.set_Radius_to_vehicle( f.get_Altitude() +
|
||||||
(sea_level_radius_meters * METER_TO_FEET);
|
(sea_level_radius_meters * METER_TO_FEET) );
|
||||||
|
|
||||||
/* additional work needed for some flight models */
|
/* additional work needed for some flight models */
|
||||||
if ( model == FG_LARCSIM ) {
|
if ( model == FG_LARCSIM ) {
|
||||||
ls_ForceAltitude(FG_Altitude);
|
ls_ForceAltitude( f.get_Altitude() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.4 1998/12/03 01:16:40 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.3 1998/11/06 21:18:03 curt
|
// Revision 1.3 1998/11/06 21:18:03 curt
|
||||||
// Converted to new logstream debugging facility. This allows release
|
// Converted to new logstream debugging facility. This allows release
|
||||||
// builds with no messages at all (and no performance impact) by using
|
// builds with no messages at all (and no performance impact) by using
|
||||||
// the -DFG_NDEBUG flag.
|
// the -DFG_NDEBUGNDEBUG flag.
|
||||||
//
|
//
|
||||||
// Revision 1.2 1998/10/16 23:27:40 curt
|
// Revision 1.2 1998/10/16 23:27:40 curt
|
||||||
// C++-ifying.
|
// C++-ifying.
|
||||||
|
|
586
FDM/flight.hxx
586
FDM/flight.hxx
|
@ -34,361 +34,484 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Define the various supported flight models (most not yet implemented) */
|
// Define the various supported flight models (most not yet implemented)
|
||||||
#define FG_SLEW 0 /* Slew (in MS terminology) */
|
|
||||||
#define FG_LARCSIM 1 /* The only "real" model that is currently
|
enum fgFlightModelKind {
|
||||||
implemented */
|
// Slew (in MS terminology)
|
||||||
#define FG_ACM 2
|
FG_SLEW = 0,
|
||||||
#define FG_SUPER_SONIC 3
|
|
||||||
#define FG_HELICOPTER 4
|
// The only "real" model that is currently implemented
|
||||||
#define FG_AUTOGYRO 5
|
FG_LARCSIM = 1,
|
||||||
#define FG_BALLOON 6
|
|
||||||
#define FG_PARACHUTE 7
|
FG_ACM = 2,
|
||||||
#define FG_EXTERN_GPS 8 /* Driven via a serially connected GPS */
|
FG_SUPER_SONIC = 3,
|
||||||
#define FG_EXTERN_NET 9 /* Driven externally via the net */
|
FG_HELICOPTER = 4,
|
||||||
#define FG_EXTERN_NASA 10 /* Track the space shuttle ? */
|
FG_AUTOGYRO = 5,
|
||||||
|
FG_BALLOON = 6,
|
||||||
|
FG_PARACHUTE = 7,
|
||||||
|
|
||||||
|
// Driven externally via a serial port, net, file, etc.
|
||||||
|
FG_EXTERN = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef double FG_VECTOR_3[3];
|
typedef double FG_VECTOR_3[3];
|
||||||
|
|
||||||
/* This is based heavily on LaRCsim/ls_generic.h */
|
|
||||||
typedef struct {
|
// This is based heavily on LaRCsim/ls_generic.h
|
||||||
|
class fgFLIGHT {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
/*================== Mass properties and geometry values ==================*/
|
/*================== Mass properties and geometry values ==================*/
|
||||||
|
|
||||||
double mass, i_xx, i_yy, i_zz, i_xz; /* Inertias */
|
// Inertias
|
||||||
#define FG_Mass f->mass
|
double mass, i_xx, i_yy, i_zz, i_xz;
|
||||||
#define FG_I_xx f->i_xx
|
inline double get_Mass() const { return mass; }
|
||||||
#define FG_I_yy f->i_yy
|
inline double get_I_xx() const { return i_xx; }
|
||||||
#define FG_I_zz f->i_zz
|
inline double get_I_yy() const { return i_yy; }
|
||||||
#define FG_I_xz f->i_xz
|
inline double get_I_zz() const { return i_zz; }
|
||||||
|
inline double get_I_xz() const { return i_xz; }
|
||||||
|
|
||||||
FG_VECTOR_3 d_pilot_rp_body_v; /* Pilot location rel to ref pt */
|
// Pilot location rel to ref pt
|
||||||
#define FG_D_pilot_rp_body_v f->d_pilot_rp_body_v
|
FG_VECTOR_3 d_pilot_rp_body_v;
|
||||||
#define FG_Dx_pilot f->d_pilot_rp_body_v[0]
|
inline double * get_D_pilot_rp_body_v() {
|
||||||
#define FG_Dy_pilot f->d_pilot_rp_body_v[1]
|
return d_pilot_rp_body_v;
|
||||||
#define FG_Dz_pilot f->d_pilot_rp_body_v[2]
|
}
|
||||||
|
inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
|
||||||
|
inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
|
||||||
|
inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 d_cg_rp_body_v; /* CG position w.r.t. ref. point */
|
// CG position w.r.t. ref. point
|
||||||
#define FG_D_cg_rp_body_v f->d_cg_rp_body_v
|
FG_VECTOR_3 d_cg_rp_body_v;
|
||||||
#define FG_Dx_cg f->d_cg_rp_body_v[0]
|
inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
|
||||||
#define FG_Dy_cg f->d_cg_rp_body_v[1]
|
inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
|
||||||
#define FG_Dz_cg f->d_cg_rp_body_v[2]
|
inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
|
||||||
|
inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
|
||||||
|
|
||||||
/*================================ Forces =================================*/
|
/*================================ Forces =================================*/
|
||||||
|
|
||||||
FG_VECTOR_3 f_body_total_v;
|
FG_VECTOR_3 f_body_total_v;
|
||||||
#define FG_F_body_total_v f->f_body_total_v
|
inline double * get_F_body_total_v() { return f_body_total_v; }
|
||||||
#define FG_F_X f->f_body_total_v[0]
|
inline double get_F_X() const { return f_body_total_v[0]; }
|
||||||
#define FG_F_Y f->f_body_total_v[1]
|
inline double get_F_Y() const { return f_body_total_v[1]; }
|
||||||
#define FG_F_Z f->f_body_total_v[2]
|
inline double get_F_Z() const { return f_body_total_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 f_local_total_v;
|
FG_VECTOR_3 f_local_total_v;
|
||||||
#define FG_F_local_total_v f->f_local_total_v
|
inline double * get_F_local_total_v() { return f_local_total_v; }
|
||||||
#define FG_F_north f->f_local_total_v[0]
|
inline double get_F_north() const { return f_local_total_v[0]; }
|
||||||
#define FG_F_east f->f_local_total_v[1]
|
inline double get_F_east() const { return f_local_total_v[1]; }
|
||||||
#define FG_F_down f->f_local_total_v[2]
|
inline double get_F_down() const { return f_local_total_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 f_aero_v;
|
FG_VECTOR_3 f_aero_v;
|
||||||
#define FG_F_aero_v f->f_aero_v
|
inline double * get_F_aero_v() { return f_aero_v; }
|
||||||
#define FG_F_X_aero f->f_aero_v[0]
|
inline double get_F_X_aero() const { return f_aero_v[0]; }
|
||||||
#define FG_F_Y_aero f->f_aero_v[1]
|
inline double get_F_Y_aero() const { return f_aero_v[1]; }
|
||||||
#define FG_F_Z_aero f->f_aero_v[2]
|
inline double get_F_Z_aero() const { return f_aero_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 f_engine_v;
|
FG_VECTOR_3 f_engine_v;
|
||||||
#define FG_F_engine_v f->f_engine_v
|
inline double * get_F_engine_v() { return f_engine_v; }
|
||||||
#define FG_F_X_engine f->f_engine_v[0]
|
inline double get_F_X_engine() const { return f_engine_v[0]; }
|
||||||
#define FG_F_Y_engine f->f_engine_v[1]
|
inline double get_F_Y_engine() const { return f_engine_v[1]; }
|
||||||
#define FG_F_Z_engine f->f_engine_v[2]
|
inline double get_F_Z_engine() const { return f_engine_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 f_gear_v;
|
FG_VECTOR_3 f_gear_v;
|
||||||
#define FG_F_gear_v f->f_gear_v
|
inline double * get_F_gear_v() { return f_gear_v; }
|
||||||
#define FG_F_X_gear f->f_gear_v[0]
|
inline double get_F_X_gear() const { return f_gear_v[0]; }
|
||||||
#define FG_F_Y_gear f->f_gear_v[1]
|
inline double get_F_Y_gear() const { return f_gear_v[1]; }
|
||||||
#define FG_F_Z_gear f->f_gear_v[2]
|
inline double get_F_Z_gear() const { return f_gear_v[2]; }
|
||||||
|
|
||||||
/*================================ Moments ================================*/
|
/*================================ Moments ================================*/
|
||||||
|
|
||||||
FG_VECTOR_3 m_total_rp_v;
|
FG_VECTOR_3 m_total_rp_v;
|
||||||
#define FG_M_total_rp_v f->m_total_rp_v
|
inline double * get_M_total_rp_v() { return m_total_rp_v; }
|
||||||
#define FG_M_l_rp f->m_total_rp_v[0]
|
inline double get_M_l_rp() const { return m_total_rp_v[0]; }
|
||||||
#define FG_M_m_rp f->m_total_rp_v[1]
|
inline double get_M_m_rp() const { return m_total_rp_v[1]; }
|
||||||
#define FG_M_n_rp f->m_total_rp_v[2]
|
inline double get_M_n_rp() const { return m_total_rp_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 m_total_cg_v;
|
FG_VECTOR_3 m_total_cg_v;
|
||||||
#define FG_M_total_cg_v f->m_total_cg_v
|
inline double * get_M_total_cg_v() { return m_total_cg_v; }
|
||||||
#define FG_M_l_cg f->m_total_cg_v[0]
|
inline double get_M_l_cg() const { return m_total_cg_v[0]; }
|
||||||
#define FG_M_m_cg f->m_total_cg_v[1]
|
inline double get_M_m_cg() const { return m_total_cg_v[1]; }
|
||||||
#define FG_M_n_cg f->m_total_cg_v[2]
|
inline double get_M_n_cg() const { return m_total_cg_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 m_aero_v;
|
FG_VECTOR_3 m_aero_v;
|
||||||
#define FG_M_aero_v f->m_aero_v
|
inline double * get_M_aero_v() { return m_aero_v; }
|
||||||
#define FG_M_l_aero f->m_aero_v[0]
|
inline double get_M_l_aero() const { return m_aero_v[0]; }
|
||||||
#define FG_M_m_aero f->m_aero_v[1]
|
inline double get_M_m_aero() const { return m_aero_v[1]; }
|
||||||
#define FG_M_n_aero f->m_aero_v[2]
|
inline double get_M_n_aero() const { return m_aero_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 m_engine_v;
|
FG_VECTOR_3 m_engine_v;
|
||||||
#define FG_M_engine_v f->m_engine_v
|
inline double * get_M_engine_v() { return m_engine_v; }
|
||||||
#define FG_M_l_engine f->m_engine_v[0]
|
inline double get_M_l_engine() const { return m_engine_v[0]; }
|
||||||
#define FG_M_m_engine f->m_engine_v[1]
|
inline double get_M_m_engine() const { return m_engine_v[1]; }
|
||||||
#define FG_M_n_engine f->m_engine_v[2]
|
inline double get_M_n_engine() const { return m_engine_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 m_gear_v;
|
FG_VECTOR_3 m_gear_v;
|
||||||
#define FG_M_gear_v f->m_gear_v
|
inline double * get_M_gear_v() { return m_gear_v; }
|
||||||
#define FG_M_l_gear f->m_gear_v[0]
|
inline double get_M_l_gear() const { return m_gear_v[0]; }
|
||||||
#define FG_M_m_gear f->m_gear_v[1]
|
inline double get_M_m_gear() const { return m_gear_v[1]; }
|
||||||
#define FG_M_n_gear f->m_gear_v[2]
|
inline double get_M_n_gear() const { return m_gear_v[2]; }
|
||||||
|
|
||||||
/*============================== Accelerations ============================*/
|
/*============================== Accelerations ============================*/
|
||||||
|
|
||||||
FG_VECTOR_3 v_dot_local_v;
|
FG_VECTOR_3 v_dot_local_v;
|
||||||
#define FG_V_dot_local_v f->v_dot_local_v
|
inline double * get_V_dot_local_v() { return v_dot_local_v; }
|
||||||
#define FG_V_dot_north f->v_dot_local_v[0]
|
inline double get_V_dot_north() const { return v_dot_local_v[0]; }
|
||||||
#define FG_V_dot_east f->v_dot_local_v[1]
|
inline double get_V_dot_east() const { return v_dot_local_v[1]; }
|
||||||
#define FG_V_dot_down f->v_dot_local_v[2]
|
inline double get_V_dot_down() const { return v_dot_local_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 v_dot_body_v;
|
FG_VECTOR_3 v_dot_body_v;
|
||||||
#define FG_V_dot_body_v f->v_dot_body_v
|
inline double * get_V_dot_body_v() { return v_dot_body_v; }
|
||||||
#define FG_U_dot_body f->v_dot_body_v[0]
|
inline double get_U_dot_body() const { return v_dot_body_v[0]; }
|
||||||
#define FG_V_dot_body f->v_dot_body_v[1]
|
inline double get_V_dot_body() const { return v_dot_body_v[1]; }
|
||||||
#define FG_W_dot_body f->v_dot_body_v[2]
|
inline double get_W_dot_body() const { return v_dot_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 a_cg_body_v;
|
FG_VECTOR_3 a_cg_body_v;
|
||||||
#define FG_A_cg_body_v f->a_cg_body_v
|
inline double * get_A_cg_body_v() { return a_cg_body_v; }
|
||||||
#define FG_A_X_cg f->a_cg_body_v[0]
|
inline double get_A_X_cg() const { return a_cg_body_v[0]; }
|
||||||
#define FG_A_Y_cg f->a_cg_body_v[1]
|
inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
|
||||||
#define FG_A_Z_cg f->a_cg_body_v[2]
|
inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 a_pilot_body_v;
|
FG_VECTOR_3 a_pilot_body_v;
|
||||||
#define FG_A_pilot_body_v f->a_pilot_body_v
|
inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
|
||||||
#define FG_A_X_pilot f->a_pilot_body_v[0]
|
inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
|
||||||
#define FG_A_Y_pilot f->a_pilot_body_v[1]
|
inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
|
||||||
#define FG_A_Z_pilot f->a_pilot_body_v[2]
|
inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 n_cg_body_v;
|
FG_VECTOR_3 n_cg_body_v;
|
||||||
#define FG_N_cg_body_v f->n_cg_body_v
|
inline double * get_N_cg_body_v() { return n_cg_body_v; }
|
||||||
#define FG_N_X_cg f->n_cg_body_v[0]
|
inline double get_N_X_cg() const { return n_cg_body_v[0]; }
|
||||||
#define FG_N_Y_cg f->n_cg_body_v[1]
|
inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
|
||||||
#define FG_N_Z_cg f->n_cg_body_v[2]
|
inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 n_pilot_body_v;
|
FG_VECTOR_3 n_pilot_body_v;
|
||||||
#define FG_N_pilot_body_v f->n_pilot_body_v
|
inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
|
||||||
#define FG_N_X_pilot f->n_pilot_body_v[0]
|
inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
|
||||||
#define FG_N_Y_pilot f->n_pilot_body_v[1]
|
inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
|
||||||
#define FG_N_Z_pilot f->n_pilot_body_v[2]
|
inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 omega_dot_body_v;
|
FG_VECTOR_3 omega_dot_body_v;
|
||||||
#define FG_Omega_dot_body_v f->omega_dot_body_v
|
inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
|
||||||
#define FG_P_dot_body f->omega_dot_body_v[0]
|
inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
|
||||||
#define FG_Q_dot_body f->omega_dot_body_v[1]
|
inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
|
||||||
#define FG_R_dot_body f->omega_dot_body_v[2]
|
inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
|
||||||
|
|
||||||
|
|
||||||
/*============================== Velocities ===============================*/
|
/*============================== Velocities ===============================*/
|
||||||
|
|
||||||
FG_VECTOR_3 v_local_v;
|
FG_VECTOR_3 v_local_v;
|
||||||
#define FG_V_local_v f->v_local_v
|
inline double * get_V_local_v() { return v_local_v; }
|
||||||
#define FG_V_north f->v_local_v[0]
|
inline double get_V_north() const { return v_local_v[0]; }
|
||||||
#define FG_V_east f->v_local_v[1]
|
inline double get_V_east() const { return v_local_v[1]; }
|
||||||
#define FG_V_down f->v_local_v[2]
|
inline double get_V_down() const { return v_local_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 v_local_rel_ground_v; /* V rel w.r.t. earth surface */
|
FG_VECTOR_3 v_local_rel_ground_v; /* V rel w.r.t. earth surface */
|
||||||
#define FG_V_local_rel_ground_v f->v_local_rel_ground_v
|
inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
|
||||||
#define FG_V_north_rel_ground f->v_local_rel_ground_v[0]
|
inline double get_V_north_rel_ground() const {
|
||||||
#define FG_V_east_rel_ground f->v_local_rel_ground_v[1]
|
return v_local_rel_ground_v[0];
|
||||||
#define FG_V_down_rel_ground f->v_local_rel_ground_v[2]
|
}
|
||||||
|
inline double get_V_east_rel_ground() const {
|
||||||
|
return v_local_rel_ground_v[1];
|
||||||
|
}
|
||||||
|
inline double get_V_down_rel_ground() const {
|
||||||
|
return v_local_rel_ground_v[2];
|
||||||
|
}
|
||||||
|
|
||||||
FG_VECTOR_3 v_local_airmass_v; /* velocity of airmass (steady winds) */
|
FG_VECTOR_3 v_local_airmass_v; /* velocity of airmass (steady winds) */
|
||||||
#define FG_V_local_airmass_v f->v_local_airmass_v
|
inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
|
||||||
#define FG_V_north_airmass f->v_local_airmass_v[0]
|
inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
|
||||||
#define FG_V_east_airmass f->v_local_airmass_v[1]
|
inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
|
||||||
#define FG_V_down_airmass f->v_local_airmass_v[2]
|
inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 v_local_rel_airmass_v; /* velocity of veh. relative to */
|
FG_VECTOR_3 v_local_rel_airmass_v; /* velocity of veh. relative to */
|
||||||
/* airmass */
|
/* airmass */
|
||||||
#define FG_V_local_rel_airmass_v f->v_local_rel_airmass_v
|
inline double * get_V_local_rel_airmass_v() {
|
||||||
#define FG_V_north_rel_airmass f->v_local_rel_airmass_v[0]
|
return v_local_rel_airmass_v;
|
||||||
#define FG_V_east_rel_airmass f->v_local_rel_airmass_v[1]
|
}
|
||||||
#define FG_V_down_rel_airmass f->v_local_rel_airmass_v[2]
|
inline double get_V_north_rel_airmass() const {
|
||||||
|
return v_local_rel_airmass_v[0];
|
||||||
|
}
|
||||||
|
inline double get_V_east_rel_airmass() const {
|
||||||
|
return v_local_rel_airmass_v[1];
|
||||||
|
}
|
||||||
|
inline double get_V_down_rel_airmass() const {
|
||||||
|
return v_local_rel_airmass_v[2];
|
||||||
|
}
|
||||||
|
|
||||||
FG_VECTOR_3 v_local_gust_v; /* linear turbulence components, L frame */
|
FG_VECTOR_3 v_local_gust_v; /* linear turbulence components, L frame */
|
||||||
#define FG_V_local_gust_v f->v_local_gust_v
|
inline double * get_V_local_gust_v() { return v_local_gust_v; }
|
||||||
#define FG_U_gust f->v_local_gust_v[0]
|
inline double get_U_gust() const { return v_local_gust_v[0]; }
|
||||||
#define FG_V_gust f->v_local_gust_v[1]
|
inline double get_V_gust() const { return v_local_gust_v[1]; }
|
||||||
#define FG_W_gust f->v_local_gust_v[2]
|
inline double get_W_gust() const { return v_local_gust_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 v_wind_body_v; /* Wind-relative velocities in body axis */
|
FG_VECTOR_3 v_wind_body_v; /* Wind-relative velocities in body axis */
|
||||||
#define FG_V_wind_body_v f->v_wind_body_v
|
inline double * get_V_wind_body_v() { return v_wind_body_v; }
|
||||||
#define FG_U_body f->v_wind_body_v[0]
|
inline double get_U_body() const { return v_wind_body_v[0]; }
|
||||||
#define FG_V_body f->v_wind_body_v[1]
|
inline double get_V_body() const { return v_wind_body_v[1]; }
|
||||||
#define FG_W_body f->v_wind_body_v[2]
|
inline double get_W_body() const { return v_wind_body_v[2]; }
|
||||||
|
|
||||||
double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
|
double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
|
||||||
double v_ground_speed, v_equiv, v_equiv_kts;
|
double v_ground_speed, v_equiv, v_equiv_kts;
|
||||||
double v_calibrated, v_calibrated_kts;
|
double v_calibrated, v_calibrated_kts;
|
||||||
#define FG_V_rel_wind f->v_rel_wind
|
inline double get_V_rel_wind() const { return v_rel_wind; }
|
||||||
#define FG_V_true_kts f->v_true_kts
|
inline double get_V_true_kts() const { return v_true_kts; }
|
||||||
#define FG_V_rel_ground f->v_rel_ground
|
inline double get_V_rel_ground() const { return v_rel_ground; }
|
||||||
#define FG_V_inertial f->v_inertial
|
inline double get_V_inertial() const { return v_inertial; }
|
||||||
#define FG_V_ground_speed f->v_ground_speed
|
inline double get_V_ground_speed() const { return v_ground_speed; }
|
||||||
#define FG_V_equiv f->v_equiv
|
inline double get_V_equiv() const { return v_equiv; }
|
||||||
#define FG_V_equiv_kts f->v_equiv_kts
|
inline double get_V_equiv_kts() const { return v_equiv_kts; }
|
||||||
#define FG_V_calibrated f->v_calibrated
|
inline double get_V_calibrated() const { return v_calibrated; }
|
||||||
#define FG_V_calibrated_kts f->v_calibrated_kts
|
inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
|
||||||
|
|
||||||
FG_VECTOR_3 omega_body_v; /* Angular B rates */
|
FG_VECTOR_3 omega_body_v; /* Angular B rates */
|
||||||
#define FG_Omega_body_v f->omega_body_v
|
inline double * get_Omega_body_v() { return omega_body_v; }
|
||||||
#define FG_P_body f->omega_body_v[0]
|
inline double get_P_body() const { return omega_body_v[0]; }
|
||||||
#define FG_Q_body f->omega_body_v[1]
|
inline double get_Q_body() const { return omega_body_v[1]; }
|
||||||
#define FG_R_body f->omega_body_v[2]
|
inline double get_R_body() const { return omega_body_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 omega_local_v; /* Angular L rates */
|
FG_VECTOR_3 omega_local_v; /* Angular L rates */
|
||||||
#define FG_Omega_local_v f->omega_local_v
|
inline double * get_Omega_local_v() { return omega_local_v; }
|
||||||
#define FG_P_local f->omega_local_v[0]
|
inline double get_P_local() const { return omega_local_v[0]; }
|
||||||
#define FG_Q_local f->omega_local_v[1]
|
inline double get_Q_local() const { return omega_local_v[1]; }
|
||||||
#define FG_R_local f->omega_local_v[2]
|
inline double get_R_local() const { return omega_local_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 omega_total_v; /* Diff btw B & L */
|
FG_VECTOR_3 omega_total_v; /* Diff btw B & L */
|
||||||
#define FG_Omega_total_v f->omega_total_v
|
inline double * get_Omega_total_v() { return omega_total_v; }
|
||||||
#define FG_P_total f->omega_total_v[0]
|
inline double get_P_total() const { return omega_total_v[0]; }
|
||||||
#define FG_Q_total f->omega_total_v[1]
|
inline double get_Q_total() const { return omega_total_v[1]; }
|
||||||
#define FG_R_total f->omega_total_v[2]
|
inline double get_R_total() const { return omega_total_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 euler_rates_v;
|
FG_VECTOR_3 euler_rates_v;
|
||||||
#define FG_Euler_rates_v f->euler_rates_v
|
inline double * get_Euler_rates_v() { return euler_rates_v; }
|
||||||
#define FG_Phi_dot f->euler_rates_v[0]
|
inline double get_Phi_dot() const { return euler_rates_v[0]; }
|
||||||
#define FG_Theta_dot f->euler_rates_v[1]
|
inline double get_Theta_dot() const { return euler_rates_v[1]; }
|
||||||
#define FG_Psi_dot f->euler_rates_v[2]
|
inline double get_Psi_dot() const { return euler_rates_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 geocentric_rates_v; /* Geocentric linear velocities */
|
FG_VECTOR_3 geocentric_rates_v; /* Geocentric linear velocities */
|
||||||
#define FG_Geocentric_rates_v f->geocentric_rates_v
|
inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
|
||||||
#define FG_Latitude_dot f->geocentric_rates_v[0]
|
inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
|
||||||
#define FG_Longitude_dot f->geocentric_rates_v[1]
|
inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
|
||||||
#define FG_Radius_dot f->geocentric_rates_v[2]
|
inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
|
||||||
|
|
||||||
/*=============================== Positions ===============================*/
|
/*=============================== Positions ===============================*/
|
||||||
|
|
||||||
FG_VECTOR_3 geocentric_position_v;
|
FG_VECTOR_3 geocentric_position_v;
|
||||||
#define FG_Geocentric_position_v f->geocentric_position_v
|
inline double * get_Geocentric_position_v() {
|
||||||
#define FG_Lat_geocentric f->geocentric_position_v[0]
|
return geocentric_position_v;
|
||||||
#define FG_Lon_geocentric f->geocentric_position_v[1]
|
}
|
||||||
#define FG_Radius_to_vehicle f->geocentric_position_v[2]
|
inline double get_Lat_geocentric() const {
|
||||||
|
return geocentric_position_v[0];
|
||||||
|
}
|
||||||
|
inline double get_Lon_geocentric() const {
|
||||||
|
return geocentric_position_v[1];
|
||||||
|
}
|
||||||
|
inline double get_Radius_to_vehicle() const {
|
||||||
|
return geocentric_position_v[2];
|
||||||
|
}
|
||||||
|
inline void set_Radius_to_vehicle(double radius) {
|
||||||
|
geocentric_position_v[2] = radius;
|
||||||
|
}
|
||||||
|
|
||||||
FG_VECTOR_3 geodetic_position_v;
|
FG_VECTOR_3 geodetic_position_v;
|
||||||
#define FG_Geodetic_position_v f->geodetic_position_v
|
inline double * get_Geodetic_position_v() { return geodetic_position_v; }
|
||||||
#define FG_Latitude f->geodetic_position_v[0]
|
inline double get_Latitude() const { return geodetic_position_v[0]; }
|
||||||
#define FG_Longitude f->geodetic_position_v[1]
|
inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
|
||||||
#define FG_Altitude f->geodetic_position_v[2]
|
inline double get_Longitude() const { return geodetic_position_v[1]; }
|
||||||
|
inline void set_Longitude(double lon) { geodetic_position_v[0] = lon; }
|
||||||
|
inline double get_Altitude() const { return geodetic_position_v[2]; }
|
||||||
|
inline void set_Altitude(double altitude) {
|
||||||
|
geodetic_position_v[2] = altitude;
|
||||||
|
}
|
||||||
|
|
||||||
FG_VECTOR_3 euler_angles_v;
|
FG_VECTOR_3 euler_angles_v;
|
||||||
#define FG_Euler_angles_v f->euler_angles_v
|
inline double * get_Euler_angles_v() { return euler_angles_v; }
|
||||||
#define FG_Phi f->euler_angles_v[0]
|
inline double get_Phi() const { return euler_angles_v[0]; }
|
||||||
#define FG_Theta f->euler_angles_v[1]
|
inline double get_Theta() const { return euler_angles_v[1]; }
|
||||||
#define FG_Psi f->euler_angles_v[2]
|
inline double get_Psi() const { return euler_angles_v[2]; }
|
||||||
|
|
||||||
/*======================= Miscellaneous quantities ========================*/
|
/*======================= Miscellaneous quantities ========================*/
|
||||||
|
|
||||||
double t_local_to_body_m[3][3]; /* Transformation matrix L to B */
|
double t_local_to_body_m[3][3]; /* Transformation matrix L to B */
|
||||||
#define FG_T_local_to_body_m f->t_local_to_body_m
|
// inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
|
||||||
#define FG_T_local_to_body_11 f->t_local_to_body_m[0][0]
|
inline double get_T_local_to_body_11() const {
|
||||||
#define FG_T_local_to_body_12 f->t_local_to_body_m[0][1]
|
return t_local_to_body_m[0][0];
|
||||||
#define FG_T_local_to_body_13 f->t_local_to_body_m[0][2]
|
}
|
||||||
#define FG_T_local_to_body_21 f->t_local_to_body_m[1][0]
|
inline double get_T_local_to_body_12() const {
|
||||||
#define FG_T_local_to_body_22 f->t_local_to_body_m[1][1]
|
return t_local_to_body_m[0][1];
|
||||||
#define FG_T_local_to_body_23 f->t_local_to_body_m[1][2]
|
}
|
||||||
#define FG_T_local_to_body_31 f->t_local_to_body_m[2][0]
|
inline double get_T_local_to_body_13() const {
|
||||||
#define FG_T_local_to_body_32 f->t_local_to_body_m[2][1]
|
return t_local_to_body_m[0][2];
|
||||||
#define FG_T_local_to_body_33 f->t_local_to_body_m[2][2]
|
}
|
||||||
|
inline double get_T_local_to_body_21() const {
|
||||||
|
return t_local_to_body_m[1][0];
|
||||||
|
}
|
||||||
|
inline double get_T_local_to_body_22() const {
|
||||||
|
return t_local_to_body_m[1][1];
|
||||||
|
}
|
||||||
|
inline double get_T_local_to_body_23() const {
|
||||||
|
return t_local_to_body_m[1][2];
|
||||||
|
}
|
||||||
|
inline double get_T_local_to_body_31() const {
|
||||||
|
return t_local_to_body_m[2][0];
|
||||||
|
}
|
||||||
|
inline double get_T_local_to_body_32() const {
|
||||||
|
return t_local_to_body_m[2][1];
|
||||||
|
}
|
||||||
|
inline double get_T_local_to_body_33() const {
|
||||||
|
return t_local_to_body_m[2][2];
|
||||||
|
}
|
||||||
|
|
||||||
double gravity; /* Local acceleration due to G */
|
double gravity; /* Local acceleration due to G */
|
||||||
#define FG_Gravity f->gravity
|
inline double get_Gravity() const { return gravity; }
|
||||||
|
|
||||||
double centrifugal_relief; /* load factor reduction due to speed */
|
double centrifugal_relief; /* load factor reduction due to speed */
|
||||||
#define FG_Centrifugal_relief f->centrifugal_relief
|
inline double get_Centrifugal_relief() const { return centrifugal_relief; }
|
||||||
|
|
||||||
double alpha, beta, alpha_dot, beta_dot; /* in radians */
|
double alpha, beta, alpha_dot, beta_dot; /* in radians */
|
||||||
#define FG_Alpha f->alpha
|
inline double get_Alpha() const { return alpha; }
|
||||||
#define FG_Beta f->beta
|
inline double get_Beta() const { return beta; }
|
||||||
#define FG_Alpha_dot f->alpha_dot
|
inline double get_Alpha_dot() const { return alpha_dot; }
|
||||||
#define FG_Beta_dot f->beta_dot
|
inline double get_Beta_dot() const { return beta_dot; }
|
||||||
|
|
||||||
double cos_alpha, sin_alpha, cos_beta, sin_beta;
|
double cos_alpha, sin_alpha, cos_beta, sin_beta;
|
||||||
#define FG_Cos_alpha f->cos_alpha
|
inline double get_Cos_alpha() const { return cos_alpha; }
|
||||||
#define FG_Sin_alpha f->sin_alpha
|
inline double get_Sin_alpha() const { return sin_alpha; }
|
||||||
#define FG_Cos_beta f->cos_beta
|
inline double get_Cos_beta() const { return cos_beta; }
|
||||||
#define FG_Sin_beta f->sin_beta
|
inline double get_Sin_beta() const { return sin_beta; }
|
||||||
|
|
||||||
double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
|
double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
|
||||||
#define FG_Cos_phi f->cos_phi
|
inline double get_Cos_phi() const { return cos_phi; }
|
||||||
#define FG_Sin_phi f->sin_phi
|
inline double get_Sin_phi() const { return sin_phi; }
|
||||||
#define FG_Cos_theta f->cos_theta
|
inline double get_Cos_theta() const { return cos_theta; }
|
||||||
#define FG_Sin_theta f->sin_theta
|
inline double get_Sin_theta() const { return sin_theta; }
|
||||||
#define FG_Cos_psi f->cos_psi
|
inline double get_Cos_psi() const { return cos_psi; }
|
||||||
#define FG_Sin_psi f->sin_psi
|
inline double get_Sin_psi() const { return sin_psi; }
|
||||||
|
|
||||||
double gamma_vert_rad, gamma_horiz_rad; /* Flight path angles */
|
double gamma_vert_rad, gamma_horiz_rad; /* Flight path angles */
|
||||||
#define FG_Gamma_vert_rad f->gamma_vert_rad
|
inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
|
||||||
#define FG_Gamma_horiz_rad f->gamma_horiz_rad
|
inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
|
||||||
|
|
||||||
double sigma, density, v_sound, mach_number;
|
double sigma, density, v_sound, mach_number;
|
||||||
#define FG_Sigma f->sigma
|
inline double get_Sigma() const { return sigma; }
|
||||||
#define FG_Density f->density
|
inline double get_Density() const { return density; }
|
||||||
#define FG_V_sound f->v_sound
|
inline double get_V_sound() const { return v_sound; }
|
||||||
#define FG_Mach_number f->mach_number
|
inline double get_Mach_number() const { return mach_number; }
|
||||||
|
|
||||||
double static_pressure, total_pressure, impact_pressure;
|
double static_pressure, total_pressure, impact_pressure;
|
||||||
double dynamic_pressure;
|
double dynamic_pressure;
|
||||||
#define FG_Static_pressure f->static_pressure
|
inline double get_Static_pressure() const { return static_pressure; }
|
||||||
#define FG_Total_pressure f->total_pressure
|
inline double get_Total_pressure() const { return total_pressure; }
|
||||||
#define FG_Impact_pressure f->impact_pressure
|
inline double get_Impact_pressure() const { return impact_pressure; }
|
||||||
#define FG_Dynamic_pressure f->dynamic_pressure
|
inline double get_Dynamic_pressure() const { return dynamic_pressure; }
|
||||||
|
|
||||||
double static_temperature, total_temperature;
|
double static_temperature, total_temperature;
|
||||||
#define FG_Static_temperature f->static_temperature
|
inline double get_Static_temperature() const { return static_temperature; }
|
||||||
#define FG_Total_temperature f->total_temperature
|
inline double get_Total_temperature() const { return total_temperature; }
|
||||||
|
|
||||||
double sea_level_radius, earth_position_angle;
|
double sea_level_radius, earth_position_angle;
|
||||||
#define FG_Sea_level_radius f->sea_level_radius
|
inline double get_Sea_level_radius() const { return sea_level_radius; }
|
||||||
#define FG_Earth_position_angle f->earth_position_angle
|
inline double get_Earth_position_angle() const {
|
||||||
|
return earth_position_angle;
|
||||||
|
}
|
||||||
|
inline void set_Earth_position_angle(double angle) {
|
||||||
|
earth_position_angle = angle;
|
||||||
|
}
|
||||||
|
|
||||||
double runway_altitude, runway_latitude, runway_longitude;
|
double runway_altitude, runway_latitude, runway_longitude;
|
||||||
double runway_heading;
|
double runway_heading;
|
||||||
#define FG_Runway_altitude f->runway_altitude
|
inline double get_Runway_altitude() const { return runway_altitude; }
|
||||||
#define FG_Runway_latitude f->runway_latitude
|
inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
|
||||||
#define FG_Runway_longitude f->runway_longitude
|
inline double get_Runway_latitude() const { return runway_latitude; }
|
||||||
#define FG_Runway_heading f->runway_heading
|
inline double get_Runway_longitude() const { return runway_longitude; }
|
||||||
|
inline double get_Runway_heading() const { return runway_heading; }
|
||||||
|
|
||||||
double radius_to_rwy;
|
double radius_to_rwy;
|
||||||
#define FG_Radius_to_rwy f->radius_to_rwy
|
inline double get_Radius_to_rwy() const { return radius_to_rwy; }
|
||||||
|
|
||||||
FG_VECTOR_3 d_cg_rwy_local_v; /* CG rel. to rwy in local coords */
|
FG_VECTOR_3 d_cg_rwy_local_v; /* CG rel. to rwy in local coords */
|
||||||
#define FG_D_cg_rwy_local_v f->d_cg_rwy_local_v
|
inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
|
||||||
#define FG_D_cg_north_of_rwy f->d_cg_rwy_local_v[0]
|
inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
|
||||||
#define FG_D_cg_east_of_rwy f->d_cg_rwy_local_v[1]
|
inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
|
||||||
#define FG_D_cg_above_rwy f->d_cg_rwy_local_v[2]
|
inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 d_cg_rwy_rwy_v; /* CG relative to rwy, in rwy coordinates */
|
FG_VECTOR_3 d_cg_rwy_rwy_v; /* CG relative to rwy, in rwy coordinates */
|
||||||
#define FG_D_cg_rwy_rwy_v f->d_cg_rwy_rwy_v
|
inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
|
||||||
#define FG_X_cg_rwy f->d_cg_rwy_rwy_v[0]
|
inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
|
||||||
#define FG_Y_cg_rwy f->d_cg_rwy_rwy_v[1]
|
inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
|
||||||
#define FG_H_cg_rwy f->d_cg_rwy_rwy_v[2]
|
inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
|
||||||
|
|
||||||
FG_VECTOR_3 d_pilot_rwy_local_v; /* pilot rel. to rwy in local coords */
|
FG_VECTOR_3 d_pilot_rwy_local_v; /* pilot rel. to rwy in local coords */
|
||||||
#define FG_D_pilot_rwy_local_v f->d_pilot_rwy_local_v
|
inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
|
||||||
#define FG_D_pilot_north_of_rwy f->d_pilot_rwy_local_v[0]
|
inline double get_D_pilot_north_of_rwy() const {
|
||||||
#define FG_D_pilot_east_of_rwy f->d_pilot_rwy_local_v[1]
|
return d_pilot_rwy_local_v[0];
|
||||||
#define FG_D_pilot_above_rwy f->d_pilot_rwy_local_v[2]
|
}
|
||||||
|
inline double get_D_pilot_east_of_rwy() const {
|
||||||
|
return d_pilot_rwy_local_v[1];
|
||||||
|
}
|
||||||
|
inline double get_D_pilot_above_rwy() const {
|
||||||
|
return d_pilot_rwy_local_v[2];
|
||||||
|
}
|
||||||
|
|
||||||
FG_VECTOR_3 d_pilot_rwy_rwy_v; /* pilot rel. to rwy, in rwy coords. */
|
FG_VECTOR_3 d_pilot_rwy_rwy_v; /* pilot rel. to rwy, in rwy coords. */
|
||||||
#define FG_D_pilot_rwy_rwy_v f->d_pilot_rwy_rwy_v
|
inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
|
||||||
#define FG_X_pilot_rwy f->d_pilot_rwy_rwy_v[0]
|
inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
|
||||||
#define FG_Y_pilot_rwy f->d_pilot_rwy_rwy_v[1]
|
inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
|
||||||
#define FG_H_pilot_rwy f->d_pilot_rwy_rwy_v[2]
|
inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
|
||||||
|
|
||||||
double climb_rate; /* in feet per second */
|
double climb_rate; /* in feet per second */
|
||||||
#define FG_Climb_Rate f->climb_rate
|
inline double get_Climb_Rate() const { return climb_rate; }
|
||||||
|
inline void set_Climb_Rate(double rate) { climb_rate = rate; }
|
||||||
|
|
||||||
} fgFLIGHT, *pfgFlight;
|
// Additional convenience functions
|
||||||
|
|
||||||
|
// Inertias
|
||||||
|
inline void set_Inertias( double m, double xx, double yy,
|
||||||
|
double zz, double xz)
|
||||||
|
{
|
||||||
|
mass = m;
|
||||||
|
i_xx = xx;
|
||||||
|
i_yy = yy;
|
||||||
|
i_zz = zz;
|
||||||
|
i_xz = xz;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local velocities
|
||||||
|
inline void set_Local_Velocities( double v_north,
|
||||||
|
double v_east,
|
||||||
|
double v_down )
|
||||||
|
{
|
||||||
|
v_local_v[0] = v_north;
|
||||||
|
v_local_v[1] = v_east;
|
||||||
|
v_local_v[2] = v_down;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Orientation
|
||||||
|
inline void set_Euler_Orientation( double phi,
|
||||||
|
double theta,
|
||||||
|
double psi )
|
||||||
|
{
|
||||||
|
euler_angles_v[0] = phi;
|
||||||
|
euler_angles_v[1] = theta;
|
||||||
|
euler_angles_v[2] = psi;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Body Rates
|
||||||
|
inline void set_Body_Rates( double p_body, double q_body, double r_body )
|
||||||
|
{
|
||||||
|
omega_body_v[0] = p_body;
|
||||||
|
omega_body_v[1] = q_body;
|
||||||
|
omega_body_v[2] = r_body;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center of Gravity position w.r.t. ref. point
|
||||||
|
inline void set_CG_Position( double dx, double dy, double dz )
|
||||||
|
{
|
||||||
|
d_cg_rp_body_v[0] = dx;
|
||||||
|
d_cg_rp_body_v[1] = dy;
|
||||||
|
d_cg_rp_body_v[2] = dz;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
extern fgFLIGHT cur_flight_params;
|
extern fgFLIGHT cur_flight_params;
|
||||||
|
@ -397,19 +520,22 @@ extern fgFLIGHT cur_flight_params;
|
||||||
/* General interface to the flight model routines */
|
/* General interface to the flight model routines */
|
||||||
|
|
||||||
/* Initialize the flight model parameters */
|
/* Initialize the flight model parameters */
|
||||||
int fgFlightModelInit(int model, fgFLIGHT *f, double dt);
|
int fgFlightModelInit(int model, fgFLIGHT& f, double dt);
|
||||||
|
|
||||||
/* Run multiloop iterations of the flight model */
|
/* Run multiloop iterations of the flight model */
|
||||||
int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop);
|
int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop);
|
||||||
|
|
||||||
/* Set the altitude (force) */
|
/* Set the altitude (force) */
|
||||||
void fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters);
|
void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _FLIGHT_H */
|
#endif /* _FLIGHT_H */
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.3 1998/12/03 01:16:41 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.2 1998/10/16 23:27:41 curt
|
// Revision 1.2 1998/10/16 23:27:41 curt
|
||||||
// C++-ifying.
|
// C++-ifying.
|
||||||
//
|
//
|
||||||
|
|
|
@ -231,13 +231,13 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
t->pause = !t->pause;
|
t->pause = !t->pause;
|
||||||
// printf position and attitude information
|
// printf position and attitude information
|
||||||
FG_LOG( FG_INPUT, FG_INFO,
|
FG_LOG( FG_INPUT, FG_INFO,
|
||||||
"Lon = " << FG_Longitude * RAD_TO_DEG
|
"Lon = " << f->get_Longitude() * RAD_TO_DEG
|
||||||
<< " Lat = " << FG_Latitude * RAD_TO_DEG
|
<< " Lat = " << f->get_Latitude() * RAD_TO_DEG
|
||||||
<< " Altitude = " << FG_Altitude * FEET_TO_METER );
|
<< " Altitude = " << f->get_Altitude() * FEET_TO_METER );
|
||||||
FG_LOG( FG_INPUT, FG_INFO,
|
FG_LOG( FG_INPUT, FG_INFO,
|
||||||
"Heading = " << FG_Psi * RAD_TO_DEG
|
"Heading = " << f->get_Psi() * RAD_TO_DEG
|
||||||
<< " Roll = " << FG_Phi * RAD_TO_DEG
|
<< " Roll = " << f->get_Phi() * RAD_TO_DEG
|
||||||
<< " Pitch = " << FG_Theta * RAD_TO_DEG );
|
<< " Pitch = " << f->get_Theta() * RAD_TO_DEG );
|
||||||
return;
|
return;
|
||||||
case 116: // t key
|
case 116: // t key
|
||||||
t->warp_delta += 30;
|
t->warp_delta += 30;
|
||||||
|
@ -386,6 +386,9 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.33 1998/12/03 01:17:12 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.32 1998/11/06 21:18:06 curt
|
// Revision 1.32 1998/11/06 21:18:06 curt
|
||||||
// Converted to new logstream debugging facility. This allows release
|
// Converted to new logstream debugging facility. This allows release
|
||||||
// builds with no messages at all (and no performance impact) by using
|
// builds with no messages at all (and no performance impact) by using
|
||||||
|
|
|
@ -392,9 +392,11 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
|
||||||
fgAPRun();
|
fgAPRun();
|
||||||
|
|
||||||
// printf("updating flight model x %d\n", multi_loop);
|
// printf("updating flight model x %d\n", multi_loop);
|
||||||
fgFlightModelUpdate(current_options.get_flight_model(), f, multi_loop);
|
fgFlightModelUpdate( current_options.get_flight_model(),
|
||||||
|
cur_flight_params, multi_loop );
|
||||||
} else {
|
} else {
|
||||||
fgFlightModelUpdate(current_options.get_flight_model(), f, 0);
|
fgFlightModelUpdate( current_options.get_flight_model(),
|
||||||
|
cur_flight_params, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the view angle
|
// update the view angle
|
||||||
|
@ -425,7 +427,7 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double tmp = -(l->sun_rotation + FG_PI) - (FG_Psi - v->view_offset);
|
double tmp = -(l->sun_rotation + FG_PI) - (f->get_Psi() - v->view_offset);
|
||||||
while ( tmp < 0.0 ) {
|
while ( tmp < 0.0 ) {
|
||||||
tmp += FG_2PI;
|
tmp += FG_2PI;
|
||||||
}
|
}
|
||||||
|
@ -480,21 +482,22 @@ static void fgMainLoop( void ) {
|
||||||
FG_Altitude * FEET_TO_METER); */
|
FG_Altitude * FEET_TO_METER); */
|
||||||
|
|
||||||
if ( scenery.cur_elev > -9990 ) {
|
if ( scenery.cur_elev > -9990 ) {
|
||||||
if ( FG_Altitude * FEET_TO_METER <
|
if ( f->get_Altitude() * FEET_TO_METER <
|
||||||
(scenery.cur_elev + alt_adjust_m - 3.0) ) {
|
(scenery.cur_elev + alt_adjust_m - 3.0) ) {
|
||||||
// now set aircraft altitude above ground
|
// now set aircraft altitude above ground
|
||||||
printf("Current Altitude = %.2f < %.2f forcing to %.2f\n",
|
printf("Current Altitude = %.2f < %.2f forcing to %.2f\n",
|
||||||
FG_Altitude * FEET_TO_METER,
|
f->get_Altitude() * FEET_TO_METER,
|
||||||
scenery.cur_elev + alt_adjust_m - 3.0,
|
scenery.cur_elev + alt_adjust_m - 3.0,
|
||||||
scenery.cur_elev + alt_adjust_m );
|
scenery.cur_elev + alt_adjust_m );
|
||||||
fgFlightModelSetAltitude( current_options.get_flight_model(), f,
|
fgFlightModelSetAltitude( current_options.get_flight_model(),
|
||||||
|
cur_flight_params,
|
||||||
scenery.cur_elev + alt_adjust_m );
|
scenery.cur_elev + alt_adjust_m );
|
||||||
|
|
||||||
FG_LOG( FG_ALL, FG_BULK,
|
FG_LOG( FG_ALL, FG_BULK,
|
||||||
"<*> resetting altitude to "
|
"<*> resetting altitude to "
|
||||||
<< FG_Altitude * FEET_TO_METER << " meters" );
|
<< f->get_Altitude() * FEET_TO_METER << " meters" );
|
||||||
}
|
}
|
||||||
FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET;
|
f->set_Runway_altitude( scenery.cur_elev * METER_TO_FEET );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf("Adjustment - ground = %.2f runway = %.2f alt = %.2f\n",
|
/* printf("Adjustment - ground = %.2f runway = %.2f alt = %.2f\n",
|
||||||
|
@ -606,7 +609,7 @@ static void fgMainLoop( void ) {
|
||||||
// Angle of Attack next... -x^3(e^x) is my best guess Just
|
// Angle of Attack next... -x^3(e^x) is my best guess Just
|
||||||
// need to calculate some reasonable scaling factor and
|
// need to calculate some reasonable scaling factor and
|
||||||
// then clamp it on the positive aoa (neg adj) side
|
// then clamp it on the positive aoa (neg adj) side
|
||||||
double aoa = FG_Gamma_vert_rad * 2.2;
|
double aoa = f->get_Gamma_vert_rad() * 2.2;
|
||||||
double tmp = 3.0;
|
double tmp = 3.0;
|
||||||
double aoa_adj = pow(-aoa, tmp) * pow(M_E, aoa);
|
double aoa_adj = pow(-aoa, tmp) * pow(M_E, aoa);
|
||||||
if (aoa_adj < -0.8) aoa_adj = -0.8;
|
if (aoa_adj < -0.8) aoa_adj = -0.8;
|
||||||
|
@ -1011,6 +1014,9 @@ int main( int argc, char **argv ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.70 1998/12/03 01:17:14 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.69 1998/11/23 20:51:26 curt
|
// Revision 1.69 1998/11/23 20:51:26 curt
|
||||||
// Fiddling with when I can get info from the opengl driver.
|
// Fiddling with when I can get info from the opengl driver.
|
||||||
//
|
//
|
||||||
|
|
|
@ -67,8 +67,7 @@ fgfs_LDADD = \
|
||||||
$(top_builddir)/Lib/PUI/libPUI.a \
|
$(top_builddir)/Lib/PUI/libPUI.a \
|
||||||
$(top_builddir)/Lib/zlib/libz.a \
|
$(top_builddir)/Lib/zlib/libz.a \
|
||||||
$(top_builddir)/Lib/Misc/libMisc.a \
|
$(top_builddir)/Lib/Misc/libMisc.a \
|
||||||
$(opengl_LIBS) \
|
$(opengl_LIBS)
|
||||||
$(base_LIBS)
|
|
||||||
|
|
||||||
INCLUDES += \
|
INCLUDES += \
|
||||||
-I$(top_builddir) \
|
-I$(top_builddir) \
|
||||||
|
|
|
@ -96,26 +96,26 @@ int fgInitPosition( void ) {
|
||||||
"Failed to find " << id << " in database." );
|
"Failed to find " << id << " in database." );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else {
|
} else {
|
||||||
FG_Longitude = a.longitude * DEG_TO_RAD;
|
f->set_Longitude( a.longitude * DEG_TO_RAD );
|
||||||
FG_Latitude = a.latitude * DEG_TO_RAD;
|
f->set_Latitude( a.latitude * DEG_TO_RAD );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// set initial position from default or command line coordinates
|
// set initial position from default or command line coordinates
|
||||||
|
|
||||||
FG_Longitude = current_options.get_lon() * DEG_TO_RAD;
|
f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
|
||||||
FG_Latitude = current_options.get_lat() * DEG_TO_RAD;
|
f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
|
||||||
}
|
}
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"starting altitude is = " << current_options.get_altitude() );
|
"starting altitude is = " << current_options.get_altitude() );
|
||||||
|
|
||||||
FG_Altitude = current_options.get_altitude() * METER_TO_FEET;
|
f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
|
||||||
FG_Runway_altitude = FG_Altitude - 3.758099;
|
f->set_Runway_altitude( f->get_Altitude() - 3.758099 );
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"Initial position is: ("
|
"Initial position is: ("
|
||||||
<< (FG_Longitude * RAD_TO_DEG) << ", "
|
<< (f->get_Longitude() * RAD_TO_DEG) << ", "
|
||||||
<< (FG_Latitude * RAD_TO_DEG) << ", "
|
<< (f->get_Latitude() * RAD_TO_DEG) << ", "
|
||||||
<< (FG_Altitude * FEET_TO_METER) << ")" );
|
<< (f->get_Altitude() * FEET_TO_METER) << ")" );
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
@ -194,65 +194,60 @@ int fgInitSubsystems( void )
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate ground elevation at starting point (we didn't have
|
||||||
|
// abs_view_pos calculated when fgTileMgrUpdate() was called above
|
||||||
|
|
||||||
// calculalate a cartesian point somewhere along the line between
|
// calculalate a cartesian point somewhere along the line between
|
||||||
// the center of the earth and our view position. Doesn't have to
|
// the center of the earth and our view position. Doesn't have to
|
||||||
// be the exact elevation (this is good because we don't know it
|
// be the exact elevation (this is good because we don't know it
|
||||||
// yet :-)
|
// yet :-)
|
||||||
geod_pos = Point3D( FG_Longitude, FG_Latitude, 0.0);
|
geod_pos = Point3D( f->get_Longitude(), f->get_Latitude(), 0.0);
|
||||||
abs_view_pos = fgGeodToCart(geod_pos);
|
abs_view_pos = fgGeodToCart(geod_pos);
|
||||||
|
|
||||||
// Calculate ground elevation at starting point
|
|
||||||
FG_LOG( FG_GENERAL, FG_DEBUG,
|
FG_LOG( FG_GENERAL, FG_DEBUG,
|
||||||
"Altitude before update " << scenery.cur_elev );
|
"Altitude before update " << scenery.cur_elev );
|
||||||
scenery.cur_elev =
|
scenery.cur_elev =
|
||||||
fgTileMgrCurElev( FG_Longitude, FG_Latitude, abs_view_pos );
|
fgTileMgrCurElevOLD( f->get_Longitude(),
|
||||||
|
f->get_Latitude(),
|
||||||
|
abs_view_pos );
|
||||||
FG_LOG( FG_GENERAL, FG_DEBUG,
|
FG_LOG( FG_GENERAL, FG_DEBUG,
|
||||||
"Altitude after update " << scenery.cur_elev );
|
"Altitude after update " << scenery.cur_elev );
|
||||||
FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET;
|
f->set_Runway_altitude( scenery.cur_elev * METER_TO_FEET );
|
||||||
|
|
||||||
// Reset our altitude if we are below ground
|
// Reset our altitude if we are below ground
|
||||||
if ( FG_Altitude < FG_Runway_altitude + 3.758099) {
|
if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
f->set_Altitude( f->get_Runway_altitude() + 3.758099 );
|
||||||
}
|
}
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"Updated position (after elevation adj): ("
|
"Updated position (after elevation adj): ("
|
||||||
<< (FG_Latitude * RAD_TO_DEG) << ", "
|
<< (f->get_Latitude() * RAD_TO_DEG) << ", "
|
||||||
<< (FG_Longitude * RAD_TO_DEG) << ", "
|
<< (f->get_Longitude() * RAD_TO_DEG) << ", "
|
||||||
<< (FG_Altitude * FEET_TO_METER) << ")" );
|
<< (f->get_Altitude() * FEET_TO_METER) << ")" );
|
||||||
// end of thing that I just stuck in that I should probably move
|
// end of thing that I just stuck in that I should probably move
|
||||||
|
|
||||||
// The following section sets up the flight model EOM parameters
|
// The following section sets up the flight model EOM parameters
|
||||||
// and should really be read in from one or more files.
|
// and should really be read in from one or more files.
|
||||||
|
|
||||||
// Initial Velocity
|
// Initial Velocity
|
||||||
FG_V_north = 0.0; // 7.287719E+00
|
f->set_Local_Velocities( 0.0, 0.0, 0.0 );
|
||||||
FG_V_east = 0.0; // 1.521770E+03
|
|
||||||
FG_V_down = 0.0; // -1.265722E-05
|
|
||||||
|
|
||||||
// Initial Orientation
|
// Initial Orientation
|
||||||
FG_Phi = current_options.get_roll() * DEG_TO_RAD;
|
f->set_Euler_Orientation( current_options.get_roll() * DEG_TO_RAD,
|
||||||
FG_Theta = current_options.get_pitch() * DEG_TO_RAD;
|
current_options.get_pitch() * DEG_TO_RAD,
|
||||||
FG_Psi = current_options.get_heading() * DEG_TO_RAD;
|
current_options.get_heading() * DEG_TO_RAD );
|
||||||
|
|
||||||
// Initial Angular B rates
|
// Initial Angular Body rates
|
||||||
FG_P_body = 7.206685E-05;
|
f->set_Body_Rates( 7.206685E-05, 0.000000E+00, 9.492658E-05 );
|
||||||
FG_Q_body = 0.000000E+00;
|
|
||||||
FG_R_body = 9.492658E-05;
|
|
||||||
|
|
||||||
FG_Earth_position_angle = 0.000000E+00;
|
f->set_Earth_position_angle( 0.000000E+00 );
|
||||||
|
|
||||||
// Mass properties and geometry values
|
// Mass properties and geometry values
|
||||||
FG_Mass = 8.547270E+01;
|
f->set_Inertias( 8.547270E+01,
|
||||||
FG_I_xx = 1.048000E+03;
|
1.048000E+03, 3.000000E+03, 3.530000E+03, 0.000000E+00 );
|
||||||
FG_I_yy = 3.000000E+03;
|
|
||||||
FG_I_zz = 3.530000E+03;
|
|
||||||
FG_I_xz = 0.000000E+00;
|
|
||||||
|
|
||||||
// CG position w.r.t. ref. point
|
// CG position w.r.t. ref. point
|
||||||
FG_Dx_cg = 0.000000E+00;
|
f->set_CG_Position( 0.0, 0.0, 0.0 );
|
||||||
FG_Dy_cg = 0.000000E+00;
|
|
||||||
FG_Dz_cg = 0.000000E+00;
|
|
||||||
|
|
||||||
// Initialize the event manager
|
// Initialize the event manager
|
||||||
global_events.Init();
|
global_events.Init();
|
||||||
|
@ -336,22 +331,22 @@ int fgInitSubsystems( void )
|
||||||
// Initialize the flight model subsystem data structures base on
|
// Initialize the flight model subsystem data structures base on
|
||||||
// above values
|
// above values
|
||||||
|
|
||||||
fgFlightModelInit( current_options.get_flight_model(), f,
|
fgFlightModelInit( current_options.get_flight_model(), cur_flight_params,
|
||||||
1.0 / DEFAULT_MODEL_HZ );
|
1.0 / DEFAULT_MODEL_HZ );
|
||||||
|
|
||||||
// I'm just sticking this here for now, it should probably move
|
// I'm just sticking this here for now, it should probably move
|
||||||
// eventually
|
// eventually
|
||||||
scenery.cur_elev = FG_Runway_altitude * FEET_TO_METER;
|
scenery.cur_elev = f->get_Runway_altitude() * FEET_TO_METER;
|
||||||
|
|
||||||
if ( FG_Altitude < FG_Runway_altitude + 3.758099) {
|
if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
f->set_Altitude( f->get_Runway_altitude() + 3.758099 );
|
||||||
}
|
}
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
"Updated position (after elevation adj): ("
|
"Updated position (after elevation adj): ("
|
||||||
<< (FG_Latitude * RAD_TO_DEG) << ", "
|
<< (f->get_Latitude() * RAD_TO_DEG) << ", "
|
||||||
<< (FG_Longitude * RAD_TO_DEG) << ", "
|
<< (f->get_Longitude() * RAD_TO_DEG) << ", "
|
||||||
<< (FG_Altitude * FEET_TO_METER) << ")" );
|
<< (f->get_Altitude() * FEET_TO_METER) << ")" );
|
||||||
// end of thing that I just stuck in that I should probably move
|
// end of thing that I just stuck in that I should probably move
|
||||||
|
|
||||||
// Joystick support
|
// Joystick support
|
||||||
|
@ -374,6 +369,9 @@ int fgInitSubsystems( void )
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.52 1998/12/03 01:17:17 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.51 1998/11/20 01:02:37 curt
|
// Revision 1.51 1998/11/20 01:02:37 curt
|
||||||
// Try to detect Mesa/Glide/Voodoo and chose the appropriate resolution.
|
// Try to detect Mesa/Glide/Voodoo and chose the appropriate resolution.
|
||||||
//
|
//
|
||||||
|
|
|
@ -247,7 +247,7 @@ static void send_nmea_out( fgIOCHANNEL& p ) {
|
||||||
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec );
|
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec );
|
||||||
|
|
||||||
char lat[20];
|
char lat[20];
|
||||||
double latd = FG_Latitude * RAD_TO_DEG;
|
double latd = f->get_Latitude() * RAD_TO_DEG;
|
||||||
if ( latd < 0.0 ) {
|
if ( latd < 0.0 ) {
|
||||||
latd *= -1.0;
|
latd *= -1.0;
|
||||||
dir = 'S';
|
dir = 'S';
|
||||||
|
@ -259,7 +259,7 @@ static void send_nmea_out( fgIOCHANNEL& p ) {
|
||||||
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
|
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
|
||||||
|
|
||||||
char lon[20];
|
char lon[20];
|
||||||
double lond = FG_Longitude * RAD_TO_DEG;
|
double lond = f->get_Longitude() * RAD_TO_DEG;
|
||||||
if ( lond < 0.0 ) {
|
if ( lond < 0.0 ) {
|
||||||
lond *= -1.0;
|
lond *= -1.0;
|
||||||
dir = 'W';
|
dir = 'W';
|
||||||
|
@ -271,16 +271,16 @@ static void send_nmea_out( fgIOCHANNEL& p ) {
|
||||||
sprintf( lon, "%03d%06.3f,%c", abs(deg), min, dir);
|
sprintf( lon, "%03d%06.3f,%c", abs(deg), min, dir);
|
||||||
|
|
||||||
char speed[10];
|
char speed[10];
|
||||||
sprintf( speed, "%05.1f", FG_V_equiv_kts );
|
sprintf( speed, "%05.1f", f->get_V_equiv_kts() );
|
||||||
|
|
||||||
char heading[10];
|
char heading[10];
|
||||||
sprintf( heading, "%05.1f", FG_Psi * RAD_TO_DEG );
|
sprintf( heading, "%05.1f", f->get_Psi() * RAD_TO_DEG );
|
||||||
|
|
||||||
char altitude_m[10];
|
char altitude_m[10];
|
||||||
sprintf( altitude_m, "%02d", (int)(FG_Altitude * FEET_TO_METER) );
|
sprintf( altitude_m, "%02d", (int)(f->get_Altitude() * FEET_TO_METER) );
|
||||||
|
|
||||||
char altitude_ft[10];
|
char altitude_ft[10];
|
||||||
sprintf( altitude_ft, "%02d", (int)FG_Altitude );
|
sprintf( altitude_ft, "%02d", (int)f->get_Altitude() );
|
||||||
|
|
||||||
char date[10];
|
char date[10];
|
||||||
sprintf( date, "%02d%02d%02d",
|
sprintf( date, "%02d%02d%02d",
|
||||||
|
@ -346,7 +346,7 @@ static void send_garmin_out( fgIOCHANNEL& p ) {
|
||||||
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec );
|
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec );
|
||||||
|
|
||||||
char lat[20];
|
char lat[20];
|
||||||
double latd = FG_Latitude * RAD_TO_DEG;
|
double latd = f->get_Latitude() * RAD_TO_DEG;
|
||||||
if ( latd < 0.0 ) {
|
if ( latd < 0.0 ) {
|
||||||
latd *= -1.0;
|
latd *= -1.0;
|
||||||
dir = 'S';
|
dir = 'S';
|
||||||
|
@ -358,7 +358,7 @@ static void send_garmin_out( fgIOCHANNEL& p ) {
|
||||||
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
|
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
|
||||||
|
|
||||||
char lon[20];
|
char lon[20];
|
||||||
double lond = FG_Longitude * RAD_TO_DEG;
|
double lond = f->get_Longitude() * RAD_TO_DEG;
|
||||||
if ( lond < 0.0 ) {
|
if ( lond < 0.0 ) {
|
||||||
lond *= -1.0;
|
lond *= -1.0;
|
||||||
dir = 'W';
|
dir = 'W';
|
||||||
|
@ -370,16 +370,16 @@ static void send_garmin_out( fgIOCHANNEL& p ) {
|
||||||
sprintf( lon, "%03d%06.3f,%c", abs(deg), min, dir);
|
sprintf( lon, "%03d%06.3f,%c", abs(deg), min, dir);
|
||||||
|
|
||||||
char speed[10];
|
char speed[10];
|
||||||
sprintf( speed, "%05.1f", FG_V_equiv_kts );
|
sprintf( speed, "%05.1f", f->get_V_equiv_kts() );
|
||||||
|
|
||||||
char heading[10];
|
char heading[10];
|
||||||
sprintf( heading, "%05.1f", FG_Psi * RAD_TO_DEG );
|
sprintf( heading, "%05.1f", f->get_Psi() * RAD_TO_DEG );
|
||||||
|
|
||||||
char altitude_m[10];
|
char altitude_m[10];
|
||||||
sprintf( altitude_m, "%02d", (int)(FG_Altitude * FEET_TO_METER) );
|
sprintf( altitude_m, "%02d", (int)(f->get_Altitude() * FEET_TO_METER) );
|
||||||
|
|
||||||
char altitude_ft[10];
|
char altitude_ft[10];
|
||||||
sprintf( altitude_ft, "%02d", (int)FG_Altitude );
|
sprintf( altitude_ft, "%02d", (int)f->get_Altitude() );
|
||||||
|
|
||||||
char date[10];
|
char date[10];
|
||||||
sprintf( date, "%02d%02d%02d",
|
sprintf( date, "%02d%02d%02d",
|
||||||
|
@ -451,6 +451,9 @@ void fgSerialProcess() {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.6 1998/12/03 01:17:18 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.5 1998/11/30 17:43:32 curt
|
// Revision 1.5 1998/11/30 17:43:32 curt
|
||||||
// Lots of tweaking to get serial output to actually work.
|
// Lots of tweaking to get serial output to actually work.
|
||||||
//
|
//
|
||||||
|
|
|
@ -216,7 +216,7 @@ void fgVIEW::UpdateViewParams( void ) {
|
||||||
// Tell GL we are about to modify the projection parameters
|
// Tell GL we are about to modify the projection parameters
|
||||||
xglMatrixMode(GL_PROJECTION);
|
xglMatrixMode(GL_PROJECTION);
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
if ( FG_Altitude * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
|
if ( f->get_Altitude() * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
|
||||||
gluPerspective(current_options.get_fov(), win_ratio, 10.0, 100000.0);
|
gluPerspective(current_options.get_fov(), win_ratio, 10.0, 100000.0);
|
||||||
} else {
|
} else {
|
||||||
gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
|
gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
|
||||||
|
@ -281,18 +281,18 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
|
||||||
// scenery.center.y, scenery.center.z);
|
// scenery.center.y, scenery.center.z);
|
||||||
|
|
||||||
// calculate the cartesion coords of the current lat/lon/0 elev
|
// calculate the cartesion coords of the current lat/lon/0 elev
|
||||||
p = Point3D( FG_Longitude,
|
p = Point3D( f->get_Longitude(),
|
||||||
FG_Lat_geocentric,
|
f->get_Lat_geocentric(),
|
||||||
FG_Sea_level_radius * FEET_TO_METER );
|
f->get_Sea_level_radius() * FEET_TO_METER );
|
||||||
|
|
||||||
cur_zero_elev = fgPolarToCart3d(p) - scenery.center;
|
cur_zero_elev = fgPolarToCart3d(p) - scenery.center;
|
||||||
|
|
||||||
// calculate view position in current FG view coordinate system
|
// calculate view position in current FG view coordinate system
|
||||||
// p.lon & p.lat are already defined earlier, p.radius was set to
|
// p.lon & p.lat are already defined earlier, p.radius was set to
|
||||||
// the sea level radius, so now we add in our altitude.
|
// the sea level radius, so now we add in our altitude.
|
||||||
if ( FG_Altitude * FEET_TO_METER >
|
if ( f->get_Altitude() * FEET_TO_METER >
|
||||||
(scenery.cur_elev + 0.5 * METER_TO_FEET) ) {
|
(scenery.cur_elev + 0.5 * METER_TO_FEET) ) {
|
||||||
p.setz( p.radius() + FG_Altitude * FEET_TO_METER );
|
p.setz( p.radius() + f->get_Altitude() * FEET_TO_METER );
|
||||||
} else {
|
} else {
|
||||||
p.setz( p.radius() + scenery.cur_elev + 0.5 * METER_TO_FEET );
|
p.setz( p.radius() + scenery.cur_elev + 0.5 * METER_TO_FEET );
|
||||||
}
|
}
|
||||||
|
@ -312,17 +312,17 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
|
||||||
|
|
||||||
// Question: Why is the LaRCsim matrix arranged so differently
|
// Question: Why is the LaRCsim matrix arranged so differently
|
||||||
// than the one we need???
|
// than the one we need???
|
||||||
LOCAL[0][0] = FG_T_local_to_body_33;
|
LOCAL[0][0] = f->get_T_local_to_body_33();
|
||||||
LOCAL[0][1] = -FG_T_local_to_body_32;
|
LOCAL[0][1] = -f->get_T_local_to_body_32();
|
||||||
LOCAL[0][2] = -FG_T_local_to_body_31;
|
LOCAL[0][2] = -f->get_T_local_to_body_31();
|
||||||
LOCAL[0][3] = 0.0;
|
LOCAL[0][3] = 0.0;
|
||||||
LOCAL[1][0] = -FG_T_local_to_body_23;
|
LOCAL[1][0] = -f->get_T_local_to_body_23();
|
||||||
LOCAL[1][1] = FG_T_local_to_body_22;
|
LOCAL[1][1] = f->get_T_local_to_body_22();
|
||||||
LOCAL[1][2] = FG_T_local_to_body_21;
|
LOCAL[1][2] = f->get_T_local_to_body_21();
|
||||||
LOCAL[1][3] = 0.0;
|
LOCAL[1][3] = 0.0;
|
||||||
LOCAL[2][0] = -FG_T_local_to_body_13;
|
LOCAL[2][0] = -f->get_T_local_to_body_13();
|
||||||
LOCAL[2][1] = FG_T_local_to_body_12;
|
LOCAL[2][1] = f->get_T_local_to_body_12();
|
||||||
LOCAL[2][2] = FG_T_local_to_body_11;
|
LOCAL[2][2] = f->get_T_local_to_body_11();
|
||||||
LOCAL[2][3] = 0.0;
|
LOCAL[2][3] = 0.0;
|
||||||
LOCAL[3][0] = LOCAL[3][1] = LOCAL[3][2] = LOCAL[3][3] = 0.0;
|
LOCAL[3][0] = LOCAL[3][1] = LOCAL[3][2] = LOCAL[3][3] = 0.0;
|
||||||
LOCAL[3][3] = 1.0;
|
LOCAL[3][3] = 1.0;
|
||||||
|
@ -334,13 +334,13 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
|
||||||
// Theta, and Psi (roll, pitch, yaw)
|
// Theta, and Psi (roll, pitch, yaw)
|
||||||
|
|
||||||
MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
|
MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
|
||||||
MAT3rotate(R, vec, FG_Phi);
|
MAT3rotate(R, vec, f->get_Phi());
|
||||||
/* printf("Roll matrix\n"); */
|
/* printf("Roll matrix\n"); */
|
||||||
/* MAT3print(R, stdout); */
|
/* MAT3print(R, stdout); */
|
||||||
|
|
||||||
MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
|
MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
|
||||||
/* MAT3mult_vec(vec, vec, R); */
|
/* MAT3mult_vec(vec, vec, R); */
|
||||||
MAT3rotate(TMP, vec, FG_Theta);
|
MAT3rotate(TMP, vec, f->get_Theta());
|
||||||
/* printf("Pitch matrix\n"); */
|
/* printf("Pitch matrix\n"); */
|
||||||
/* MAT3print(TMP, stdout); */
|
/* MAT3print(TMP, stdout); */
|
||||||
MAT3mult(R, R, TMP);
|
MAT3mult(R, R, TMP);
|
||||||
|
@ -348,7 +348,7 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
|
||||||
MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
|
MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
|
||||||
/* MAT3mult_vec(vec, vec, R); */
|
/* MAT3mult_vec(vec, vec, R); */
|
||||||
/* MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); */
|
/* MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); */
|
||||||
MAT3rotate(TMP, vec, -FG_Psi);
|
MAT3rotate(TMP, vec, -f->get_Psi());
|
||||||
/* printf("Yaw matrix\n");
|
/* printf("Yaw matrix\n");
|
||||||
MAT3print(TMP, stdout); */
|
MAT3print(TMP, stdout); */
|
||||||
MAT3mult(LOCAL, R, TMP);
|
MAT3mult(LOCAL, R, TMP);
|
||||||
|
@ -359,13 +359,13 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
|
||||||
// Derive the local UP transformation matrix based on *geodetic*
|
// Derive the local UP transformation matrix based on *geodetic*
|
||||||
// coordinates
|
// coordinates
|
||||||
MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
|
MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
|
||||||
MAT3rotate(R, vec, FG_Longitude); // R = rotate about Z axis
|
MAT3rotate(R, vec, f->get_Longitude()); // R = rotate about Z axis
|
||||||
// printf("Longitude matrix\n");
|
// printf("Longitude matrix\n");
|
||||||
// MAT3print(R, stdout);
|
// MAT3print(R, stdout);
|
||||||
|
|
||||||
MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
|
MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
|
||||||
MAT3mult_vec(vec, vec, R);
|
MAT3mult_vec(vec, vec, R);
|
||||||
MAT3rotate(TMP, vec, -FG_Latitude); // TMP = rotate about X axis
|
MAT3rotate(TMP, vec, -f->get_Latitude()); // TMP = rotate about X axis
|
||||||
// printf("Latitude matrix\n");
|
// printf("Latitude matrix\n");
|
||||||
// MAT3print(TMP, stdout);
|
// MAT3print(TMP, stdout);
|
||||||
|
|
||||||
|
@ -435,19 +435,19 @@ void fgVIEW::UpdateWorldToEye( fgFLIGHT *f ) {
|
||||||
if(fabs(view_offset)>FG_EPSILON){
|
if(fabs(view_offset)>FG_EPSILON){
|
||||||
// Roll Matrix
|
// Roll Matrix
|
||||||
MAT3_SET_HVEC(vec, 0.0, 0.0, -1.0, 1.0);
|
MAT3_SET_HVEC(vec, 0.0, 0.0, -1.0, 1.0);
|
||||||
MAT3rotate(R_Phi, vec, FG_Phi);
|
MAT3rotate(R_Phi, vec, f->get_Phi());
|
||||||
// printf("Roll matrix (Phi)\n");
|
// printf("Roll matrix (Phi)\n");
|
||||||
// MAT3print(R_Phi, stdout);
|
// MAT3print(R_Phi, stdout);
|
||||||
|
|
||||||
// Pitch Matrix
|
// Pitch Matrix
|
||||||
MAT3_SET_HVEC(vec, 1.0, 0.0, 0.0, 1.0);
|
MAT3_SET_HVEC(vec, 1.0, 0.0, 0.0, 1.0);
|
||||||
MAT3rotate(R_Theta, vec, FG_Theta);
|
MAT3rotate(R_Theta, vec, f->get_Theta());
|
||||||
// printf("\nPitch matrix (Theta)\n");
|
// printf("\nPitch matrix (Theta)\n");
|
||||||
// MAT3print(R_Theta, stdout);
|
// MAT3print(R_Theta, stdout);
|
||||||
|
|
||||||
// Yaw Matrix
|
// Yaw Matrix
|
||||||
MAT3_SET_HVEC(vec, 0.0, -1.0, 0.0, 1.0);
|
MAT3_SET_HVEC(vec, 0.0, -1.0, 0.0, 1.0);
|
||||||
MAT3rotate(R_Psi, vec, FG_Psi + FG_PI - view_offset );
|
MAT3rotate(R_Psi, vec, f->get_Psi() + FG_PI - view_offset );
|
||||||
// printf("\nYaw matrix (Psi)\n");
|
// printf("\nYaw matrix (Psi)\n");
|
||||||
// MAT3print(R_Psi, stdout);
|
// MAT3print(R_Psi, stdout);
|
||||||
|
|
||||||
|
@ -458,17 +458,17 @@ void fgVIEW::UpdateWorldToEye( fgFLIGHT *f ) {
|
||||||
} else { // JUST USE LOCAL_TO_BODY NHV 5/25/98
|
} else { // JUST USE LOCAL_TO_BODY NHV 5/25/98
|
||||||
// hey this is even different then LOCAL[][] above ??
|
// hey this is even different then LOCAL[][] above ??
|
||||||
|
|
||||||
AIRCRAFT[0][0] = -FG_T_local_to_body_22;
|
AIRCRAFT[0][0] = -f->get_T_local_to_body_22();
|
||||||
AIRCRAFT[0][1] = -FG_T_local_to_body_23;
|
AIRCRAFT[0][1] = -f->get_T_local_to_body_23();
|
||||||
AIRCRAFT[0][2] = FG_T_local_to_body_21;
|
AIRCRAFT[0][2] = f->get_T_local_to_body_21();
|
||||||
AIRCRAFT[0][3] = 0.0;
|
AIRCRAFT[0][3] = 0.0;
|
||||||
AIRCRAFT[1][0] = FG_T_local_to_body_32;
|
AIRCRAFT[1][0] = f->get_T_local_to_body_32();
|
||||||
AIRCRAFT[1][1] = FG_T_local_to_body_33;
|
AIRCRAFT[1][1] = f->get_T_local_to_body_33();
|
||||||
AIRCRAFT[1][2] = -FG_T_local_to_body_31;
|
AIRCRAFT[1][2] = -f->get_T_local_to_body_31();
|
||||||
AIRCRAFT[1][3] = 0.0;
|
AIRCRAFT[1][3] = 0.0;
|
||||||
AIRCRAFT[2][0] = FG_T_local_to_body_12;
|
AIRCRAFT[2][0] = f->get_T_local_to_body_12();
|
||||||
AIRCRAFT[2][1] = FG_T_local_to_body_13;
|
AIRCRAFT[2][1] = f->get_T_local_to_body_13();
|
||||||
AIRCRAFT[2][2] = -FG_T_local_to_body_11;
|
AIRCRAFT[2][2] = -f->get_T_local_to_body_11();
|
||||||
AIRCRAFT[2][3] = 0.0;
|
AIRCRAFT[2][3] = 0.0;
|
||||||
AIRCRAFT[3][0] = AIRCRAFT[3][1] = AIRCRAFT[3][2] = AIRCRAFT[3][3] = 0.0;
|
AIRCRAFT[3][0] = AIRCRAFT[3][1] = AIRCRAFT[3][2] = AIRCRAFT[3][3] = 0.0;
|
||||||
AIRCRAFT[3][3] = 1.0;
|
AIRCRAFT[3][3] = 1.0;
|
||||||
|
@ -492,14 +492,14 @@ void fgVIEW::UpdateWorldToEye( fgFLIGHT *f ) {
|
||||||
// Latitude
|
// Latitude
|
||||||
MAT3_SET_HVEC(vec, 1.0, 0.0, 0.0, 1.0);
|
MAT3_SET_HVEC(vec, 1.0, 0.0, 0.0, 1.0);
|
||||||
// R_Lat = rotate about X axis
|
// R_Lat = rotate about X axis
|
||||||
MAT3rotate(R_Lat, vec, FG_Latitude);
|
MAT3rotate(R_Lat, vec, f->get_Latitude());
|
||||||
// printf("\nLatitude matrix\n");
|
// printf("\nLatitude matrix\n");
|
||||||
// MAT3print(R_Lat, stdout);
|
// MAT3print(R_Lat, stdout);
|
||||||
|
|
||||||
// Longitude
|
// Longitude
|
||||||
MAT3_SET_HVEC(vec, 0.0, 0.0, 1.0, 1.0);
|
MAT3_SET_HVEC(vec, 0.0, 0.0, 1.0, 1.0);
|
||||||
// R_Lon = rotate about Z axis
|
// R_Lon = rotate about Z axis
|
||||||
MAT3rotate(R_Lon, vec, FG_Longitude - FG_PI_2 );
|
MAT3rotate(R_Lon, vec, f->get_Longitude() - FG_PI_2 );
|
||||||
// printf("\nLongitude matrix\n");
|
// printf("\nLongitude matrix\n");
|
||||||
// MAT3print(R_Lon, stdout);
|
// MAT3print(R_Lon, stdout);
|
||||||
|
|
||||||
|
@ -599,6 +599,9 @@ fgVIEW::~fgVIEW( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.28 1998/12/03 01:17:20 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.27 1998/11/16 14:00:06 curt
|
// Revision 1.27 1998/11/16 14:00:06 curt
|
||||||
// Added pow() macro bug work around.
|
// Added pow() macro bug work around.
|
||||||
// Added support for starting FGFS at various resolutions.
|
// Added support for starting FGFS at various resolutions.
|
||||||
|
|
|
@ -434,22 +434,27 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
|
||||||
gst_course = sidereal_course(t, 0.00);
|
gst_course = sidereal_course(t, 0.00);
|
||||||
t->gst_diff = gst_precise - gst_course;
|
t->gst_diff = gst_precise - gst_course;
|
||||||
|
|
||||||
t->lst = sidereal_course(t, -(FG_Longitude * RAD_TO_DEG)) + t->gst_diff;
|
t->lst =
|
||||||
|
sidereal_course(t, -(f->get_Longitude() * RAD_TO_DEG)) + t->gst_diff;
|
||||||
} else {
|
} else {
|
||||||
// course + difference should drift off very slowly
|
// course + difference should drift off very slowly
|
||||||
t->gst = sidereal_course(t, 0.00) + t->gst_diff;
|
t->gst = sidereal_course(t, 0.00) + t->gst_diff;
|
||||||
t->lst = sidereal_course(t, -(FG_Longitude * RAD_TO_DEG)) + t->gst_diff;
|
t->lst = sidereal_course(t, -(f->get_Longitude() * RAD_TO_DEG)) +
|
||||||
|
t->gst_diff;
|
||||||
}
|
}
|
||||||
FG_LOG( FG_EVENT, FG_DEBUG,
|
FG_LOG( FG_EVENT, FG_DEBUG,
|
||||||
" Current lon=0.00 Sidereal Time = " << t->gst );
|
" Current lon=0.00 Sidereal Time = " << t->gst );
|
||||||
FG_LOG( FG_EVENT, FG_DEBUG,
|
FG_LOG( FG_EVENT, FG_DEBUG,
|
||||||
" Current LOCAL Sidereal Time = " << t->lst << " ("
|
" Current LOCAL Sidereal Time = " << t->lst << " ("
|
||||||
<< sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG))
|
<< sidereal_precise(t->mjd, -(f->get_Longitude() * RAD_TO_DEG))
|
||||||
<< ") (diff = " << t->gst_diff << ")" );
|
<< ") (diff = " << t->gst_diff << ")" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.23 1998/12/03 01:18:40 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.22 1998/11/16 14:00:28 curt
|
// Revision 1.22 1998/11/16 14:00:28 curt
|
||||||
// FG_LOG() message tweaks.
|
// FG_LOG() message tweaks.
|
||||||
//
|
//
|
||||||
|
|
|
@ -164,7 +164,7 @@ void fgLIGHT::UpdateAdjFog( void ) {
|
||||||
|
|
||||||
// first determine the difference between our view angle and local
|
// first determine the difference between our view angle and local
|
||||||
// direction to the sun
|
// direction to the sun
|
||||||
rotation = -(sun_rotation + FG_PI) - (FG_Psi - v->view_offset) ;
|
rotation = -(sun_rotation + FG_PI) - (f->get_Psi() - v->view_offset) ;
|
||||||
while ( rotation < 0 ) {
|
while ( rotation < 0 ) {
|
||||||
rotation += FG_2PI;
|
rotation += FG_2PI;
|
||||||
}
|
}
|
||||||
|
@ -217,6 +217,9 @@ fgLIGHT::~fgLIGHT( void ) {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.22 1998/12/03 01:18:42 curt
|
||||||
|
// Converted fgFLIGHT to a class.
|
||||||
|
//
|
||||||
// Revision 1.21 1998/11/23 21:49:09 curt
|
// Revision 1.21 1998/11/23 21:49:09 curt
|
||||||
// Borland portability tweaks.
|
// Borland portability tweaks.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue