Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gas measurement capability #195

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries",
]
dependencies = ["alitra", "isar>=1.24.4"]
dependencies = ["alitra", "isar>=1.25.6"]
dynamic = ["version"]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ idna==3.10
# requests
injector==0.22.0
# via isar
isar==1.25.3
isar==1.25.6
# via isar-robot (pyproject.toml)
isodate==0.7.2
# via
Expand Down
2 changes: 1 addition & 1 deletion src/isar_robot/config/settings.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CAPABILITIES = '["take_thermal_image", "take_image", "take_video", "take_thermal_video", "record_audio", "localize", "return_to_home", "docking_procedure"]'
CAPABILITIES = '["take_thermal_image", "take_image", "take_video", "take_thermal_video", "record_audio", "localize", "return_to_home", "docking_procedure", "take_gas_measurement"]'
ROBOT_MODEL = Robot
22 changes: 22 additions & 0 deletions src/isar_robot/inspections.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
ThermalVideoMetadata,
Video,
VideoMetadata,
GasMeasurement,
GasMeasurementMetadata,
)
from robot_interface.models.mission.task import (
RecordAudio,
TakeImage,
TakeThermalImage,
TakeThermalVideo,
TakeVideo,
TakeGasMeasurement,
)

from isar_robot import telemetry
Expand Down Expand Up @@ -115,6 +118,25 @@ def create_audio(task_actions: RecordAudio):
return Audio(metadata=audio_metadata, id=task_actions.inspection_id, data=data)


def create_gas_measurement(task_actions: TakeGasMeasurement):
now: datetime = datetime.now(timezone.utc)
gas_measurement_metadata: GasMeasurementMetadata = GasMeasurementMetadata(
start_time=now,
pose=telemetry.get_pose(),
file_type="wav",
)
gas_measurement_metadata.tag_id = task_actions.tag_id
gas_measurement_metadata.analysis_type = ["test1", "test2"]
gas_measurement_metadata.additional = task_actions.metadata

filepath: Path = random.choice(list(example_thermal_videos.iterdir()))
data = _read_data_from_file(filepath)

return GasMeasurement(
metadata=gas_measurement_metadata, id=task_actions.inspection_id, data=data
)


def _read_data_from_file(filename: Path) -> bytes:
try:
with open(filename, "rb") as f:
Expand Down
3 changes: 3 additions & 0 deletions src/isar_robot/robotinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
TakeThermalVideo,
TakeVideo,
Task,
TakeGasMeasurement,
)
from robot_interface.models.robots.media import MediaConfig
from robot_interface.robot_interface import RobotInterface
Expand Down Expand Up @@ -85,6 +86,8 @@ def get_inspection(self, task: InspectionTask) -> Inspection:
return inspections.create_video(task)
elif type(task) is TakeThermalVideo:
return inspections.create_thermal_video(task)
elif type(task) is TakeGasMeasurement:
return inspections.create_gas_measurement(task)
elif type(task) is RecordAudio:
return inspections.create_audio(task)
else:
Expand Down