From e9874b6f05e1ea9d7c17b869389ebca6e1432d60 Mon Sep 17 00:00:00 2001 From: ttechnick Date: Tue, 10 Feb 2026 09:22:02 +0100 Subject: [PATCH] ensure motor faults are cleared --- .../commander/failure_detector/FailureDetector.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/commander/failure_detector/FailureDetector.cpp b/src/modules/commander/failure_detector/FailureDetector.cpp index dfaf03ba31..18446d78e4 100644 --- a/src/modules/commander/failure_detector/FailureDetector.cpp +++ b/src/modules/commander/failure_detector/FailureDetector.cpp @@ -81,7 +81,7 @@ bool FailureDetector::update(const vehicle_status_s &vehicle_status, const vehic } // Run motor status checks even when no new ESC data arrives (to detect timeouts) - if (_param_fd_act_en.get() && _esc_status_received) { + if (_esc_status_received) { updateMotorStatus(vehicle_status, _last_esc_status); } @@ -346,13 +346,13 @@ void FailureDetector::updateMotorStatus(const vehicle_status_s &vehicle_status, _esc_undercurrent_hysteresis[i].set_hysteresis_time_from(false, _param_fd_act_mot_tout.get() * 1_ms); _esc_overcurrent_hysteresis[i].set_hysteresis_time_from(false, _param_fd_act_mot_tout.get() * 1_ms); - if (_esc_has_reported_current[i] && !_esc_undercurrent_hysteresis[i].get_state()) { - // Do not clear because a reaction could be to stop the motor and that would be conidered healty again + if (!_esc_undercurrent_hysteresis[i].get_state()) { + // Do not clear mid operation because a reaction could be to stop the motor and that would be conidered healthy again _esc_undercurrent_hysteresis[i].set_state_and_update(thrust_above_threshold && current_too_low && !timeout, now); } - if (_esc_has_reported_current[i] && !_esc_overcurrent_hysteresis[i].get_state()) { - // Do not clear because a reaction could be to stop the motor and that would be conidered healty again + if (!_esc_overcurrent_hysteresis[i].get_state()) { + // Do not clear mid operation because a reaction could be to stop the motor and that would be conidered healthy again _esc_overcurrent_hysteresis[i].set_state_and_update(current_too_high && !timeout, now); }