From 972e31939c795fa5883d24e7e1230b83700cef4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Misbach?= Date: Thu, 22 Jun 2023 10:07:37 +0200 Subject: [PATCH] [uss_qualifier/scenarios/astm/netrid] Add check for NET0490 (individual flights clusters obfuscation) (#116) --- .../astm/netrid/display_data_evaluator.py | 54 +++++++++++++++++-- .../astm/netrid/v19/nominal_behavior.md | 5 ++ .../astm/netrid/v22a/nominal_behavior.md | 5 ++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py b/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py index b2a69bb39b..b329fb2cc9 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py @@ -5,6 +5,7 @@ from loguru import logger import math import s2sphere +from s2sphere import LatLng, LatLngRect from monitoring.monitorlib.fetch import Query from monitoring.monitorlib.fetch.rid import ( @@ -18,6 +19,7 @@ from uas_standards.interuss.automated_testing.rid.v1.observation import ( Flight, GetDisplayDataResponse, + Cluster, ) from monitoring.monitorlib import fetch, geo, schema_validation @@ -581,13 +583,59 @@ def _evaluate_clusters_observation( details=f"{clustered_flight_count-expected_count} (~{uncertain_count}) unexpected flight(s)", ) elif clustered_flight_count == expected_count: - # ok - # TODO: If clustered flight count equals 1, check for obfuscation NET0490 - pass + # ok: evaluate clusters that are actually obfuscated flights + obfuscated_clusters = [ + c for c in observation.clusters if c.number_of_flights == 1 + ] + self._evaluate_obfuscated_clusters_observation( + observer, obfuscated_clusters, expected + uncertain + ) + else: # uncertain pass + def _evaluate_obfuscated_clusters_observation( + self, + observer: RIDSystemObserver, + obfuscated_clusters: List[Cluster], + candidate_flights: List[InjectedFlight], + ) -> None: + # TODO: check that the cluster area has a radius or distance to the + # polygon edge of no less than [NetMinObfuscationDistance] + + # get the center of all clusters that are actually an obfuscated flight + cluster_centers = [ + LatLngRect.from_point_pair( + LatLng.from_degrees(c.corners[0].lat, c.corners[0].lng), + LatLng.from_degrees(c.corners[1].lat, c.corners[1].lng), + ).get_center() + for c in obfuscated_clusters + ] + + with self._test_scenario.check( + "Individual flights obfuscation", + [observer.participant_id], + ) as check: + for center in cluster_centers: + for injected_flight in candidate_flights: + for tel in injected_flight.flight.telemetry: + flight_pos = LatLng.from_degrees( + tel.position.lat, tel.position.lng + ) + distance = ( + center.get_distance(flight_pos).degrees + * geo.EARTH_CIRCUMFERENCE_M + / 360 + ) + if distance <= DISTANCE_TOLERANCE_M: + # Flight was not obfuscated + check.record_failed( + summary="Error while evaluating obfuscation of individual flights. Flight was not obfuscated: it is at the center of the cluster.", + severity=Severity.Medium, + details=f"Flight {injected_flight.flight.injection_id}: distance between cluster center ({center}) and flight telemetry position ({flight_pos} at {tel.timestamp}) is {distance} meters.", + ) + def _evaluate_sp_observation( self, sp_observation: FetchedFlights, diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/nominal_behavior.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/nominal_behavior.md index 7d60fe27ed..53b0a33bb1 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/nominal_behavior.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/nominal_behavior.md @@ -119,6 +119,11 @@ The timestamps of the injected telemetry usually start in the future. If a flig **[astm.f3411.v19.NET0430](../../../../requirements/astm/f3411/v19.md)** require that a NetRID Display Provider reject a request for a very large view area with a diagonal greater than *NetMaxDisplayAreaDiagonal*. If such a large view is requested and a 413 error code is not received, then this check will fail. +#### Individual flights obfuscation check + +For a display area with a diagonal greater than *NetDetailsMaxDisplayAreaDiagonal* and less than *NetMaxDisplayAreaDiagonal*, **[astm.f3411.v19.NET0490](../../../../requirements/astm/f3411/v19.md)** requires that a Display provider shall obfuscate individual UAs within a cluster. +If a cluster with a single flight has its center equal to the position of the flight, this test will fail. + #### Clustering count check For a display area with a diagonal greater than *NetDetailsMaxDisplayAreaDiagonal* and less than *NetMaxDisplayAreaDiagonal*, **[astm.f3411.v19.NET0480](../../../../requirements/astm/f3411/v19.md)** requires that a Display provider shall cluster UAs in close proximity to each other using a circular or polygonal. diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/nominal_behavior.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/nominal_behavior.md index c6c5d866fd..c21742bbb1 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/nominal_behavior.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/nominal_behavior.md @@ -119,6 +119,11 @@ The timestamps of the injected telemetry usually start in the future. If a flig **[astm.f3411.v22a.NET0430](../../../../requirements/astm/f3411/v22a.md)** require that a NetRID Display Provider reject a request for a very large view area with a diagonal greater than *NetMaxDisplayAreaDiagonal*. If such a large view is requested and a 413 error code is not received, then this check will fail. +#### Individual flights obfuscation check + +For a display area with a diagonal greater than *NetDetailsMaxDisplayAreaDiagonal* and less than *NetMaxDisplayAreaDiagonal*, **[astm.f3411.v22a.NET0490](../../../../requirements/astm/f3411/v22a.md)** requires that a Display provider shall obfuscate individual UAs within a cluster. +If a cluster with a single flight has its center equal to the position of the flight, this test will fail. + #### Clustering count check For a display area with a diagonal greater than *NetDetailsMaxDisplayAreaDiagonal* and less than *NetMaxDisplayAreaDiagonal*, **[astm.f3411.v22a.NET0480](../../../../requirements/astm/f3411/v22a.md)** requires that a Display provider shall cluster UAs in close proximity to each other using a circular or polygonal.