From 915c5e4f2d26f85e5ce6e981140835e4f1d1a84d Mon Sep 17 00:00:00 2001 From: Julien Perrochet Date: Fri, 24 Oct 2025 14:04:48 +0200 Subject: [PATCH] [uss_qualifier] introduce distance error tolerance for some DisplayProviderBehavior checks --- .../astm/netrid/common/dp_behavior.py | 30 ++++++++----------- .../uss_qualifier/scenarios/scenario.py | 6 ++++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dp_behavior.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dp_behavior.py index 1c987f1905..139dbb4485 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dp_behavior.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dp_behavior.py @@ -33,7 +33,10 @@ direction_filter, get_mock_uss_interactions, ) -from monitoring.uss_qualifier.scenarios.scenario import GenericTestScenario +from monitoring.uss_qualifier.scenarios.scenario import ( + DISTANCE_ERROR_TOLERANCE_FRACTION, + GenericTestScenario, +) from monitoring.uss_qualifier.suites.suite import ExecutionContext @@ -81,28 +84,21 @@ def __init__( Angle.from_degrees(1 * degree_per_km) ) - limit_side_km = self._rid_version.max_diagonal_km / math.sqrt(2) + limit_diagonal_length_ok = self._rid_version.max_diagonal_km * ( + 1 - DISTANCE_ERROR_TOLERANCE_FRACTION + ) + + limit_side_km = limit_diagonal_length_ok / math.sqrt(2) self._limit_rect = LatLngRect.from_point(isa_center).convolve_with_cap( Angle.from_degrees(limit_side_km * degree_per_km / 2) ) - # Make sure the limit_rect is close to the allowed diagonal limit - assert ( - self._rid_version.max_diagonal_km * 0.99 - < geo.get_latlngrect_diagonal_km(self._limit_rect) - <= self._rid_version.max_diagonal_km - ), ( - f"{geo.get_latlngrect_diagonal_km(self._limit_rect)} > {self._rid_version.max_diagonal_km}" + + limit_diagonal_length_fail = self._rid_version.max_diagonal_km * ( + 1 + DISTANCE_ERROR_TOLERANCE_FRACTION ) - # Make the too big rect 1% larger than the allowed diagonal limit self._too_big_rect = LatLngRect.from_point(isa_center).convolve_with_cap( - Angle.from_degrees(limit_side_km * 1.01 * degree_per_km / 2) - ) - assert ( - geo.get_latlngrect_diagonal_km(self._too_big_rect) - > self._rid_version.max_diagonal_km - ), ( - f"{geo.get_latlngrect_diagonal_km(self._too_big_rect)} <= {self._rid_version.max_diagonal_km}" + Angle.from_degrees(limit_diagonal_length_fail * degree_per_km / 2) ) @property diff --git a/monitoring/uss_qualifier/scenarios/scenario.py b/monitoring/uss_qualifier/scenarios/scenario.py index d5a542ff60..3f1b26a14d 100644 --- a/monitoring/uss_qualifier/scenarios/scenario.py +++ b/monitoring/uss_qualifier/scenarios/scenario.py @@ -57,6 +57,12 @@ QueryType.F3411v22aUSSGetFlightDetails, ] +# Different spherical models have different precisions: implementations may use a different model +# than uss_qualifier. We thus accept an error margin of 0.7% around distance limits and thresholds +# to avoid failing USSes for minor differences in precision whenever the relevant standard is not +# prescriptive in that regard. +DISTANCE_ERROR_TOLERANCE_FRACTION = 0.007 + class ScenarioCannotContinueError(Exception): def __init__(self, msg):