-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: main
Are you sure you want to change the base?
Conversation
"dest": self.monitor_state, | ||
"conditions": self._start_task, | ||
}, | ||
{ |
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.
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.
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.
The same is true for the transition from idle to idle. This is for when we fail to start a mission.
d804d72
to
e2c9adb
Compare
424c1fe
to
c86e736
Compare
c86e736
to
6f1c904
Compare
efd4cfc
to
fbd7b14
Compare
fbd7b14
to
6eee4bf
Compare
self.start_mission_thread.start_thread( | ||
start_mission_or_task, name="Robot start mission thread" | ||
) | ||
# TODO: consider what happens when we get another start_mission while the start_mission_thread is running. |
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.
Remove todo
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.
Will be removed before moving the PR out of draft
self.current_status = task_status | ||
time.sleep(settings.FSM_SLEEP_TIME) | ||
|
||
def stop(self) -> None: |
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.
when is this triggered?
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.
It's not used yet, but I might use it before moving the PR out of draft
self.robot_task_status_thread = ThreadedRequest( | ||
request_func=self.run_robot_task_status_thread | ||
) | ||
self.robot_task_status_thread.start_thread(name="Robot task status thread") |
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.
how is this stopped when there is no mission active?
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.
The thread exits when it transitions out of monitor, and it is then cleaned up when receiving another mission
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.
I will change it so that the thread stays alive, but only sleeps while no mission or task is active. This way we avoid the cost of having to start another thread when a new task starts. Alternatively I might make it start when we detect that we enter monitor, then exit when we leave monitor.
8bc756d
to
cedeeae
Compare
Closes #687
Ready for review checklist: