Skip to content
Snippets Groups Projects
Commit 4e1027f2 authored by bresch's avatar bresch Committed by Daniel Agar
Browse files

FailureDetector - Add check for non-zero roll/pitch failure parameters. Rename...

FailureDetector - Add check for non-zero roll/pitch failure parameters. Rename 'result' into 'updated'
parent 246b3ebc
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment