diff --git a/monitoring/mock_uss/ridsp/routes_ridsp_v19.py b/monitoring/mock_uss/ridsp/routes_ridsp_v19.py index 3e67645337..7542b88660 100644 --- a/monitoring/mock_uss/ridsp/routes_ridsp_v19.py +++ b/monitoring/mock_uss/ridsp/routes_ridsp_v19.py @@ -26,6 +26,7 @@ from uas_standards.interuss.automated_testing.rid.v1 import injection from monitoring.monitorlib import geo +from monitoring.monitorlib.rid import RIDVersion from monitoring.monitorlib.rid_automated_testing.injection_api import TestFlight from monitoring.mock_uss import webapp from monitoring.mock_uss.auth import requires_scope @@ -70,7 +71,7 @@ def _get_report( recent_states.sort(key=lambda p: p.timestamp) result = RIDFlight( id=details.id, - aircraft_type="NotDeclared", # TODO: Include aircraft_type in TestFlight API + aircraft_type=flight.get_aircraft_type(RIDVersion.f3411_19), current_state=_make_state(recent_states[-1]), simulated=True, ) diff --git a/monitoring/mock_uss/ridsp/routes_ridsp_v22a.py b/monitoring/mock_uss/ridsp/routes_ridsp_v22a.py index 9ca6af82f4..03fba6cd44 100644 --- a/monitoring/mock_uss/ridsp/routes_ridsp_v22a.py +++ b/monitoring/mock_uss/ridsp/routes_ridsp_v22a.py @@ -29,12 +29,12 @@ from uas_standards.interuss.automated_testing.rid.v1 import injection from monitoring.monitorlib import geo +from monitoring.monitorlib.rid import RIDVersion from monitoring.monitorlib.rid_automated_testing.injection_api import TestFlight +from monitoring.monitorlib.rid_v2 import make_time from monitoring.mock_uss import webapp from monitoring.mock_uss.auth import requires_scope -from . import behavior from .database import db -from ...monitorlib.rid_v2 import make_time def _make_position(p: injection.RIDAircraftPosition) -> RIDAircraftPosition: @@ -124,7 +124,7 @@ def _get_report( recent_states.sort(key=lambda p: p.timestamp) result = RIDFlight( id=details.id, - aircraft_type="NotDeclared", # TODO: Include aircraft_type in TestFlight API + aircraft_type=flight.get_aircraft_type(RIDVersion.f3411_22a), current_state=_make_state(recent_states[-1]), simulated=True, ) diff --git a/monitoring/monitorlib/rid_automated_testing/injection_api.py b/monitoring/monitorlib/rid_automated_testing/injection_api.py index d97a07638c..d09d51328d 100644 --- a/monitoring/monitorlib/rid_automated_testing/injection_api.py +++ b/monitoring/monitorlib/rid_automated_testing/injection_api.py @@ -9,8 +9,11 @@ from uas_standards.interuss.automated_testing.rid.v1.injection import ( RIDFlightDetails, RIDAircraftState, + UAType, ) +from monitoring.monitorlib.rid import RIDVersion + SCOPE_RID_QUALIFIER_INJECT = "rid.inject_test_data" @@ -50,6 +53,21 @@ def get_id(self, t_now: datetime.datetime) -> Optional[str]: details = self.get_details(t_now) return details.id if details else None + def get_aircraft_type(self, rid_version: RIDVersion) -> UAType: + if not self.has_field_with_value("aircraft_type"): + return UAType.NotDeclared + + # there exists a small difference in the enums between both versions of RID, this ensures we always return the expected one + if ( + rid_version == RIDVersion.f3411_19 + and self.aircraft_type == UAType.HybridLift + ): + return UAType.VTOL + if rid_version == RIDVersion.f3411_22a and self.aircraft_type == UAType.VTOL: + return UAType.HybridLift + + return self.aircraft_type + def order_telemetry(self): self.telemetry = sorted( self.telemetry, key=lambda telemetry: telemetry.timestamp.datetime