diff --git a/leo_fw/leo_fw/board.py b/leo_fw/leo_fw/board.py index 84f6b8d..f8cf2c4 100644 --- a/leo_fw/leo_fw/board.py +++ b/leo_fw/leo_fw/board.py @@ -50,7 +50,8 @@ def determine_board(node: rclpy.Node) -> Optional[BoardType]: future = get_board_type.call_async(Trigger.Request()) rclpy.spin_until_future_complete(node, future, timeout_sec=5.0) if future.done() and not future.exception(): - result = future.result() + result: Trigger.Response | None = future.result() + assert result is not None type_str = result.message if type_str == str(BoardType.CORE2): board_type = BoardType.CORE2 @@ -76,7 +77,8 @@ def check_firmware_version(node: rclpy.Node) -> str: future = get_firmware_version.call_async(Trigger.Request()) rclpy.spin_until_future_complete(node, future, timeout_sec=5.0) if future.done() and not future.exception(): - result = future.result() + result: Trigger.Response | None = future.result() + assert result is not None firmware_version = result.message get_firmware_version.destroy() diff --git a/leo_fw/leo_fw/nodes/parameter_bridge.py b/leo_fw/leo_fw/nodes/parameter_bridge.py index 7e4afd3..61d5c45 100644 --- a/leo_fw/leo_fw/nodes/parameter_bridge.py +++ b/leo_fw/leo_fw/nodes/parameter_bridge.py @@ -206,12 +206,16 @@ def send_params(self) -> tuple[bool, int]: param_request.parameters = self.parse_firmware_parameters() future = self.firmware_parameter_service_client.call_async(param_request) + assert self.executor is not None self.executor.spin_until_future_complete(future, 5.0) - if future.result(): + set_params_response: SetParameters.Response | None = future.result() + if set_params_response is not None: result: SetParametersResult param: ParameterMsg - for result, param in zip(future.result().results, param_request.parameters): + for result, param in zip( + set_params_response.results, param_request.parameters + ): if not result.successful: self.get_logger().warning( f"Parameter '{param.name}' not set. Reason: '{result.reason}'" @@ -234,6 +238,7 @@ def trigger_boot(self) -> bool: boot_request = Trigger.Request() boot_future = self.frimware_boot_service_client.call_async(boot_request) + assert self.executor is not None self.executor.spin_until_future_complete(boot_future, 5.0) if boot_future.result(): diff --git a/leo_fw/leo_fw/utils.py b/leo_fw/leo_fw/utils.py index 15b407c..7c0be9b 100644 --- a/leo_fw/leo_fw/utils.py +++ b/leo_fw/leo_fw/utils.py @@ -99,7 +99,7 @@ def query_yes_no(question: str, default: str = "yes") -> bool: return valid[default] if choice in valid: return valid[choice] - print("Please respond with 'yes' or 'no' " "(or 'y' or 'n').") + print("Please respond with 'yes' or 'no' (or 'y' or 'n').") def prompt_options(options: list[tuple[str, T]], default: int = 1) -> T: