AP_NavEKF3: Add accessor function for vibration affected status

This commit is contained in:
Paul Riseborough 2021-07-16 16:22:31 +10:00 committed by Andrew Tridgell
parent ace601f1dd
commit fdea45a3e4
3 changed files with 19 additions and 0 deletions

View File

@ -1990,3 +1990,15 @@ bool NavEKF3::yawAlignmentComplete(void) const
} }
return core[primary].have_aligned_yaw(); return core[primary].have_aligned_yaw();
} }
// returns true when the state estimates for the selected core are significantly degraded by vibration
bool NavEKF3::isVibrationAffected(int8_t instance) const
{
if (instance < 0 || instance >= num_cores) {
instance = primary;
}
if (core) {
return core[instance].isVibrationAffected();
}
return false;
}

View File

@ -351,6 +351,10 @@ public:
// returns true when the yaw angle has been aligned // returns true when the yaw angle has been aligned
bool yawAlignmentComplete(void) const; bool yawAlignmentComplete(void) const;
// returns true when the state estimates for the selected core are significantly degraded by vibration
// if instance < 0, the primary instance will be used
bool isVibrationAffected(int8_t instance) const;
private: private:
uint8_t num_cores; // number of allocated cores uint8_t num_cores; // number of allocated cores
uint8_t primary; // current primary core uint8_t primary; // current primary core

View File

@ -403,6 +403,9 @@ public:
void Log_Write(uint64_t time_us); void Log_Write(uint64_t time_us);
// returns true when the state estimates are significantly degraded by vibration
bool isVibrationAffected() const { return badIMUdata; }
private: private:
EKFGSF_yaw *yawEstimator; EKFGSF_yaw *yawEstimator;
AP_DAL &dal; AP_DAL &dal;