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

Replace intermediate states with conditional transitions #689

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

andchiind
Copy link
Contributor

@andchiind andchiind commented Jan 3, 2025

Closes #687

Ready for review checklist:

  • A self-review has been performed
  • All commits run individually
  • Temporary changes have been removed, like logging, TODO, etc.
  • The PR has been tested locally
  • A test has been written
    • This change doesn't need a new test
  • Relevant issues are linked
  • Remaining work is documented in issues
    • There is no remaining work from this PR that requires new issues
  • The changes do not introduce dead code as unused imports, functions etc.

@andchiind andchiind added refactor Refactoring of old functionality improvement Improvement to existing functionality labels Jan 3, 2025
@andchiind andchiind self-assigned this Jan 3, 2025
"dest": self.monitor_state,
"conditions": self._start_task,
},
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This transition is basically the "else" which is run if the conditional above returns false. In this case, if it fails to continue the mission (for instance if there are no more tasks) it will go to the idle state and run the "_full_mission_finished" cleanup function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same is true for the transition from idle to idle. This is for when we fail to start a mission.

return False
return True

def _try_start_mission(self) -> bool:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This contains the functionality that used to the in the initiate and intialisation states

@andchiind andchiind force-pushed the remove-old-states branch 8 times, most recently from d804d72 to e2c9adb Compare January 3, 2025 15:25
@andchiind andchiind marked this pull request as ready for review January 3, 2025 15:25
@andchiind andchiind requested review from oysand and tsundvoll January 6, 2025 08:12
@andchiind andchiind marked this pull request as draft January 8, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement to existing functionality refactor Refactoring of old functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move initiate and initialize state to a transition
1 participant