Skip to content

Commit

Permalink
Add tag id to inspection step
Browse files Browse the repository at this point in the history
  • Loading branch information
oysand committed Oct 25, 2022
1 parent 2a0a472 commit 5cee40a
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/isar/apis/models/start_mission_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from isar.mission_planner.mission_planner_interface import MissionPlannerError
from isar.models.mission.mission import Mission, Task
from robot_interface.models.mission.step import (
STEPS,
DriveToPose,
InspectionStep,
STEPS,
TakeImage,
TakeThermalImage,
TakeThermalVideo,
Expand Down Expand Up @@ -50,6 +50,7 @@ def to_isar_mission(mission_definition: StartMissionDefinition) -> Mission:
inspection_type=inspection_type,
duration=task.video_duration,
target=task.inspection_target.to_alitra_position(),
tag_id=tag_id,
)
for inspection_type in task.inspection_types
]
Expand All @@ -67,19 +68,27 @@ def to_isar_mission(mission_definition: StartMissionDefinition) -> Mission:


def create_inspection_step(
inspection_type: str, duration: float, target: Position
inspection_type: str, duration: float, target: Position, tag_id: Optional[str]
) -> STEPS:
inspection: STEPS
inspection_step: STEPS

if inspection_type == TakeImage.get_inspection_type().__name__:
inspection = TakeImage(target=target)
inspection_step = TakeImage(target=target)
if tag_id:
inspection_step.tag_id = tag_id
elif inspection_type == TakeVideo.get_inspection_type().__name__:
inspection = TakeVideo(target=target, duration=duration)
inspection_step = TakeVideo(target=target, duration=duration)
if tag_id:
inspection_step.tag_id = tag_id
elif inspection_type == TakeThermalImage.get_inspection_type().__name__:
inspection = TakeThermalImage(target=target)
inspection_step = TakeThermalImage(target=target)
if tag_id:
inspection_step.tag_id = tag_id
elif inspection_type == TakeThermalVideo.get_inspection_type().__name__:
inspection = TakeThermalVideo(target=target, duration=duration)
inspection_step = TakeThermalVideo(target=target, duration=duration)
if tag_id:
inspection_step.tag_id = tag_id
else:
raise ValueError(f"Inspection type '{inspection_type}' not supported")

return inspection
return inspection_step

0 comments on commit 5cee40a

Please sign in to comment.