-
Notifications
You must be signed in to change notification settings - Fork 20
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
[mock_uss] Clean up mock_uss flight planning #311
[mock_uss] Clean up mock_uss flight planning #311
Conversation
volumes = [v.to_f3548v21() for v in flight_info.basic_information.area] | ||
off_nominal_volumes = [] | ||
usage_state = flight_info.basic_information.usage_state | ||
if usage_state == AirspaceUsageState.Planned: | ||
state = f3548_v21.OperationalIntentState.Accepted | ||
elif usage_state == AirspaceUsageState.InUse: | ||
uas_state = flight_info.basic_information.uas_state | ||
if uas_state == UasState.Nominal: | ||
state = f3548_v21.OperationalIntentState.Activated | ||
elif uas_state == UasState.OffNominal: | ||
state = f3548_v21.OperationalIntentState.Nonconforming | ||
off_nominal_volumes = volumes | ||
volumes = [] | ||
elif uas_state == UasState.Contingent: | ||
state = f3548_v21.OperationalIntentState.Contingent | ||
off_nominal_volumes = volumes | ||
volumes = [] | ||
else: | ||
raise ValueError(f"Unknown uas_state '{uas_state}'") | ||
else: | ||
raise ValueError(f"Unknown usage_state '{usage_state}'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this seems duplicate with
monitoring/monitoring/monitorlib/clients/flight_planning/flight_info_template.py
Lines 73 to 96 in bc20f07
volumes = [v.to_interuss_scd_api() for v in info.basic_information.area] | |
if info.basic_information.usage_state == AirspaceUsageState.Planned: | |
state = scd_api.OperationalIntentState.Accepted | |
off_nominal_volumes = [] | |
elif info.basic_information.usage_state == AirspaceUsageState.InUse: | |
if info.basic_information.uas_state == UasState.Nominal: | |
state = scd_api.OperationalIntentState.Activated | |
off_nominal_volumes = [] | |
elif info.basic_information.uas_state == UasState.OffNominal: | |
state = scd_api.OperationalIntentState.Nonconforming | |
off_nominal_volumes = volumes | |
volumes = [] | |
elif info.basic_information.uas_state == UasState.Contingent: | |
state = scd_api.OperationalIntentState.Contingent | |
off_nominal_volumes = volumes | |
volumes = [] | |
else: | |
raise ValueError( | |
f"Unrecognized uas_state '{info.basic_information.uas_state}'" | |
) | |
else: | |
raise ValueError( | |
f"Unrecognized usage_state '{info.basic_information.usage_state}'" | |
) |
Factor those away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good -- they were different enough I didn't notice, but I think I have some common logic that simplifies both places now.
* Clean up mock_uss flight planning * Factor common functionality into business object ef76e72
* Clean up mock_uss flight planning * Factor common functionality into business object ef76e72
This PR works toward reoganizing mock_uss flight planning routines to better encapsulate functionality. F3548-21 things are moved to f3548v21/flight_planning.py and out of scd_injection/routes_injection.py. Some of the scd-injection-API-focused routines are adjusted to use API-independent FlightInfo and FlightRecord instead.
One apparent bug is fixed in conflict_equal_priority_not_permitted.py -- Nonconforming necessarily means the flight plan is active (aircraft is flying) and not merely Planned, so the expected response is updated to ReadyToFly, which mock_uss currently indicates.