|
15 | 15 |
|
16 | 16 | import functools
|
17 | 17 | import time
|
18 |
| -from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Type |
| 18 | +from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Type, Union |
19 | 19 |
|
20 | 20 | import rclpy
|
21 | 21 | import rclpy.callback_groups
|
@@ -331,7 +331,9 @@ def adapt_requests_to_offers(
|
331 | 331 |
|
332 | 332 | return request_qos
|
333 | 333 |
|
334 |
| - def get_raw_message_from_topic(self, topic: str, timeout_sec: int = 1) -> Any: |
| 334 | + def get_raw_message_from_topic( |
| 335 | + self, topic: str, timeout_sec: int = 1 |
| 336 | + ) -> Union[Any, str]: # ROS 2 topic or error string |
335 | 337 | self.get_logger().debug(f"Getting msg from topic: {topic}")
|
336 | 338 | if topic in self.state_subscribers and topic in self.robot_state:
|
337 | 339 | self.get_logger().debug("Returning cached message")
|
@@ -366,7 +368,7 @@ def get_raw_message_from_topic(self, topic: str, timeout_sec: int = 1) -> Any:
|
366 | 368 | f"No message received in {timeout_sec} seconds from topic {topic}"
|
367 | 369 | )
|
368 | 370 | self.get_logger().error(error)
|
369 |
| - return Exception(error) |
| 371 | + return error |
370 | 372 |
|
371 | 373 | def get_msg_type(self, topic: str, n_tries: int = 5) -> Any:
|
372 | 374 | """Sometimes node fails to do full discovery, therefore we need to retry"""
|
|
0 commit comments