Bertrand Coconnier: Fix instant replay with JSBSim aircraft (bug #294)
Avoid re-trim to be triggered by property listeners during instant replay (when the FDM is suspended).
This commit is contained in:
parent
38226af24e
commit
11320e6b00
2 changed files with 52 additions and 10 deletions
|
@ -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
|
// Convert from the FGInterface struct to the JSBsim generic_ struct
|
||||||
|
|
||||||
bool FGJSBsim::copy_to_JSBsim()
|
bool FGJSBsim::copy_to_JSBsim()
|
||||||
|
@ -1011,7 +1027,9 @@ void FGJSBsim::set_Latitude(double lat)
|
||||||
_set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
|
_set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
|
||||||
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
|
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
|
||||||
fgic->SetLatitudeRadIC( lat_geoc );
|
fgic->SetLatitudeRadIC( lat_geoc );
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1024,7 +1042,9 @@ void FGJSBsim::set_Longitude(double lon)
|
||||||
|
|
||||||
update_ic();
|
update_ic();
|
||||||
fgic->SetLongitudeRadIC( lon );
|
fgic->SetLongitudeRadIC( lon );
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the altitude above sea level.
|
// Sets the altitude above sea level.
|
||||||
|
@ -1049,7 +1069,9 @@ void FGJSBsim::set_Altitude(double alt)
|
||||||
"Terrain elevation: " << FGInterface::get_Runway_altitude() * SG_METER_TO_FEET );
|
"Terrain elevation: " << FGInterface::get_Runway_altitude() * SG_METER_TO_FEET );
|
||||||
fgic->SetLatitudeRadIC( lat_geoc );
|
fgic->SetLatitudeRadIC( lat_geoc );
|
||||||
fgic->SetAltitudeASLFtIC(alt);
|
fgic->SetAltitudeASLFtIC(alt);
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGJSBsim::set_V_calibrated_kts(double vc)
|
void FGJSBsim::set_V_calibrated_kts(double vc)
|
||||||
|
@ -1061,7 +1083,9 @@ void FGJSBsim::set_V_calibrated_kts(double vc)
|
||||||
|
|
||||||
update_ic();
|
update_ic();
|
||||||
fgic->SetVcalibratedKtsIC(vc);
|
fgic->SetVcalibratedKtsIC(vc);
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGJSBsim::set_Mach_number(double mach)
|
void FGJSBsim::set_Mach_number(double mach)
|
||||||
|
@ -1073,7 +1097,9 @@ void FGJSBsim::set_Mach_number(double mach)
|
||||||
|
|
||||||
update_ic();
|
update_ic();
|
||||||
fgic->SetMachIC(mach);
|
fgic->SetMachIC(mach);
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGJSBsim::set_Velocities_Local( double north, double east, double down )
|
void FGJSBsim::set_Velocities_Local( double north, double east, double down )
|
||||||
|
@ -1088,7 +1114,9 @@ void FGJSBsim::set_Velocities_Local( double north, double east, double down )
|
||||||
fgic->SetVNorthFpsIC(north);
|
fgic->SetVNorthFpsIC(north);
|
||||||
fgic->SetVEastFpsIC(east);
|
fgic->SetVEastFpsIC(east);
|
||||||
fgic->SetVDownFpsIC(down);
|
fgic->SetVDownFpsIC(down);
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
|
void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
|
||||||
|
@ -1103,7 +1131,9 @@ void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
|
||||||
fgic->SetUBodyFpsIC(u);
|
fgic->SetUBodyFpsIC(u);
|
||||||
fgic->SetVBodyFpsIC(v);
|
fgic->SetVBodyFpsIC(v);
|
||||||
fgic->SetWBodyFpsIC(w);
|
fgic->SetWBodyFpsIC(w);
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Euler angles
|
//Euler angles
|
||||||
|
@ -1119,7 +1149,9 @@ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi )
|
||||||
fgic->SetThetaRadIC(theta);
|
fgic->SetThetaRadIC(theta);
|
||||||
fgic->SetPhiRadIC(phi);
|
fgic->SetPhiRadIC(phi);
|
||||||
fgic->SetPsiRadIC(psi);
|
fgic->SetPsiRadIC(psi);
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Flight Path
|
//Flight Path
|
||||||
|
@ -1137,7 +1169,9 @@ void FGJSBsim::set_Climb_Rate( double roc)
|
||||||
if( !(fabs(roc) > 1 && fabs(fgic->GetFlightPathAngleRadIC()) < 0.01) ) {
|
if( !(fabs(roc) > 1 && fabs(fgic->GetFlightPathAngleRadIC()) < 0.01) ) {
|
||||||
fgic->SetClimbRateFpsIC(roc);
|
fgic->SetClimbRateFpsIC(roc);
|
||||||
}
|
}
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGJSBsim::set_Gamma_vert_rad( double gamma)
|
void FGJSBsim::set_Gamma_vert_rad( double gamma)
|
||||||
|
@ -1148,7 +1182,9 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma)
|
||||||
if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) {
|
if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) {
|
||||||
fgic->SetFlightPathAngleRadIC(gamma);
|
fgic->SetFlightPathAngleRadIC(gamma);
|
||||||
}
|
}
|
||||||
needTrim=true;
|
|
||||||
|
if (!fdmex->Holding())
|
||||||
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGJSBsim::init_gear(void )
|
void FGJSBsim::init_gear(void )
|
||||||
|
|
|
@ -113,6 +113,12 @@ public:
|
||||||
/// Unbind properties
|
/// Unbind properties
|
||||||
void unbind();
|
void unbind();
|
||||||
|
|
||||||
|
/// Suspend integration
|
||||||
|
void suspend();
|
||||||
|
|
||||||
|
/// Resume integration
|
||||||
|
void resume();
|
||||||
|
|
||||||
/// @name Position Parameter Set
|
/// @name Position Parameter Set
|
||||||
//@{
|
//@{
|
||||||
/** Set geocentric latitude
|
/** Set geocentric latitude
|
||||||
|
|
Loading…
Reference in a new issue