From 637150086f49580afb5a2dc8378ec890b29d5246 Mon Sep 17 00:00:00 2001 From: oysand Date: Fri, 29 Nov 2024 11:45:40 +0100 Subject: [PATCH] Add telemetry no update exception --- .../models/exceptions/robot_exceptions.py | 10 ++++++++++ src/robot_interface/telemetry/mqtt_client.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/robot_interface/models/exceptions/robot_exceptions.py b/src/robot_interface/models/exceptions/robot_exceptions.py index f3c50e32..3163ed75 100644 --- a/src/robot_interface/models/exceptions/robot_exceptions.py +++ b/src/robot_interface/models/exceptions/robot_exceptions.py @@ -202,6 +202,16 @@ def __init__(self, error_description: str) -> None: pass +# An exception which should be thrown by the robot package if there is no new telemetry update. +class RobotTelemetryNoUpdateException(RobotException): + def __init__(self, error_description: str) -> None: + super().__init__( + error_reason=ErrorReason.RobotTelemetryPoseException, + error_description=error_description, + ) + + pass + # An exception which should be thrown by the robot package if it is unable to load the # configuration for maps and transformations. This could be caused by faulty # configuration and this exception will cause ISAR to crash as further execution is not diff --git a/src/robot_interface/telemetry/mqtt_client.py b/src/robot_interface/telemetry/mqtt_client.py index 7048db2f..9f2b410b 100644 --- a/src/robot_interface/telemetry/mqtt_client.py +++ b/src/robot_interface/telemetry/mqtt_client.py @@ -7,6 +7,7 @@ from robot_interface.models.exceptions.robot_exceptions import ( RobotTelemetryException, + RobotTelemetryNoUpdateException, RobotTelemetryPoseException, ) from robot_interface.telemetry.payloads import CloudHealthPayload @@ -74,7 +75,7 @@ def run(self, isar_id: str, robot_name: str) -> None: try: payload = self.telemetry_method(isar_id=isar_id, robot_name=robot_name) topic = self.topic - except RobotTelemetryPoseException: + except (RobotTelemetryPoseException, RobotTelemetryNoUpdateException): time.sleep(self.interval) continue except RobotTelemetryException: