1
0
Fork 0

Sascha Reißner

With this patch, the dev can set <max-compression-ft> or <max-compression-m> in the set-file (or another
xml-file that get included from the set-file).
The code calculates also 'compression-m' for every gear.
If the 'max-compression-*' property is omitted, the code behave as before ('compression-norm' is the same as 'compression-ft').
This commit is contained in:
Erik Hofman 2022-11-30 08:43:10 +01:00
parent c8e7a019f5
commit 2c0b3d20a2

View file

@ -1246,6 +1246,7 @@ void FGJSBsim::init_gear(void )
{ {
FGGroundReactions* gr=fdmex->GetGroundReactions(); FGGroundReactions* gr=fdmex->GetGroundReactions();
int Ngear=GroundReactions->GetNumGearUnits(); int Ngear=GroundReactions->GetNumGearUnits();
double max = 1.0;
for (int i=0;i<Ngear;i++) { for (int i=0;i<Ngear;i++) {
FGLGear *gear = gr->GetGearUnit(i); FGLGear *gear = gr->GetGearUnit(i);
SGPropertyNode * node = fgGetNode("gear/gear", i, true); SGPropertyNode * node = fgGetNode("gear/gear", i, true);
@ -1263,7 +1264,14 @@ void FGJSBsim::init_gear(void )
node->setBoolValue("has-brake", gear->GetBrakeGroup() > 0); node->setBoolValue("has-brake", gear->GetBrakeGroup() > 0);
node->setDoubleValue("position-norm", gear->GetGearUnitPos()); node->setDoubleValue("position-norm", gear->GetGearUnitPos());
// node->setDoubleValue("tire-pressure-norm", gear->GetTirePressure()); // node->setDoubleValue("tire-pressure-norm", gear->GetTirePressure());
node->setDoubleValue("compression-norm", gear->GetCompLen()); max = node->getDoubleValue("max-compression-ft");
if (max < 0.00001) {
max = node->getDoubleValue("max-compression-m");
if (max < 0.00001) max = 1.0;
else max /= .3048;
}
node->setDoubleValue("compression-norm", gear->GetCompLen() / max);
node->setDoubleValue("compression-m", gear->GetCompLen() * .3048);
node->setDoubleValue("compression-ft", gear->GetCompLen()); node->setDoubleValue("compression-ft", gear->GetCompLen());
if ( gear->GetSteerable() ) if ( gear->GetSteerable() )
node->setDoubleValue("steering-norm", gear->GetSteerNorm()); node->setDoubleValue("steering-norm", gear->GetSteerNorm());
@ -1274,6 +1282,7 @@ void FGJSBsim::update_gear(void)
{ {
FGGroundReactions* gr=fdmex->GetGroundReactions(); FGGroundReactions* gr=fdmex->GetGroundReactions();
int Ngear=GroundReactions->GetNumGearUnits(); int Ngear=GroundReactions->GetNumGearUnits();
double max = 1.0;
for (int i=0;i<Ngear;i++) { for (int i=0;i<Ngear;i++) {
FGLGear *gear = gr->GetGearUnit(i); FGLGear *gear = gr->GetGearUnit(i);
SGPropertyNode * node = fgGetNode("gear/gear", i, true); SGPropertyNode * node = fgGetNode("gear/gear", i, true);
@ -1281,7 +1290,14 @@ void FGJSBsim::update_gear(void)
node->getChild("rollspeed-ms", 0, true)->setDoubleValue(gear->GetWheelRollVel()*0.3043); node->getChild("rollspeed-ms", 0, true)->setDoubleValue(gear->GetWheelRollVel()*0.3043);
node->getChild("position-norm", 0, true)->setDoubleValue(gear->GetGearUnitPos()); node->getChild("position-norm", 0, true)->setDoubleValue(gear->GetGearUnitPos());
// gear->SetTirePressure(node->getDoubleValue("tire-pressure-norm")); // gear->SetTirePressure(node->getDoubleValue("tire-pressure-norm"));
node->setDoubleValue("compression-norm", gear->GetCompLen()); max = node->getDoubleValue("max-compression-ft");
if (max < 0.00001) {
max = node->getDoubleValue("max-compression-m");
if (max < 0.00001) max = 1.0;
else max /= .3048;
}
node->setDoubleValue("compression-norm", gear->GetCompLen() / max);
node->setDoubleValue("compression-m", gear->GetCompLen() * .3048);
node->setDoubleValue("compression-ft", gear->GetCompLen()); node->setDoubleValue("compression-ft", gear->GetCompLen());
if ( gear->GetSteerable() ) if ( gear->GetSteerable() )
node->setDoubleValue("steering-norm", gear->GetSteerNorm()); node->setDoubleValue("steering-norm", gear->GetSteerNorm());