mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 21:43:34 +08:00
Failure detector - Add flight termination comments, make format
This commit is contained in:
@@ -2207,6 +2207,7 @@ Commander::run()
|
||||
|
||||
/* Check for failure detector status */
|
||||
const bool failure_detector_updated = _failure_detector.update();
|
||||
|
||||
if (failure_detector_updated) {
|
||||
|
||||
const uint8_t failure_status = _failure_detector.get_status();
|
||||
@@ -2218,9 +2219,9 @@ Commander::run()
|
||||
}
|
||||
|
||||
if (armed.armed &&
|
||||
failure_detector_updated &&
|
||||
!_in_flight_termination &&
|
||||
!status_flags.circuit_breaker_flight_termination_disabled) {
|
||||
failure_detector_updated &&
|
||||
!_in_flight_termination &&
|
||||
!status_flags.circuit_breaker_flight_termination_disabled) {
|
||||
|
||||
if (status.failure_detector_status != 0) {
|
||||
|
||||
|
||||
@@ -682,20 +682,22 @@ static bool failureDetectorCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s
|
||||
// Ignore failure detector check after arming.
|
||||
return true;
|
||||
|
||||
} else {
|
||||
if (status.failure_detector_status != 0) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (report_fail) {
|
||||
if (status.failure_detector_status & vehicle_status_s::FAILURE_ROLL) {
|
||||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: ROLL FAILURE DETECTED");
|
||||
}
|
||||
if (status.failure_detector_status & vehicle_status_s::FAILURE_PITCH) {
|
||||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: PITCH FAILURE DETECTED");
|
||||
}
|
||||
if (status.failure_detector_status & vehicle_status_s::FAILURE_ALT) {
|
||||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: ALTITUDE FAILURE DETECTED");
|
||||
}
|
||||
if (status.failure_detector_status != 0) {
|
||||
success = false;
|
||||
|
||||
if (report_fail) {
|
||||
if (status.failure_detector_status & vehicle_status_s::FAILURE_ROLL) {
|
||||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: Roll failure detected");
|
||||
}
|
||||
|
||||
if (status.failure_detector_status & vehicle_status_s::FAILURE_PITCH) {
|
||||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: Pitch failure detected");
|
||||
}
|
||||
|
||||
if (status.failure_detector_status & vehicle_status_s::FAILURE_ALT) {
|
||||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: Altitude failure detected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,33 +201,33 @@ mixer_tick(void)
|
||||
*
|
||||
*/
|
||||
should_arm = (
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK) /* IO initialised without error */
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF) /* and IO is armed */
|
||||
&& (
|
||||
((r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) /* and FMU is armed */
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) /* and there is valid input via or mixer */
|
||||
|| (r_status_flags & PX4IO_P_STATUS_FLAGS_RAW_PWM) /* or direct PWM is set */
|
||||
)
|
||||
);
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK) /* IO initialised without error */
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF) /* and IO is armed */
|
||||
&& (
|
||||
((r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) /* and FMU is armed */
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) /* and there is valid input via or mixer */
|
||||
|| (r_status_flags & PX4IO_P_STATUS_FLAGS_RAW_PWM) /* or direct PWM is set */
|
||||
)
|
||||
);
|
||||
|
||||
should_arm_nothrottle = (
|
||||
(r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK) /* IO initialised without error */
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF) /* and IO is armed */
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK) /* and there is valid input via or mixer */
|
||||
);
|
||||
);
|
||||
|
||||
should_always_enable_pwm = (
|
||||
(r_setup_arming & PX4IO_P_SETUP_ARMING_ALWAYS_PWM_ENABLE)
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK)
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK)
|
||||
);
|
||||
(r_setup_arming & PX4IO_P_SETUP_ARMING_ALWAYS_PWM_ENABLE)
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK)
|
||||
&& (r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK)
|
||||
);
|
||||
|
||||
/*
|
||||
* Check if failsafe termination is set - if yes,
|
||||
* set the force failsafe flag once entering the first
|
||||
* failsafe condition.
|
||||
*/
|
||||
if ( /* Flight termination is allowed */
|
||||
if ( /* Flight termination is allowed */
|
||||
REG_TO_BOOL(r_setup_flightterm) &&
|
||||
/* If we ended up not changing the default mixer */
|
||||
(source == MIX_DISARMED) &&
|
||||
|
||||
Reference in New Issue
Block a user