From dd5e81470c6347972cb3091dc851502cd691d604 Mon Sep 17 00:00:00 2001 From: alexklimaj Date: Sun, 29 Sep 2024 10:58:41 -0600 Subject: [PATCH] failure detector use per index esc current --- src/modules/commander/failure_detector/FailureDetector.cpp | 4 ++-- src/modules/commander/failure_detector/FailureDetector.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/failure_detector/FailureDetector.cpp b/src/modules/commander/failure_detector/FailureDetector.cpp index ad234362b698..e47532856603 100644 --- a/src/modules/commander/failure_detector/FailureDetector.cpp +++ b/src/modules/commander/failure_detector/FailureDetector.cpp @@ -416,10 +416,10 @@ void FailureDetector::updateMotorStatus(const vehicle_status_s &vehicle_status, // Check if ESC current is too low if (cur_esc_report.esc_current > FLT_EPSILON) { - _motor_failure_escs_have_current = true; + _motor_failure_esc_has_current[i_esc] = true; } - if (_motor_failure_escs_have_current) { + if (_motor_failure_esc_has_current[i_esc]) { float esc_throttle = 0.f; if (PX4_ISFINITE(actuator_motors.control[i_esc])) { diff --git a/src/modules/commander/failure_detector/FailureDetector.hpp b/src/modules/commander/failure_detector/FailureDetector.hpp index 61edc82e646f..e89719d2aaa9 100644 --- a/src/modules/commander/failure_detector/FailureDetector.hpp +++ b/src/modules/commander/failure_detector/FailureDetector.hpp @@ -129,7 +129,7 @@ class FailureDetector : public ModuleParams uint8_t _motor_failure_esc_valid_current_mask{}; // ESC 1-8, true if ESC telemetry was valid at some point uint8_t _motor_failure_esc_timed_out_mask{}; // ESC telemetry no longer available -> failure uint8_t _motor_failure_esc_under_current_mask{}; // ESC drawing too little current -> failure - bool _motor_failure_escs_have_current{false}; // true if some ESC had non-zero current (some don't support it) + bool _motor_failure_esc_has_current[actuator_motors_s::NUM_CONTROLS] {false}; // true if some ESC had non-zero current (some don't support it) hrt_abstime _motor_failure_undercurrent_start_time[actuator_motors_s::NUM_CONTROLS] {}; uORB::Subscription _vehicle_attitude_sub{ORB_ID(vehicle_attitude)};