Skip to content

[uss_qualifier] Create PlanningSequenceScenario base class for commonalities in nominal planning scenarios#1426

Merged
BenjaminPelletier merged 8 commits intointeruss:mainfrom
BenjaminPelletier:area-clear-prereq
Apr 23, 2026
Merged

[uss_qualifier] Create PlanningSequenceScenario base class for commonalities in nominal planning scenarios#1426
BenjaminPelletier merged 8 commits intointeruss:mainfrom
BenjaminPelletier:area-clear-prereq

Conversation

@BenjaminPelletier
Copy link
Copy Markdown
Member

The root of #1424 is that two very similar test scenarios (conflict_equal_priority_not_permitted and conflict_higher_priority) were imperfectly duplicating common elements. This PR fixes that problem by establishing a PlanningSequenceScenario base class with the commonalities between these scenarios and factoring out the redundancies into that base class. This incidentally results in the prerequisite clear-area check from conflict_equal_priority_not_permitted to be applied to conflict_higher_priority, and this is reflected in a documentation change.

None of these scenarios could be run without flight intents, so that resource's optionality is removed also.

@abstractmethod
def run_planning_sequence(self, context: ExecutionContext):
"""Run the main planning sequence of the test scenario, assuming the test scenario has already begun."""
raise NotImplementedError()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit/Info looking at the PR: abstractmethod already takes care of forcing the implementation, so the raise is probably not needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like something needs to go in the body of the abstract method and raising is better than pass since the former will catch more types of problems. Is there a better alternative than raising or pass?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Will follow up on change in a separate PR if a better option is identified)

Copy link
Copy Markdown
Contributor

@mickmis mickmis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 48 to 59
@@ -70,22 +58,13 @@ class ConflictEqualPriorityNotPermitted(TestScenario):
flight2_activated: FlightInfoTemplate
flight2_nonconforming: FlightInfoTemplate
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could those be moved to PlanningSequenceScenario as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think every planning sequence would necessarily involve a Flight 2 at all, let alone one that is differentiated between Activated and Nonconforming. So, I think this is probably above the PlanningSequenceScenario abstraction, but I agree there could be another abstraction for the commonalities between conflict_equal_priority_not_permitted and conflict_higher_priority (but that would be a different PR).

Comment on lines +69 to +86
self.flight_intents_templates = (
flight_intents.get_flight_intents() if flight_intents else {}
)
try:
validate_flight_intent_templates(
self.flight_intents_templates, expected_flight_intents
)
except ValueError as e:
raise ValueError(
f"`{self.me()}` TestScenario requirements for flight_intents not met: {e}"
)

for efi in expected_flight_intents:
setattr(
self,
efi.intent_id.replace("equal_prio_", ""),
self.flight_intents_templates[efi.intent_id],
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-paste mistake?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be in the equal-priority scenario specifically -- thanks, and good catch. I'll have to investigate why this didn't cause a test failure

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There wasn't a problem before because the equal_prio_ attributes were being set on all subclass scenarios even if they weren't used. I've fixed the issue by simply using the full explicit intent_id for these rather than making (somewhat confusing) aliases.

@BenjaminPelletier BenjaminPelletier merged commit 481a047 into interuss:main Apr 23, 2026
22 checks passed
@BenjaminPelletier BenjaminPelletier deleted the area-clear-prereq branch April 23, 2026 19:21
github-actions Bot added a commit that referenced this pull request Apr 23, 2026
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.

3 participants