Skip to content
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

Merged

Conversation

BenjaminPelletier
Copy link
Member

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.

@BenjaminPelletier BenjaminPelletier marked this pull request as ready for review November 3, 2023 03:26
Comment on lines 227 to 247
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}'")
Copy link
Contributor

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

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?

Copy link
Member Author

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.

@BenjaminPelletier BenjaminPelletier merged commit ef76e72 into interuss:main Nov 3, 2023
8 checks passed
@BenjaminPelletier BenjaminPelletier deleted the fix-flight-planning2 branch November 3, 2023 19:54
github-actions bot added a commit that referenced this pull request Nov 3, 2023
* Clean up mock_uss flight planning

* Factor common functionality into business object ef76e72
github-actions bot added a commit to openskies-sh/monitoring that referenced this pull request Nov 5, 2023
* Clean up mock_uss flight planning

* Factor common functionality into business object ef76e72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants