Skip to content

[uss_qualifier/resources/netrid] Use models from injection interface rather than RID v19 #867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions monitoring/uss_qualifier/resources/netrid/flight_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from implicitdict import ImplicitDict, StringBasedDateTime, StringBasedTimeDelta

from monitoring.uss_qualifier.resources.files import ExternalFile
from uas_standards.astm.f3411.v19.api import RIDAircraftState, RIDFlightDetails
from uas_standards.interuss.automated_testing.rid.v1 import injection


class FullFlightRecord(ImplicitDict):
reference_time: StringBasedDateTime
"""The reference time of this flight (usually the time of first telemetry)"""

states: List[RIDAircraftState]
states: List[injection.RIDAircraftState]
"""All telemetry that will be/was received for this flight"""

flight_details: RIDFlightDetails
flight_details: injection.RIDFlightDetails
"""Details of this flight, as would be reported at the ASTM /details endpoint"""

aircraft_type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@
from monitoring.uss_qualifier.resources.netrid.simulation import (
operator_flight_details,
)
from uas_standards.astm.f3411.v19.api import (
HorizontalAccuracy,
VerticalAccuracy,
RIDAircraftPosition,
RIDAircraftState,
RIDHeight,
RIDFlightDetails,
)
from uas_standards.interuss.automated_testing.rid.v1 import injection

from .utils import (
QueryBoundingBox,
FlightPoint,
Expand Down Expand Up @@ -254,15 +248,15 @@ def generate_flight_grid_and_path_points(

self.grid_cells_flight_tracks = all_grid_cell_tracks

def generate_flight_details(self, id: str) -> RIDFlightDetails:
def generate_flight_details(self, id: str) -> injection.RIDFlightDetails:
"""This class generates details of flights and operator details for a flight, this data is required for identifying flight, operator and operation"""

my_flight_details_generator = (
operator_flight_details.OperatorFlightDataGenerator(self.random)
)

# TODO: Put operator_location in center of circle rather than stacking operators of all flights on top of each other
return RIDFlightDetails(
return injection.RIDFlightDetails(
id=id,
serial_number=my_flight_details_generator.generate_serial_number(),
operation_description=my_flight_details_generator.generate_operation_description(),
Expand All @@ -280,7 +274,7 @@ def generate_rid_state(self, duration):


"""
all_flight_telemetry: List[List[RIDAircraftState]] = []
all_flight_telemetry: List[List[injection.RIDAircraftState]] = []
flight_track_details = {} # Develop a index of flight length and their index
# Store where on the track the current index is, since the tracks are circular, once the end of the track is reached, the index is reset to 0 to indicate beginning of the track again.
flight_current_index = {}
Expand Down Expand Up @@ -320,19 +314,19 @@ def generate_rid_state(self, duration):
flight_point = self.grid_cells_flight_tracks[k].track[
flight_current_index[k]
]
aircraft_position = RIDAircraftPosition(
aircraft_position = injection.RIDAircraftPosition(
lat=flight_point.lat,
lng=flight_point.lng,
alt=flight_point.alt,
accuracy_h=HorizontalAccuracy.HAUnknown,
accuracy_v=VerticalAccuracy.VAUnknown,
accuracy_h=injection.HorizontalAccuracy.HAUnknown,
accuracy_v=injection.VerticalAccuracy.VAUnknown,
extrapolated=False,
)
aircraft_height = RIDHeight(
aircraft_height = injection.RIDHeight(
distance=self.altitude_agl, reference="TakeoffLocation"
)

rid_aircraft_state = RIDAircraftState(
rid_aircraft_state = injection.RIDAircraftState(
timestamp=timestamp_isoformat,
operational_status="Airborne",
position=aircraft_position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
)
from typing import List

from uas_standards.astm.f3411.v19.api import (
LatLngPoint,
RIDFlightDetails,
RIDAircraftPosition,
RIDAircraftState,
)
from uas_standards.interuss.automated_testing.rid.v1 import injection


STATE_INCREMENT_SECONDS = 1

Expand Down Expand Up @@ -191,13 +187,13 @@ def generate_flight_record(
r = random.Random(x=random_seed)
now_isoformat = timestamp.isoformat()

flight_telemetry: List[RIDAircraftState] = []
flight_telemetry: List[injection.RIDAircraftState] = []
for coordinates, speed, angle in zip(
state_coordinates, flight_state_speeds, flight_track_angles
):
timestamp = timestamp + timedelta(0, STATE_INCREMENT_SECONDS)
timestamp_isoformat = timestamp.isoformat()
aircraft_position = RIDAircraftPosition(
aircraft_position = injection.RIDAircraftPosition(
lng=coordinates[0],
lat=coordinates[1],
alt=coordinates[2],
Expand All @@ -206,7 +202,7 @@ def generate_flight_record(
extrapolated=False,
)
aircraft_height = None
rid_aircraft_state = RIDAircraftState(
rid_aircraft_state = injection.RIDAircraftState(
timestamp=StringBasedDateTime(timestamp_isoformat),
operational_status="Airborne",
position=aircraft_position,
Expand All @@ -221,13 +217,13 @@ def generate_flight_record(
)
flight_telemetry.append(rid_aircraft_state)
flight_id_bytes = bytes(r.randint(0, 255) for _ in range(16))
rid_details = RIDFlightDetails(
rid_details = injection.RIDFlightDetails(
id=flight_description.get(
"id", str(uuid.UUID(bytes=flight_id_bytes, version=4))
),
serial_number=flight_description.get("serial_number"),
operation_description=flight_description.get("operation_description"),
operator_location=LatLngPoint(
operator_location=injection.LatLngPoint(
lat=float(operator_location.get("lat")),
lng=float(operator_location.get("lng")),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from faker import Faker
import string
import random
import uuid
from uas_standards.ansi_cta_2063_a import SerialNumber

from uas_standards.astm.f3411.v19.api import LatLngPoint
from uas_standards.interuss.automated_testing.rid.v1 import injection


class OperatorFlightDataGenerator:
Expand Down Expand Up @@ -38,7 +37,7 @@ def generate_operation_description(self):

def generate_operator_location(self, centroid):
# TODO: Inject operator location altitude
operator_location = LatLngPoint(lat=centroid.y, lng=centroid.x)
operator_location = injection.LatLngPoint(lat=centroid.y, lng=centroid.x)
return operator_location

def generate_operator_id(self, prefix="OP-"):
Expand Down
Loading