Skip to content

Commit

Permalink
Add telemetry no update exception
Browse files Browse the repository at this point in the history
  • Loading branch information
oysand committed Nov 29, 2024
1 parent 4a0eb47 commit a26f4a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/robot_interface/models/exceptions/robot_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ErrorReason(str, Enum):
RobotRetrieveDataException: str = "robot_retrieve_data_exception"
RobotRetrieveInspectionException: str = "robot_retrieve_inspection_exception"
RobotTelemetryException: str = "robot_telemetry_exception"
RobotTelemetryNoUpdateException: str = "robot_telemetry_no_update_exception"
RobotTelemetryPoseException: str = "robot_telemetry_pose_exception"
RobotMapException: str = "robot_map_exception"
RobotTransformException: str = "robot_transform_exception"
Expand Down Expand Up @@ -202,6 +203,17 @@ 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.RobotTelemetryNoUpdateException,
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
Expand Down
3 changes: 2 additions & 1 deletion src/robot_interface/telemetry/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from robot_interface.models.exceptions.robot_exceptions import (
RobotTelemetryException,
RobotTelemetryNoUpdateException,
RobotTelemetryPoseException,
)
from robot_interface.telemetry.payloads import CloudHealthPayload
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a26f4a7

Please sign in to comment.