mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-09 22:08:56 +08:00
- Revert "Check lat,lon null using float instead of double"
This reverts commit 2b9d24fb32.
- smaller null island threshold
1e-7 deg = 1.1 cm
1e-12 deg = 0.1 um, while still easily catching the exact 0 from missing init
- add comment explaining checks
This commit is contained in:
@@ -53,6 +53,7 @@ using matrix::wrap_pi;
|
||||
|
||||
static constexpr float MAX_DIST_FROM_HOME_FOR_LAND_APPROACHES{10.0f}; // [m] We don't consider safe points valid if the distance from the current home to the safe point is smaller than this distance
|
||||
static constexpr float MIN_DIST_THRESHOLD = 2.f;
|
||||
static constexpr double NULL_ISLAND_THRESHOLD_DEG{1e-12};
|
||||
|
||||
RTL::RTL(Navigator *navigator) :
|
||||
NavigatorMode(navigator, vehicle_status_s::NAVIGATION_STATE_AUTO_RTL),
|
||||
@@ -585,9 +586,9 @@ bool RTL::extractValidSafePointPosition(const mission_item_s &safe_point_item, f
|
||||
position.lon = safe_point_item.lon;
|
||||
position.yaw = NAN;
|
||||
|
||||
// basic checks protect against invalid data in case of missing init or cache read errors
|
||||
return PX4_ISFINITE(position.lat) && PX4_ISFINITE(position.lon) && PX4_ISFINITE(position.alt)
|
||||
&& !((fabsf(static_cast<float>(position.lat)) < FLT_EPSILON)
|
||||
&& (fabsf(static_cast<float>(position.lon)) < FLT_EPSILON))
|
||||
&& !((fabs(position.lat) < NULL_ISLAND_THRESHOLD_DEG) && (fabs(position.lon) < NULL_ISLAND_THRESHOLD_DEG))
|
||||
&& (fabs(position.lat) <= 90.0) && (fabs(position.lon) <= 180.0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user