Skip to content

Commit

Permalink
Remove unused TimeIndexedPose
Browse files Browse the repository at this point in the history
  • Loading branch information
Christdej committed Mar 6, 2023
1 parent 96837ed commit f79bf82
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 67 deletions.
28 changes: 8 additions & 20 deletions src/isar/storage/slimm_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _construct_multiform_request_image(
filename: str, inspection: Inspection, metadata: MissionMetadata
):
array_of_orientation = (
inspection.metadata.time_indexed_pose.pose.orientation.to_quat_array().tolist()
inspection.metadata.pose.orientation.to_quat_array().tolist()
)
multiform_body: MultipartEncoder = MultipartEncoder(
fields={
Expand All @@ -114,15 +114,9 @@ def _construct_multiform_request_image(
"Mission.MissionId": metadata.mission_id,
"Mission.Client": "Equinor",
"ImageMetadata.Timestamp": inspection.metadata.start_time.isoformat(), # noqa: E501
"ImageMetadata.X": str(
inspection.metadata.time_indexed_pose.pose.position.x
),
"ImageMetadata.Y": str(
inspection.metadata.time_indexed_pose.pose.position.y
),
"ImageMetadata.Y": str(
inspection.metadata.time_indexed_pose.pose.position.z
),
"ImageMetadata.X": str(inspection.metadata.pose.position.x),
"ImageMetadata.Y": str(inspection.metadata.pose.position.y),
"ImageMetadata.Y": str(inspection.metadata.pose.position.z),
"ImageMetadata.CameraOrientation1": str(array_of_orientation[0]),
"ImageMetadata.CameraOrientation2": str(array_of_orientation[1]),
"ImageMetadata.CameraOrientation3": str(array_of_orientation[2]),
Expand All @@ -145,7 +139,7 @@ def _construct_multiform_request_video(
metadata: MissionMetadata,
):
array_of_orientation = (
inspection.metadata.time_indexed_pose.pose.orientation.to_quat_array().tolist()
inspection.metadata.pose.orientation.to_quat_array().tolist()
)
multiform_body: MultipartEncoder = MultipartEncoder(
fields={
Expand All @@ -162,15 +156,9 @@ def _construct_multiform_request_video(
"Mission.Client": "Equinor",
"VideoMetadata.Timestamp": inspection.metadata.start_time.isoformat(), # noqa: E501
"VideoMetadata.Duration": str(inspection.metadata.duration), # type: ignore
"VideoMetadata.X": str(
inspection.metadata.time_indexed_pose.pose.position.x
),
"VideoMetadata.Y": str(
inspection.metadata.time_indexed_pose.pose.position.y
),
"VideoMetadata.Y": str(
inspection.metadata.time_indexed_pose.pose.position.z
),
"VideoMetadata.X": str(inspection.metadata.pose.position.x),
"VideoMetadata.Y": str(inspection.metadata.pose.position.y),
"VideoMetadata.Y": str(inspection.metadata.pose.position.z),
"VideoMetadata.CameraOrientation1": str(array_of_orientation[0]),
"VideoMetadata.CameraOrientation2": str(array_of_orientation[1]),
"VideoMetadata.CameraOrientation3": str(array_of_orientation[2]),
Expand Down
8 changes: 4 additions & 4 deletions src/isar/storage/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def construct_metadata_file(
{
"file_name": filename,
"timestamp": inspection.metadata.start_time,
"x": inspection.metadata.time_indexed_pose.pose.position.x,
"y": inspection.metadata.time_indexed_pose.pose.position.y,
"z": inspection.metadata.time_indexed_pose.pose.position.z,
"x": inspection.metadata.pose.position.x,
"y": inspection.metadata.pose.position.y,
"z": inspection.metadata.pose.position.z,
"tag": inspection.metadata.tag_id,
"additional_media_metadata": {
"orientation": inspection.metadata.time_indexed_pose.pose.orientation.to_quat_array() # noqa: E501
"orientation": inspection.metadata.pose.orientation.to_quat_array() # noqa: E501
},
}
],
Expand Down
12 changes: 5 additions & 7 deletions src/robot_interface/models/inspection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from .inspection import (
Image,
ImageMetadata,
TimeIndexedPose,
InspectionMetadata,
ImageMetadata,
ThermalImageMetadata,
VideoMetadata,
ThermalVideoMetadata,
Inspection,
Image,
InspectionMetadata,
ThermalImage,
ThermalImageMetadata,
ThermalVideo,
ThermalVideoMetadata,
Video,
VideoMetadata,
)
10 changes: 2 additions & 8 deletions src/robot_interface/models/inspection/inspection.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
from abc import ABC
from dataclasses import dataclass, field
from datetime import datetime
from typing import List, Optional, Type
from typing import List, Optional
from uuid import UUID, uuid4

from alitra import Pose


@dataclass
class TimeIndexedPose:
pose: Pose
time: datetime


@dataclass
class InspectionMetadata(ABC):
start_time: datetime
time_indexed_pose: TimeIndexedPose
pose: Pose
file_type: str
analysis: Optional[List] = field(default_factory=list, init=False)
tag_id: Optional[str] = field(default=None, init=False)
Expand Down
13 changes: 5 additions & 8 deletions tests/isar/storage/test_blob_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

from alitra import Frame, Orientation, Pose, Position

from robot_interface.models.inspection.inspection import ImageMetadata, TimeIndexedPose
from robot_interface.models.inspection.inspection import ImageMetadata

MISSION_ID = "some-mission-id"
ARBITRARY_IMAGE_METADATA = ImageMetadata(
datetime.now(),
TimeIndexedPose(
Pose(
Position(0, 0, 0, Frame("asset")),
Orientation(0, 0, 0, 1, Frame("asset")),
Frame("asset"),
),
datetime.now(),
Pose(
Position(0, 0, 0, Frame("asset")),
Orientation(0, 0, 0, 1, Frame("asset")),
Frame("asset"),
),
file_type="jpg",
)
Expand Down
17 changes: 5 additions & 12 deletions tests/isar/storage/test_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@
from isar.models.mission_metadata.mission_metadata import MissionMetadata
from isar.storage.storage_interface import StorageInterface
from isar.storage.uploader import Uploader
from robot_interface.models.inspection.inspection import (
ImageMetadata,
Inspection,
TimeIndexedPose,
)
from robot_interface.models.inspection.inspection import ImageMetadata, Inspection

MISSION_ID = "some-mission-id"
ARBITRARY_IMAGE_METADATA = ImageMetadata(
datetime.now(),
TimeIndexedPose(
Pose(
Position(0, 0, 0, Frame("asset")),
Orientation(x=0, y=0, z=0, w=1, frame=Frame("asset")),
Frame("asset"),
),
datetime.now(),
Pose(
Position(0, 0, 0, Frame("asset")),
Orientation(x=0, y=0, z=0, w=1, frame=Frame("asset")),
Frame("asset"),
),
file_type="jpg",
)
Expand Down
12 changes: 4 additions & 8 deletions tests/mocks/robot_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Image,
ImageMetadata,
Inspection,
TimeIndexedPose,
)
from robot_interface.models.mission import InspectionStep, Step, StepStatus
from robot_interface.models.mission.status import RobotStatus
Expand Down Expand Up @@ -63,13 +62,10 @@ def robot_status(self) -> RobotStatus:
def mock_image_metadata() -> ImageMetadata:
return ImageMetadata(
datetime.now(),
TimeIndexedPose(
Pose(
Position(0, 0, 0, Frame("robot")),
Orientation(0, 0, 0, 1, Frame("robot")),
Frame("robot"),
),
datetime.now(),
Pose(
Position(0, 0, 0, Frame("robot")),
Orientation(0, 0, 0, 1, Frame("robot")),
Frame("robot"),
),
file_type="jpg",
)

0 comments on commit f79bf82

Please sign in to comment.