diff --git a/libraries/SITL/SIM_Precland.cpp b/libraries/SITL/SIM_Precland.cpp index 7a33909760..2875f36893 100644 --- a/libraries/SITL/SIM_Precland.cpp +++ b/libraries/SITL/SIM_Precland.cpp @@ -51,7 +51,7 @@ const AP_Param::GroupInfo SIM_Precland::var_info[] = { // @Param: HEIGHT // @DisplayName: Precland device origin's height above sealevel - // @Description: Precland device origin's height above sealevel + // @Description: Precland device origin's height above sealevel assume a 2x2m square as station base // @Units: cm // @Increment: 1 // @Range: 0 10000 @@ -129,6 +129,8 @@ void SIM_Precland::update(const Location &loc, const Vector3f &position) return; } center = center * 0.01f; // cm to m + _over_precland_base = origin_center.get_distance(loc) <= 2.0f; + const uint32_t now = AP_HAL::millis(); if (now - _last_update_ms < 1000.0f * (1.0f / _rate)) { return; diff --git a/libraries/SITL/SIM_Precland.h b/libraries/SITL/SIM_Precland.h index fae9e81af5..248a3d2727 100644 --- a/libraries/SITL/SIM_Precland.h +++ b/libraries/SITL/SIM_Precland.h @@ -50,6 +50,7 @@ public: AP_Int32 _rate; AP_Float _alt_limit; AP_Float _dist_limit; + bool _over_precland_base; enum PreclandType { PRECLAND_TYPE_CYLINDER = 0,