mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 01:23:34 +08:00
commander: don't allow arming during VTOL transition
This commit is contained in:
@@ -82,7 +82,7 @@ public:
|
||||
const bool checkGNSS, bool reportFailures, const bool prearm, const hrt_abstime &time_since_boot);
|
||||
|
||||
static bool preArmCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &status_flags,
|
||||
const safety_s &safety, const uint8_t arm_requirements);
|
||||
const safety_s &safety, const uint8_t arm_requirements, const vehicle_status_s &status);
|
||||
|
||||
typedef enum {
|
||||
ARM_REQ_NONE = 0,
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <uORB/topics/vehicle_command_ack.h>
|
||||
|
||||
bool PreFlightCheck::preArmCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &status_flags,
|
||||
const safety_s &safety, const uint8_t arm_requirements)
|
||||
const safety_s &safety, const uint8_t arm_requirements, const vehicle_status_s &status)
|
||||
{
|
||||
bool prearm_ok = true;
|
||||
|
||||
@@ -127,6 +127,13 @@ bool PreFlightCheck::preArmCheck(orb_advert_t *mavlink_log_pub, const vehicle_st
|
||||
}
|
||||
}
|
||||
|
||||
if (status.is_vtol && status.in_transition_mode) {
|
||||
if (prearm_ok) {
|
||||
mavlink_log_critical(mavlink_log_pub, "Arming denied! Vehicle is in transition state");
|
||||
prearm_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Arm Requirements: authorization
|
||||
// check last, and only if everything else has passed
|
||||
if ((arm_requirements & ARM_REQ_ARM_AUTH_BIT) && prearm_ok) {
|
||||
|
||||
@@ -374,7 +374,7 @@ int commander_main(int argc, char *argv[])
|
||||
bool preflight_check_res = Commander::preflight_check(true);
|
||||
PX4_INFO("Preflight check: %s", preflight_check_res ? "OK" : "FAILED");
|
||||
|
||||
bool prearm_check_res = PreFlightCheck::preArmCheck(&mavlink_log_pub, status_flags, safety, arm_requirements);
|
||||
bool prearm_check_res = PreFlightCheck::preArmCheck(&mavlink_log_pub, status_flags, safety, arm_requirements, status);
|
||||
PX4_INFO("Prearm check: %s", prearm_check_res ? "OK" : "FAILED");
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -178,7 +178,7 @@ transition_result_t arming_state_transition(vehicle_status_s *status, const safe
|
||||
|
||||
if (fRunPreArmChecks && preflight_check_ret) {
|
||||
// only bother running prearm if preflight was successful
|
||||
prearm_check_ret = PreFlightCheck::preArmCheck(mavlink_log_pub, *status_flags, safety, arm_requirements);
|
||||
prearm_check_ret = PreFlightCheck::preArmCheck(mavlink_log_pub, *status_flags, safety, arm_requirements, *status);
|
||||
}
|
||||
|
||||
if (!preflight_check_ret || !prearm_check_ret) {
|
||||
|
||||
Reference in New Issue
Block a user