diff --git a/src/modules/commander/failure_detector/FailureDetector.cpp b/src/modules/commander/failure_detector/FailureDetector.cpp index ce3e9f83e9..4151fb5e22 100644 --- a/src/modules/commander/failure_detector/FailureDetector.cpp +++ b/src/modules/commander/failure_detector/FailureDetector.cpp @@ -56,17 +56,17 @@ FailureDetector::update_params() bool FailureDetector::update() { - bool result(false); + bool updated(false); - result = update_attitude_status(); + updated = update_attitude_status(); - return result; + return updated; } bool FailureDetector::update_attitude_status() { - bool result(false); + bool updated(false); if (_sub_vehicule_attitude.update()) { const vehicle_attitude_s &attitude = _sub_vehicule_attitude.get(); @@ -80,23 +80,29 @@ FailureDetector::update_attitude_status() const float max_roll(fabsf(math::radians(max_roll_deg))); const float max_pitch(fabsf(math::radians(max_pitch_deg))); - if (fabsf(roll) > max_roll) { + if ((max_roll > 0.0f) && + (fabsf(roll) > max_roll)) { + _status.roll = true; + } else { _status.roll = false; } - if (fabsf(pitch) > max_pitch) { + if ((max_pitch > 0.0f) && + (fabsf(pitch) > max_pitch)) { + _status.pitch = true; + } else { _status.pitch = false; } - result = true; + updated = true; } else { - result = false; + updated = false; } - return result; + return updated; }