mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
commander: remove circuit breakers from status msg
Since the circuit breaker bools are not actually used anywhere else than in the commander, it is safe to remove them and replace them with local bools.
This commit is contained in:
@@ -116,6 +116,10 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
|
||||
struct actuator_armed_s *armed, ///< current armed status
|
||||
bool fRunPreArmChecks, ///< true: run the pre-arm checks, false: no pre-arm checks, for unit testing
|
||||
orb_advert_t *mavlink_log_pub) ///< uORB handle for mavlink log
|
||||
bool circuit_breaker_engaged_airspd_check,
|
||||
bool circuit_breaker_engaged_gpsfailure_check,
|
||||
bool circuit_breaker_engaged_power_check,
|
||||
bool cb_usb)
|
||||
{
|
||||
// Double check that our static arrays are still valid
|
||||
ASSERT(vehicle_status_s::ARMING_STATE_INIT == 0);
|
||||
@@ -140,7 +144,10 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
|
||||
if (fRunPreArmChecks && new_arming_state == vehicle_status_s::ARMING_STATE_ARMED
|
||||
&& status->hil_state == vehicle_status_s::HIL_STATE_OFF) {
|
||||
|
||||
prearm_ret = preflight_check(status, mavlink_log_pub, true /* pre-arm */ );
|
||||
prearm_ret = preflight_check(status, mavlink_log_pub, true /* pre-arm */, false /* force_report */,
|
||||
circuit_breaker_engaged_airspd_check,
|
||||
circuit_breaker_engaged_gpsfailure_check,
|
||||
cb_usb);
|
||||
}
|
||||
/* re-run the pre-flight check as long as sensors are failing */
|
||||
if (!status->condition_system_sensors_initialized
|
||||
@@ -149,7 +156,10 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
|
||||
&& status->hil_state == vehicle_status_s::HIL_STATE_OFF) {
|
||||
|
||||
if (last_preflight_check == 0 || hrt_absolute_time() - last_preflight_check > 1000 * 1000) {
|
||||
prearm_ret = preflight_check(status, mavlink_log_pub, false /* pre-flight */);
|
||||
prearm_ret = preflight_check(status, mavlink_log_pub, false /* pre-flight */,
|
||||
circuit_breaker_engaged_airspd_check,
|
||||
circuit_breaker_engaged_gpsfailure_check,
|
||||
cb_usb);
|
||||
status->condition_system_sensors_initialized = !prearm_ret;
|
||||
last_preflight_check = hrt_absolute_time();
|
||||
last_prearm_ret = prearm_ret;
|
||||
@@ -208,7 +218,7 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
|
||||
|
||||
// Perform power checks only if circuit breaker is not
|
||||
// engaged for these checks
|
||||
if (!status->circuit_breaker_engaged_power_check) {
|
||||
if (!circuit_breaker_engaged_power_check) {
|
||||
// Fail transition if power is not good
|
||||
if (!status->condition_power_input_valid) {
|
||||
|
||||
@@ -859,7 +869,10 @@ bool set_nav_state(struct vehicle_status_s *status, const bool data_link_loss_en
|
||||
return status->nav_state != nav_state_old;
|
||||
}
|
||||
|
||||
int preflight_check(struct vehicle_status_s *status, orb_advert_t *mavlink_log_pub, bool prearm, bool force_report)
|
||||
int preflight_check(struct vehicle_status_s *status, orb_advert_t *mavlink_log_pub, bool prearm, bool force_report,
|
||||
bool circuit_breaker_engaged_airspd_check,
|
||||
bool circuit_breaker_engaged_gpsfailure_check,
|
||||
bool cb_usb)
|
||||
{
|
||||
/*
|
||||
*/
|
||||
@@ -869,15 +882,15 @@ int preflight_check(struct vehicle_status_s *status, orb_advert_t *mavlink_log_p
|
||||
bool checkAirspeed = false;
|
||||
/* Perform airspeed check only if circuit breaker is not
|
||||
* engaged and it's not a rotary wing */
|
||||
if (!status->circuit_breaker_engaged_airspd_check && (!status->is_rotary_wing || status->is_vtol)) {
|
||||
if (!circuit_breaker_engaged_airspd_check && (!status->is_rotary_wing || status->is_vtol)) {
|
||||
checkAirspeed = true;
|
||||
}
|
||||
|
||||
bool preflight_ok = Commander::preflightCheck(mavlink_log_pub, true, true, true, true,
|
||||
checkAirspeed, (status->rc_input_mode == vehicle_status_s::RC_IN_MODE_DEFAULT),
|
||||
!status->circuit_breaker_engaged_gpsfailure_check, true, reportFailures);
|
||||
!circuit_breaker_engaged_gpsfailure_check, true, reportFailures);
|
||||
|
||||
if (!status->cb_usb && status->usb_connected && prearm) {
|
||||
if (!cb_usb && status->usb_connected && prearm) {
|
||||
preflight_ok = false;
|
||||
if (reportFailures) {
|
||||
mavlink_and_console_log_critical(mavlink_log_pub, "ARMING DENIED: Flying with USB is not safe");
|
||||
|
||||
Reference in New Issue
Block a user