Copter: fix ekf-check reliance on position_ok

This commit is contained in:
Randy Mackay 2015-06-15 15:53:41 +09:00
parent 46926765c4
commit f603c1ef69
3 changed files with 13 additions and 5 deletions

View File

@ -876,6 +876,7 @@ private:
void init_ardupilot();
void startup_ground(bool force_gyro_cal);
bool position_ok();
bool ekf_position_ok();
bool optflow_position_ok();
void update_auto_armed();
void check_usb_mux(void);

View File

@ -91,7 +91,7 @@ bool Copter::ekf_over_threshold()
}
// return true immediately if position is bad
if (!position_ok() && !optflow_position_ok()) {
if (!ekf_position_ok() && !optflow_position_ok()) {
return true;
}

View File

@ -309,13 +309,20 @@ void Copter::startup_ground(bool force_gyro_cal)
// position_ok - returns true if the horizontal absolute position is ok and home position is set
bool Copter::position_ok()
{
if (!ahrs.have_inertial_nav()) {
// do not allow navigation with dcm position
// return false if ekf failsafe has triggered
if (failsafe.ekf) {
return false;
}
// return false if ekf failsafe has triggered
if (failsafe.ekf) {
// check ekf position estimate
return ekf_position_ok();
}
// ekf_position_ok - returns true if the ekf claims it's horizontal absolute position estimate is ok and home position is set
bool Copter::ekf_position_ok()
{
if (!ahrs.have_inertial_nav()) {
// do not allow navigation with dcm position
return false;
}