AC_Fence: methods to help populate SYS_STATUS

This commit is contained in:
Peter Barker 2017-12-12 16:49:14 +11:00 committed by Randy Mackay
parent 8c516fb29c
commit 1ecfdffa76
2 changed files with 34 additions and 0 deletions

View File

@ -518,3 +518,32 @@ bool AC_Fence::load_polygon_from_eeprom(bool force_reload)
return true;
}
// methods for mavlink SYS_STATUS message (send_extended_status1)
bool AC_Fence::geofence_present() const
{
return _enabled;
}
bool AC_Fence::geofence_enabled() const
{
if (!geofence_present()) {
return false;
}
if (_action == AC_FENCE_ACTION_REPORT_ONLY) {
return false;
}
return true;
}
bool AC_Fence::geofence_failed() const
{
if (!geofence_present()) {
// not failed if not present; can fail if present but not enabled
return false;
}
if (get_breaches() != 0) {
return true;
}
return false;
}

View File

@ -121,6 +121,11 @@ public:
static const struct AP_Param::GroupInfo var_info[];
// methods for mavlink SYS_STATUS message (send_extended_status1)
bool geofence_present() const;
bool geofence_enabled() const;
bool geofence_failed() const;
private:
AC_Fence(const AP_AHRS_NavEKF &ahrs);