AC_Fence: stop looking at EKF filter status

Fence has no business looking at what the filter status is.

Fence should only care whether it can currently get a position.
This commit is contained in:
Peter Barker 2017-12-08 10:25:52 +11:00 committed by Randy Mackay
parent 65373b85f0
commit 518399c13a

View File

@ -130,15 +130,15 @@ bool AC_Fence::pre_arm_check(const char* &fail_msg) const
return false; return false;
} }
// if we have horizontal limits enabled, check inertial nav position is ok // if we have horizontal limits enabled, check we can get a
nav_filter_status filt_status; // relative position from the EKF
if (!_ahrs.get_filter_status(filt_status)) { if ((_enabled_fences & AC_FENCE_TYPE_CIRCLE) ||
fail_msg = "AHRS status not available"; (_enabled_fences & AC_FENCE_TYPE_POLYGON)) {
return false; Vector2f position;
} if (!_ahrs.get_relative_position_NE_origin(position)) {
if ((_enabled_fences & (AC_FENCE_TYPE_CIRCLE | AC_FENCE_TYPE_POLYGON))>0 && !filt_status.flags.horiz_pos_abs && !filt_status.flags.pred_horiz_pos_abs) { fail_msg = "fence requires position";
fail_msg = "fence requires position"; return false;
return false; }
} }
// if we got this far everything must be ok // if we got this far everything must be ok