diff --git a/leo_fw/src/firmware_message_converter.cpp b/leo_fw/src/firmware_message_converter.cpp index de507f7..4cd0e5b 100644 --- a/leo_fw/src/firmware_message_converter.cpp +++ b/leo_fw/src/firmware_message_converter.cpp @@ -243,6 +243,7 @@ class FirmwareMessageConverter : public rclcpp::Node const std::shared_ptr req, std::shared_ptr res) { + constexpr std::chrono::seconds callback_timeout = std::chrono::seconds(3); odom_merged_position.x = 0.0; odom_merged_position.y = 0.0; odom_merged_yaw = 0.0; @@ -251,9 +252,9 @@ class FirmwareMessageConverter : public rclcpp::Node auto result = reset_odometry_client->async_send_request(reset_request); - if (rclcpp::spin_until_future_complete( - this->get_node_base_interface(), - result) != rclcpp::FutureReturnCode::SUCCESS) + auto result_status = result.wait_for(callback_timeout); + + if (result_status == std::future_status::ready) { res->success = false; } else {