Skip to content

Commit

Permalink
failure detector use per index esc current
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKlimaj authored and bresch committed Sep 30, 2024
1 parent 332b7be commit 602042d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/modules/commander/failure_detector/FailureDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/commander/failure_detector/FailureDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)};
Expand Down

0 comments on commit 602042d

Please sign in to comment.