diff --git a/Dockerfile b/Dockerfile index e10a7cb2..7028642e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ COPY . . RUN --mount=source=.git,target=.git,type=bind RUN pip install . -FROM ghcr.io/equinor/isar:v1.16.17 +FROM ghcr.io/equinor/isar:v1.17.0 WORKDIR /app COPY --from=build /app/venv /app/venv ENV PATH="/app/venv/bin:$PATH" diff --git a/pyproject.toml b/pyproject.toml index 2a22fdef..4dd00bcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development :: Libraries", ] -dependencies = ["alitra", "isar"] +dependencies = ["alitra", "isar>=1.17.0"] dynamic = ["version"] [project.urls] diff --git a/requirements.txt b/requirements.txt index a4077c37..54e34fc6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -59,7 +59,7 @@ dacite==1.8.1 # isar ecdsa==0.19.0 # via python-jose -fastapi==0.110.1 +fastapi==0.110.2 # via # fastapi-azure-auth # isar @@ -86,7 +86,7 @@ idna==3.7 # requests injector==0.21.0 # via isar -isar==1.16.17 +isar==1.17.0 # via isar-robot (pyproject.toml) isodate==0.6.1 # via diff --git a/src/isar_robot/config/settings.env b/src/isar_robot/config/settings.env index 57f02904..300b7bb7 100644 --- a/src/isar_robot/config/settings.env +++ b/src/isar_robot/config/settings.env @@ -1,2 +1,2 @@ -CAPABILITIES = '["take_thermal_image", "take_image", "take_video", "take_thermal_video", "drive_to_pose", "record_audio", "localize", "docking_procedure"]' +CAPABILITIES = '["take_thermal_image", "take_image", "take_video", "take_thermal_video", "drive_to_pose", "record_audio", "localize", "return_to_home", "docking_procedure"]' ROBOT_MODEL = Robot diff --git a/src/isar_robot/config/settings.py b/src/isar_robot/config/settings.py index d514c58b..3a2de1de 100644 --- a/src/isar_robot/config/settings.py +++ b/src/isar_robot/config/settings.py @@ -19,6 +19,8 @@ def __init__(self) -> None: SHOULD_FAIL_LOCALIZATION_MISSION: bool = Field(default=False) SHOULD_FAIL_NORMAL_STEP: bool = Field(default=False) SHOULD_FAIL_LOCALIZATION_STEP: bool = Field(default=False) + SHOULD_FAIL_RETURN_TO_HOME_STEP: bool = Field(default=False) + SHOULD_FAIL_RETURN_TO_HOME_MISSION: bool = Field(default=False) model_config = SettingsConfigDict( env_prefix="ROBOT_", diff --git a/src/isar_robot/robotinterface.py b/src/isar_robot/robotinterface.py index 39adf883..9b59aefd 100644 --- a/src/isar_robot/robotinterface.py +++ b/src/isar_robot/robotinterface.py @@ -23,7 +23,12 @@ from isar_robot import inspections, telemetry from isar_robot.config.settings import settings -from isar_robot.utilities import is_localization_mission, is_localization_step +from isar_robot.utilities import ( + is_localization_mission, + is_localization_step, + is_return_to_home_mission, + is_return_to_home_step, +) class Robot(RobotInterface): @@ -42,7 +47,10 @@ def mission_status(self) -> MissionStatus: if settings.SHOULD_FAIL_LOCALIZATION_MISSION: return MissionStatus.Failed - return MissionStatus.Successful + if is_return_to_home_mission(self.current_mission): + self.current_step = None + if settings.SHOULD_FAIL_RETURN_TO_HOME_MISSION: + return StepStatus.Failed self.current_mission = None if settings.SHOULD_FAIL_NORMAL_MISSION: @@ -61,7 +69,10 @@ def step_status(self) -> StepStatus: if settings.SHOULD_FAIL_LOCALIZATION_STEP: return StepStatus.Failed - return StepStatus.Successful + if is_return_to_home_step(self.current_step): + self.current_step = None + if settings.SHOULD_FAIL_RETURN_TO_HOME_STEP: + return StepStatus.Failed self.current_step = None if settings.SHOULD_FAIL_NORMAL_STEP: diff --git a/src/isar_robot/utilities.py b/src/isar_robot/utilities.py index 1a14ac03..5ddbe4de 100644 --- a/src/isar_robot/utilities.py +++ b/src/isar_robot/utilities.py @@ -1,5 +1,5 @@ from robot_interface.models.mission.mission import Mission -from robot_interface.models.mission.step import Localize, Step +from robot_interface.models.mission.step import Localize, ReturnToHome, Step def is_localization_mission(mission: Mission): @@ -14,3 +14,17 @@ def is_localization_mission(mission: Mission): def is_localization_step(step: Step): return isinstance(step, Localize) + + +def is_return_to_home_mission(mission: Mission): + if len(mission.tasks) != 1: + return False + if len(mission.tasks[0].steps) != 1: + return False + if not isinstance(mission.tasks[0].steps[0], ReturnToHome): + return False + return True + + +def is_return_to_home_step(step: Step): + return isinstance(step, ReturnToHome)