Skip to content

Commit

Permalink
Handle initiate infeasible for full missions
Browse files Browse the repository at this point in the history
Initate infeasible for full missions
should just fail as there are no next steps
to be tried
  • Loading branch information
Afonso-2403 committed Feb 23, 2024
1 parent 75c4fc5 commit 0fd49e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 20 additions & 6 deletions src/isar/state_machine/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,26 @@ def _stop(self) -> None:
self.stopped = True

def _initiate_failed(self) -> None:
self.current_step.status = StepStatus.Failed
self.current_task.update_task_status()
self.current_mission.status = MissionStatus.Failed
self.publish_step_status(step=self.current_step)
self.publish_task_status(task=self.current_task)
self._finalize()
if self.stepwise_mission:
self.current_step.status = StepStatus.Failed
self.current_task.update_task_status()
self.current_mission.status = MissionStatus.Failed
self.publish_step_status(step=self.current_step)
self.publish_task_status(task=self.current_task)
self._finalize()

else:
self.current_task = None
step_status: StepStatus = StepStatus.Cancelled
task_status: TaskStatus = TaskStatus.Cancelled

for task in self.current_mission.tasks:
task.status = task_status
for step in task.steps:
step.status = step_status
self.publish_step_status(step=step)
self.publish_task_status(task=task)
self._finalize()

def _initiate_infeasible(self) -> None:
if self.stepwise_mission:
Expand Down
2 changes: 1 addition & 1 deletion src/isar/state_machine/states/initiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _run(self) -> None:
f"{str(self.state_machine.current_mission.id)[:8]} because: "
f"{e.error_description}"
)
transition = self.state_machine.initiate_infeasible # type: ignore
transition = self.state_machine.initiate_failed # type: ignore
break

except RobotException as e:
Expand Down

0 comments on commit 0fd49e5

Please sign in to comment.