Skip to content

Commit dc21497

Browse files
committed
Update task status after each step
1 parent 95210fc commit dc21497

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/isar/state_machine/states/monitor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def _run(self) -> None:
156156
else:
157157
if isinstance(status, StepStatus):
158158
if self._step_finished(self.state_machine.current_step):
159+
self.state_machine.update_current_task()
160+
if self.state_machine.current_task == None:
161+
transition = self.state_machine.full_mission_finished # type: ignore
162+
break
159163
self.state_machine.update_current_step()
160164
self.state_machine.current_task.update_task_status()
161165
else: # If not all steps are done

src/robot_interface/models/mission/task.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def is_finished(self) -> bool:
5353
return True
5454

5555
def update_task_status(self) -> None:
56+
some_not_started: bool = False
5657
for step in self.steps:
5758
if step.status is StepStatus.Failed and isinstance(step, MotionStep):
5859
self.error_message = ErrorMessage(
@@ -79,8 +80,16 @@ def update_task_status(self) -> None:
7980
elif step.status is StepStatus.Successful:
8081
continue
8182

83+
elif (step.status is StepStatus.NotStarted) and isinstance(
84+
step, InspectionStep
85+
):
86+
some_not_started = True
87+
8288
if self.status is not TaskStatus.PartiallySuccessful:
83-
self.status = TaskStatus.Successful
89+
if some_not_started:
90+
self.status = TaskStatus.InProgress # TODO: handle all not_started
91+
else:
92+
self.status = TaskStatus.Successful
8493

8594
elif self._all_inspection_steps_failed():
8695
self.error_message = ErrorMessage(

0 commit comments

Comments
 (0)