Skip to content

Commit

Permalink
WIP: full mission testing
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed May 30, 2024
1 parent 18f6e22 commit c9cfdf5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/isar/state_machine/states/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,12 @@ def _run(self) -> None:
transition = self.state_machine.step_finished # type: ignore
break
else:
if isinstance(status, StepStatus):
if isinstance(status, StepStatus): # TODO: this code block needs refactoring
if self._step_finished(self.state_machine.current_step):
self.state_machine.update_current_task()
if self.state_machine.current_task == None:
transition = self.state_machine.full_mission_finished # type: ignore
break
self.state_machine.update_current_step()
self.state_machine.current_task.update_task_status()
else: # If not all steps are done
Expand Down
11 changes: 10 additions & 1 deletion src/robot_interface/models/mission/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def is_finished(self) -> bool:
return True

def update_task_status(self) -> None:
some_not_started: bool = False
for step in self.steps:
if step.status is StepStatus.Failed and isinstance(step, MotionStep):
self.error_message = ErrorMessage(
Expand All @@ -79,8 +80,16 @@ def update_task_status(self) -> None:
elif step.status is StepStatus.Successful:
continue

elif (step.status is StepStatus.NotStarted) and isinstance(
step, InspectionStep
):
some_not_started = True

if self.status is not TaskStatus.PartiallySuccessful:
self.status = TaskStatus.Successful
if some_not_started:
self.status = TaskStatus.InProgress # TODO: handle all not_started
else:
self.status = TaskStatus.Successful

elif self._all_inspection_steps_failed():
self.error_message = ErrorMessage(
Expand Down

0 comments on commit c9cfdf5

Please sign in to comment.