Skip to content

Commit

Permalink
Revert change to inspection metadata functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aeshub committed Feb 24, 2023
1 parent 47a6011 commit 34d7205
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/robot_interface/models/inspection/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,42 @@ class Inspection:
metadata: InspectionMetadata
data: Optional[bytes] = field(default=None, init=False)

@staticmethod
def get_metadata_type() -> Type[InspectionMetadata]:
return InspectionMetadata


@dataclass
class Image(Inspection):
metadata: ImageMetadata

@staticmethod
def get_metadata_type() -> Type[InspectionMetadata]:
return ImageMetadata


@dataclass
class ThermalImage(Inspection):
metadata: ThermalImageMetadata

@staticmethod
def get_metadata_type() -> Type[InspectionMetadata]:
return ThermalImageMetadata


@dataclass
class Video(Inspection):
metadata: VideoMetadata

@staticmethod
def get_metadata_type() -> Type[InspectionMetadata]:
return VideoMetadata


@dataclass
class ThermalVideo(Inspection):
metadata: ThermalVideoMetadata

@staticmethod
def get_metadata_type() -> Type[InspectionMetadata]:
return ThermalVideoMetadata
23 changes: 22 additions & 1 deletion src/robot_interface/models/mission/step.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from dataclasses import dataclass, field
from typing import Any, List, Literal, Optional, Union
from typing import Any, List, Literal, Optional, Type, Union
from uuid import UUID, uuid4

from alitra import Pose, Position

from robot_interface.models.inspection import Image, ThermalImage, ThermalVideo, Video
from robot_interface.models.inspection.inspection import Inspection
from robot_interface.models.mission.status import StepStatus

Expand Down Expand Up @@ -60,6 +61,10 @@ class InspectionStep(Step):
analysis: Optional[List] = field(default_factory=list, init=False)
metadata: Optional[dict] = field(default_factory=dict, init=False)

@staticmethod
def get_inspection_type() -> Type[Inspection]:
return Inspection


@dataclass
class MotionStep(Step):
Expand Down Expand Up @@ -108,6 +113,10 @@ class TakeImage(InspectionStep):
target: Position
type: Literal["take_image"] = "take_image"

@staticmethod
def get_inspection_type() -> Type[Inspection]:
return Image


@dataclass
class TakeThermalImage(InspectionStep):
Expand All @@ -118,6 +127,10 @@ class TakeThermalImage(InspectionStep):
target: Position
type: Literal["take_thermal_image"] = "take_thermal_image"

@staticmethod
def get_inspection_type() -> Type[Inspection]:
return ThermalImage


@dataclass
class TakeVideo(InspectionStep):
Expand All @@ -131,6 +144,10 @@ class TakeVideo(InspectionStep):
duration: float
type: Literal["take_video"] = "take_video"

@staticmethod
def get_inspection_type() -> Type[Inspection]:
return Video


@dataclass
class TakeThermalVideo(InspectionStep):
Expand All @@ -144,6 +161,10 @@ class TakeThermalVideo(InspectionStep):
duration: float
type: Literal["take_thermal_video"] = "take_thermal_video"

@staticmethod
def get_inspection_type() -> Type[Inspection]:
return ThermalVideo


STEPS = Union[
DriveToPose,
Expand Down

0 comments on commit 34d7205

Please sign in to comment.