diff --git a/src/isar/apis/models/start_mission_definition.py b/src/isar/apis/models/start_mission_definition.py index bc572593..166aa055 100644 --- a/src/isar/apis/models/start_mission_definition.py +++ b/src/isar/apis/models/start_mission_definition.py @@ -46,6 +46,7 @@ class StartMissionInspectionDefinition(BaseModel): class StartMissionTaskDefinition(BaseModel): + id: Optional[str] = None type: TaskType = Field(default=TaskType.Inspection) pose: InputPose inspection: Optional[StartMissionInspectionDefinition] = None @@ -116,6 +117,7 @@ def to_inspection_task(task_definition: StartMissionTaskDefinition) -> TASKS: if inspection_definition.type == InspectionTypes.image: return TakeImage( + id=task_definition.id, robot_pose=task_definition.pose.to_alitra_pose(), tag_id=task_definition.tag, target=task_definition.inspection.inspection_target.to_alitra_position(), @@ -124,6 +126,7 @@ def to_inspection_task(task_definition: StartMissionTaskDefinition) -> TASKS: ) elif inspection_definition.type == InspectionTypes.video: return TakeVideo( + id=task_definition.id, robot_pose=task_definition.pose.to_alitra_pose(), tag_id=task_definition.tag, target=task_definition.inspection.inspection_target.to_alitra_position(), @@ -133,6 +136,7 @@ def to_inspection_task(task_definition: StartMissionTaskDefinition) -> TASKS: ) elif inspection_definition.type == InspectionTypes.thermal_image: return TakeThermalImage( + id=task_definition.id, robot_pose=task_definition.pose.to_alitra_pose(), tag_id=task_definition.tag, target=task_definition.inspection.inspection_target.to_alitra_position(), @@ -141,6 +145,7 @@ def to_inspection_task(task_definition: StartMissionTaskDefinition) -> TASKS: ) elif inspection_definition.type == InspectionTypes.thermal_video: return TakeThermalVideo( + id=task_definition.id, robot_pose=task_definition.pose.to_alitra_pose(), tag_id=task_definition.tag, target=task_definition.inspection.inspection_target.to_alitra_position(), @@ -150,6 +155,7 @@ def to_inspection_task(task_definition: StartMissionTaskDefinition) -> TASKS: ) elif inspection_definition.type == InspectionTypes.audio: return RecordAudio( + id=task_definition.id, robot_pose=task_definition.pose.to_alitra_pose(), tag_id=task_definition.tag, target=task_definition.inspection.inspection_target.to_alitra_position(), diff --git a/src/robot_interface/models/mission/task.py b/src/robot_interface/models/mission/task.py index 27c85981..b68c4bea 100644 --- a/src/robot_interface/models/mission/task.py +++ b/src/robot_interface/models/mission/task.py @@ -38,7 +38,7 @@ class Task(BaseModel): status: TaskStatus = Field(default=TaskStatus.NotStarted) error_message: Optional[ErrorMessage] = Field(default=None) tag_id: Optional[str] = Field(default=None) - id: str = Field(default_factory=uuid4_string) + id: str = Field(default_factory=uuid4_string, frozen=True) def is_finished(self) -> bool: if ( @@ -59,7 +59,7 @@ class InspectionTask(Task): Base class for all inspection tasks which produce results to be uploaded. """ - inspection_id: str = Field(default_factory=uuid4_string) + inspection_id: str = Field(default_factory=uuid4_string, frozen=True) robot_pose: Pose = Field(default=None, init=True) metadata: Optional[dict] = Field(default_factory=dict) zoom: Optional[ZoomDescription] = Field(default=None)