AP_AHRS: add prearm check that we are using configured AHRS type

This commit is contained in:
Peter Barker 2022-07-27 10:18:06 +10:00 committed by Peter Barker
parent 1e87b4b09a
commit 4909866dd9
2 changed files with 13 additions and 3 deletions

View File

@ -2084,6 +2084,16 @@ bool AP_AHRS::pre_arm_check(bool requires_position, char *failure_msg, uint8_t f
ret = false;
}
if (!attitudes_consistent(failure_msg, failure_msg_len)) {
return false;
}
// ensure we're using the configured backend:
if (ekf_type() != active_EKF_type()) {
hal.util->snprintf(failure_msg, failure_msg_len, "AHRS: not using configured AHRS type");
return false;
}
switch (ekf_type()) {
#if AP_AHRS_SIM_ENABLED
case EKFType::SIM:

View File

@ -277,9 +277,6 @@ public:
// true if offsets are valid
bool getMagOffsets(uint8_t mag_idx, Vector3f &magOffsets) const;
// check all cores providing consistent attitudes for prearm checks
bool attitudes_consistent(char *failure_msg, const uint8_t failure_msg_len) const;
// return the amount of yaw angle change due to the last yaw angle reset in radians
// returns the time of the last yaw angle reset or 0 if no reset has ever occurred
uint32_t getLastYawResetAngle(float &yawAng);
@ -675,6 +672,9 @@ private:
return _ekf_flags & FLAG_ALWAYS_USE_EKF;
}
// check all cores providing consistent attitudes for prearm checks
bool attitudes_consistent(char *failure_msg, const uint8_t failure_msg_len) const;
/*
* Attitude-related private methods and attributes:
*/