Skip to content

Commit dd5e814

Browse files
AlexKlimajdagar
authored andcommitted
failure detector use per index esc current
1 parent 1d06f62 commit dd5e814

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/modules/commander/failure_detector/FailureDetector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ void FailureDetector::updateMotorStatus(const vehicle_status_s &vehicle_status,
416416

417417
// Check if ESC current is too low
418418
if (cur_esc_report.esc_current > FLT_EPSILON) {
419-
_motor_failure_escs_have_current = true;
419+
_motor_failure_esc_has_current[i_esc] = true;
420420
}
421421

422-
if (_motor_failure_escs_have_current) {
422+
if (_motor_failure_esc_has_current[i_esc]) {
423423
float esc_throttle = 0.f;
424424

425425
if (PX4_ISFINITE(actuator_motors.control[i_esc])) {

src/modules/commander/failure_detector/FailureDetector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class FailureDetector : public ModuleParams
129129
uint8_t _motor_failure_esc_valid_current_mask{}; // ESC 1-8, true if ESC telemetry was valid at some point
130130
uint8_t _motor_failure_esc_timed_out_mask{}; // ESC telemetry no longer available -> failure
131131
uint8_t _motor_failure_esc_under_current_mask{}; // ESC drawing too little current -> failure
132-
bool _motor_failure_escs_have_current{false}; // true if some ESC had non-zero current (some don't support it)
132+
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)
133133
hrt_abstime _motor_failure_undercurrent_start_time[actuator_motors_s::NUM_CONTROLS] {};
134134

135135
uORB::Subscription _vehicle_attitude_sub{ORB_ID(vehicle_attitude)};

0 commit comments

Comments
 (0)