1
0
Fork 0
This commit is contained in:
Torsten Dreyer 2011-01-26 10:59:12 +01:00
commit ba9becbde1
4 changed files with 26 additions and 6 deletions

View file

@ -144,6 +144,8 @@ FGJSBsim::FGJSBsim( double dt )
}
}
resetPropertyState();
fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
// Register ground callback.
@ -290,6 +292,8 @@ FGJSBsim::FGJSBsim( double dt )
fgGetDouble("/fdm/jsbsim/systems/hook/tailhook-offset-x-in", 196),
fgGetDouble("/fdm/jsbsim/systems/hook/tailhook-offset-y-in", 0),
fgGetDouble("/fdm/jsbsim/systems/hook/tailhook-offset-z-in", -16));
last_hook_tip[0] = 0; last_hook_tip[1] = 0; last_hook_tip[2] = 0;
last_hook_root[0] = 0; last_hook_root[1] = 0; last_hook_root[2] = 0;
crashed = false;
}
@ -1411,3 +1415,21 @@ void FGJSBsim::update_external_forces(double t_off)
fgSetDouble("/fdm/jsbsim/systems/hook/tailhook-pos-deg", fi);
}
void FGJSBsim::resetPropertyState()
{
// this code works-around bug #222:
// http://code.google.com/p/flightgear-bugs/issues/detail?id=222
// for whatever reason, having an existing value for the WOW
// property causes the NaNs. Should that be fixed, this code can die
SGPropertyNode* gear = fgGetNode("/fdm/jsbsim/gear", false);
if (!gear) {
return;
}
int index = 0;
SGPropertyNode* unitNode = NULL;
for (; (unitNode = gear->getChild("unit", index)) != NULL; ++index) {
unitNode->removeChild("WOW", 0, false);
}
}

View file

@ -284,6 +284,7 @@ private:
void update_external_forces(double t_off);
void resetPropertyState();
};

View file

@ -78,7 +78,8 @@ static const char *IdHdr = ID_PROPAGATE;
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGPropagate::FGPropagate(FGFDMExec* fdmex) : FGModel(fdmex)
FGPropagate::FGPropagate(FGFDMExec* fdmex) : FGModel(fdmex),
LocalTerrainRadius(0), SeaLevelRadius(0), VehicleRadius(0)
{
Debug(0);
Name = "FGPropagate";

View file

@ -307,23 +307,18 @@ bool FGPropulsion::Load(Element* el)
try {
if (type == "piston_engine") {
HavePistonEngine = true;
if (!IsBound) bind();
Engines.push_back(new FGPiston(FDMExec, document, numEngines));
} else if (type == "turbine_engine") {
HaveTurbineEngine = true;
if (!IsBound) bind();
Engines.push_back(new FGTurbine(FDMExec, document, numEngines));
} else if (type == "turboprop_engine") {
HaveTurboPropEngine = true;
if (!IsBound) bind();
Engines.push_back(new FGTurboProp(FDMExec, document, numEngines));
} else if (type == "rocket_engine") {
HaveRocketEngine = true;
if (!IsBound) bind();
Engines.push_back(new FGRocket(FDMExec, document, numEngines));
} else if (type == "electric_engine") {
HaveElectricEngine = true;
if (!IsBound) bind();
Engines.push_back(new FGElectric(FDMExec, document, numEngines));
} else {
cerr << "Unknown engine type: " << type << endl;
@ -350,6 +345,7 @@ bool FGPropulsion::Load(Element* el)
if (el->FindElement("dump-rate"))
DumpRate = el->FindElementValueAsNumberConvertTo("dump-rate", "LBS/MIN");
if (!IsBound) bind();
PostLoad(el, PropertyManager);
return true;