1
0
Fork 0

Bertrand Coconnier: Fix instant replay with JSBSim aircraft (bug )

Avoid re-trim to be triggered by property listeners during instant
replay (when the FDM is suspended).
This commit is contained in:
ThorstenB 2011-03-23 23:52:36 +01:00
parent 38226af24e
commit 11320e6b00
2 changed files with 52 additions and 10 deletions
src/FDM/JSBSim

View file

@ -570,6 +570,22 @@ void FGJSBsim::update( double dt )
/******************************************************************************/
void FGJSBsim::suspend()
{
fdmex->Hold();
SGSubsystem::suspend();
}
/******************************************************************************/
void FGJSBsim::resume()
{
fdmex->Resume();
SGSubsystem::resume();
}
/******************************************************************************/
// Convert from the FGInterface struct to the JSBsim generic_ struct
bool FGJSBsim::copy_to_JSBsim()
@ -1011,6 +1027,8 @@ void FGJSBsim::set_Latitude(double lat)
_set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
fgic->SetLatitudeRadIC( lat_geoc );
if (!fdmex->Holding())
needTrim=true;
}
@ -1024,6 +1042,8 @@ void FGJSBsim::set_Longitude(double lon)
update_ic();
fgic->SetLongitudeRadIC( lon );
if (!fdmex->Holding())
needTrim=true;
}
@ -1049,6 +1069,8 @@ void FGJSBsim::set_Altitude(double alt)
"Terrain elevation: " << FGInterface::get_Runway_altitude() * SG_METER_TO_FEET );
fgic->SetLatitudeRadIC( lat_geoc );
fgic->SetAltitudeASLFtIC(alt);
if (!fdmex->Holding())
needTrim=true;
}
@ -1061,6 +1083,8 @@ void FGJSBsim::set_V_calibrated_kts(double vc)
update_ic();
fgic->SetVcalibratedKtsIC(vc);
if (!fdmex->Holding())
needTrim=true;
}
@ -1073,6 +1097,8 @@ void FGJSBsim::set_Mach_number(double mach)
update_ic();
fgic->SetMachIC(mach);
if (!fdmex->Holding())
needTrim=true;
}
@ -1088,6 +1114,8 @@ void FGJSBsim::set_Velocities_Local( double north, double east, double down )
fgic->SetVNorthFpsIC(north);
fgic->SetVEastFpsIC(east);
fgic->SetVDownFpsIC(down);
if (!fdmex->Holding())
needTrim=true;
}
@ -1103,6 +1131,8 @@ void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
fgic->SetUBodyFpsIC(u);
fgic->SetVBodyFpsIC(v);
fgic->SetWBodyFpsIC(w);
if (!fdmex->Holding())
needTrim=true;
}
@ -1119,6 +1149,8 @@ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi )
fgic->SetThetaRadIC(theta);
fgic->SetPhiRadIC(phi);
fgic->SetPsiRadIC(psi);
if (!fdmex->Holding())
needTrim=true;
}
@ -1137,6 +1169,8 @@ void FGJSBsim::set_Climb_Rate( double roc)
if( !(fabs(roc) > 1 && fabs(fgic->GetFlightPathAngleRadIC()) < 0.01) ) {
fgic->SetClimbRateFpsIC(roc);
}
if (!fdmex->Holding())
needTrim=true;
}
@ -1148,6 +1182,8 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma)
if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) {
fgic->SetFlightPathAngleRadIC(gamma);
}
if (!fdmex->Holding())
needTrim=true;
}

View file

@ -113,6 +113,12 @@ public:
/// Unbind properties
void unbind();
/// Suspend integration
void suspend();
/// Resume integration
void resume();
/// @name Position Parameter Set
//@{
/** Set geocentric latitude