Skip to content

Commit

Permalink
Add configurable return to home
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonsf authored and oysand committed Apr 23, 2024
1 parent 1a13f22 commit f629a31
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/isar/apis/models/start_mission_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
from isar.mission_planner.mission_planner_interface import MissionPlannerError
from robot_interface.models.mission.mission import Mission
from robot_interface.models.mission.step import (
STEPS,
DockingProcedure,
DriveToPose,
Localize,
RecordAudio,
STEPS,
ReturnToHome,
TakeImage,
TakeThermalImage,
TakeThermalVideo,
Expand All @@ -35,6 +36,7 @@ class TaskType(str, Enum):
Inspection: str = "inspection"
DriveTo: str = "drive_to"
Localization: str = "localization"
ReturnToHome: str = "return_to_home"
Dock: str = "dock"


Expand Down Expand Up @@ -112,6 +114,8 @@ def generate_steps(task) -> List[STEPS]:
steps.append(generate_steps_for_drive_to_task(task=task))
case TaskType.Localization:
steps.append(generate_steps_for_localization_task(task=task))
case TaskType.ReturnToHome:
steps.append(generate_steps_for_return_to_home_task(task=task))
case TaskType.Dock:
steps.append(generate_steps_for_dock_task())
except ValueError as e:
Expand Down Expand Up @@ -146,6 +150,12 @@ def generate_steps_for_localization_task(task: StartMissionTaskDefinition) -> Lo
return Localize(localization_pose=task.pose.to_alitra_pose())


def generate_steps_for_return_to_home_task(
task: StartMissionTaskDefinition,
) -> ReturnToHome:
return ReturnToHome(pose=task.pose.to_alitra_pose())


def generate_steps_for_dock_task() -> DockingProcedure:
return DockingProcedure(behavior="dock")

Expand Down
7 changes: 6 additions & 1 deletion src/isar/apis/schedule/scheduling_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
from isar.services.utilities.scheduling_utilities import SchedulingUtilities
from isar.state_machine.states_enum import States
from robot_interface.models.mission.mission import Mission
from robot_interface.models.mission.step import DriveToPose, Localize, MoveArm
from robot_interface.models.mission.step import (
DriveToPose,
Localize,
MoveArm,
ReturnToHome,
)
from robot_interface.models.mission.task import Task


Expand Down
11 changes: 11 additions & 0 deletions src/robot_interface/models/mission/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ class DockingProcedure(MotionStep):
type: Literal["docking_procedure"] = "docking_procedure"


@dataclass
class ReturnToHome(MotionStep):
"""
Step which cases the robot to return home
"""

pose: Pose
type: Literal["return_to_home"] = "return_to_home"


@dataclass
class Localize(MotionStep):
"""
Expand Down Expand Up @@ -213,6 +223,7 @@ def get_inspection_type() -> Type[Inspection]:
STEPS = Union[
DriveToPose,
DockingProcedure,
ReturnToHome,
Localize,
TakeImage,
TakeThermalImage,
Expand Down

0 comments on commit f629a31

Please sign in to comment.