Don't crash with UFO FDM, etc, or other FDMs that don't define global props needed - just go into passive mode.
This commit is contained in:
parent
263ff7d93d
commit
289023da1d
1 changed files with 14 additions and 5 deletions
|
@ -107,6 +107,20 @@ void FGAutoBrake::unbind()
|
||||||
|
|
||||||
void FGAutoBrake::update(double dt)
|
void FGAutoBrake::update(double dt)
|
||||||
{
|
{
|
||||||
|
_leftBrakeInput = SGMiscd::max(_brakeInputs[0]->getDoubleValue(),
|
||||||
|
_brakeInputs[2]->getDoubleValue());
|
||||||
|
_rightBrakeInput = SGMiscd::max(_brakeInputs[1]->getDoubleValue(),
|
||||||
|
_brakeInputs[3]->getDoubleValue());
|
||||||
|
|
||||||
|
// various FDMs don't supply sufficent information for us to work,
|
||||||
|
// so just be passive in those cases.
|
||||||
|
if (!_weightOnWheelsNode || !_groundspeedNode || !_engineControlsNode) {
|
||||||
|
// pass the values straight through
|
||||||
|
_leftBrakeOutput = _leftBrakeInput;
|
||||||
|
_rightBrakeOutput = _rightBrakeInput;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dt <= 0.0) {
|
if (dt <= 0.0) {
|
||||||
return; // paused
|
return; // paused
|
||||||
}
|
}
|
||||||
|
@ -115,11 +129,6 @@ void FGAutoBrake::update(double dt)
|
||||||
_actualDecel = (_lastGroundspeedKts - gs) / dt;
|
_actualDecel = (_lastGroundspeedKts - gs) / dt;
|
||||||
_lastGroundspeedKts = gs;
|
_lastGroundspeedKts = gs;
|
||||||
|
|
||||||
_leftBrakeInput = SGMiscd::max(_brakeInputs[0]->getDoubleValue(),
|
|
||||||
_brakeInputs[2]->getDoubleValue());
|
|
||||||
_rightBrakeInput = SGMiscd::max(_brakeInputs[1]->getDoubleValue(),
|
|
||||||
_brakeInputs[3]->getDoubleValue());
|
|
||||||
|
|
||||||
if (!_armed || (_step == 0)) {
|
if (!_armed || (_step == 0)) {
|
||||||
// even if we're off or disarmed, the physical valve system must pass
|
// even if we're off or disarmed, the physical valve system must pass
|
||||||
// pilot control values through.
|
// pilot control values through.
|
||||||
|
|
Loading…
Add table
Reference in a new issue