AP_AHRS: only use EKF for plane and rover if all data available

we need position and velocity to be working for plane and rover
This commit is contained in:
Andrew Tridgell 2015-04-07 16:11:24 -07:00
parent 996739df12
commit d7249cc1e6

View File

@ -20,6 +20,7 @@
*/
#include <AP_HAL.h>
#include <AP_AHRS.h>
#include <AP_Vehicle.h>
#if AP_AHRS_NAVEKF_AVAILABLE
@ -311,7 +312,25 @@ bool AP_AHRS_NavEKF::get_relative_position_NED(Vector3f &vec) const
bool AP_AHRS_NavEKF::using_EKF(void) const
{
return ekf_started && _ekf_use && EKF.healthy();
bool ret = ekf_started && _ekf_use && EKF.healthy();
if (!ret) {
return false;
}
#if APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_APMrover2)
nav_filter_status filt_state;
EKF.getFilterStatus(filt_state);
if (hal.util->get_soft_armed() && filt_state.flags.const_pos_mode) {
return false;
}
if (!filt_state.flags.attitude ||
!filt_state.flags.horiz_vel ||
!filt_state.flags.vert_vel ||
!filt_state.flags.horiz_pos_abs ||
!filt_state.flags.vert_pos) {
return false;
}
#endif
return ret;
}
/*