From 08ad5c8c4f5865de6cefb54a61196b7652db06ad Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Tue, 2 Apr 2024 14:51:25 -0700 Subject: [PATCH] Replace deprecated spin_until_future_complete with spin_until_complete Co-authored-by: Hubert Liberacki Signed-off-by: Hubert Liberacki Signed-off-by: Christophe Bedard --- .../launch_testing_examples/set_param_launch_test.py | 2 +- rclcpp/actions/minimal_action_client/not_composable.cpp | 4 ++-- .../minimal_action_client/not_composable_with_cancel.cpp | 8 ++++---- .../not_composable_with_feedback.cpp | 4 ++-- rclcpp/services/async_client/main.cpp | 2 +- rclcpp/services/minimal_client/main.cpp | 2 +- .../client_not_composable.py | 4 ++-- .../examples_rclpy_minimal_client/client.py | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/launch_testing/launch_testing_examples/launch_testing_examples/set_param_launch_test.py b/launch_testing/launch_testing_examples/launch_testing_examples/set_param_launch_test.py index e240842b..50eeebc0 100644 --- a/launch_testing/launch_testing_examples/launch_testing_examples/set_param_launch_test.py +++ b/launch_testing/launch_testing_examples/launch_testing_examples/set_param_launch_test.py @@ -62,7 +62,7 @@ def test_set_parameter(self, proc_output): request = SetParameters.Request() request.parameters = parameters future = client.call_async(request) - rclpy.spin_until_future_complete(self.node, future, timeout_sec=15.0) + rclpy.spin_until_complete(self.node, future, timeout_sec=15.0) response = future.result() assert response.results[0].successful, 'Could not set parameter!' diff --git a/rclcpp/actions/minimal_action_client/not_composable.cpp b/rclcpp/actions/minimal_action_client/not_composable.cpp index 406a7d9b..f6b805dd 100644 --- a/rclcpp/actions/minimal_action_client/not_composable.cpp +++ b/rclcpp/actions/minimal_action_client/not_composable.cpp @@ -41,7 +41,7 @@ int main(int argc, char ** argv) RCLCPP_INFO(node->get_logger(), "Sending goal"); // Ask server to achieve some goal and wait until it's accepted auto goal_handle_future = action_client->async_send_goal(goal_msg); - if (rclcpp::spin_until_future_complete(node, goal_handle_future) != + if (rclcpp::spin_until_complete(node, goal_handle_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(node->get_logger(), "send goal call failed :("); @@ -58,7 +58,7 @@ int main(int argc, char ** argv) auto result_future = action_client->async_get_result(goal_handle); RCLCPP_INFO(node->get_logger(), "Waiting for result"); - if (rclcpp::spin_until_future_complete(node, result_future) != + if (rclcpp::spin_until_complete(node, result_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(node->get_logger(), "get result call failed :("); diff --git a/rclcpp/actions/minimal_action_client/not_composable_with_cancel.cpp b/rclcpp/actions/minimal_action_client/not_composable_with_cancel.cpp index 3b179079..faf7fbd4 100644 --- a/rclcpp/actions/minimal_action_client/not_composable_with_cancel.cpp +++ b/rclcpp/actions/minimal_action_client/not_composable_with_cancel.cpp @@ -40,7 +40,7 @@ int main(int argc, char ** argv) RCLCPP_INFO(node->get_logger(), "Sending goal"); // Send goal and wait for result (registering feedback callback is optional) auto goal_handle_future = action_client->async_send_goal(goal_msg); - if (rclcpp::spin_until_future_complete(node, goal_handle_future) != + if (rclcpp::spin_until_complete(node, goal_handle_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(node->get_logger(), "send goal call failed :("); @@ -56,7 +56,7 @@ int main(int argc, char ** argv) // Wait for the server to be done with the goal auto result_future = action_client->async_get_result(goal_handle); - auto wait_result = rclcpp::spin_until_future_complete( + auto wait_result = rclcpp::spin_until_complete( node, result_future, std::chrono::seconds(3)); @@ -65,7 +65,7 @@ int main(int argc, char ** argv) RCLCPP_INFO(node->get_logger(), "canceling goal"); // Cancel the goal since it is taking too long auto cancel_result_future = action_client->async_cancel_goal(goal_handle); - if (rclcpp::spin_until_future_complete(node, cancel_result_future) != + if (rclcpp::spin_until_complete(node, cancel_result_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(node->get_logger(), "failed to cancel goal"); @@ -80,7 +80,7 @@ int main(int argc, char ** argv) } RCLCPP_INFO(node->get_logger(), "Waiting for result"); - if (rclcpp::spin_until_future_complete(node, result_future) != + if (rclcpp::spin_until_complete(node, result_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(node->get_logger(), "get result call failed :("); diff --git a/rclcpp/actions/minimal_action_client/not_composable_with_feedback.cpp b/rclcpp/actions/minimal_action_client/not_composable_with_feedback.cpp index 52683c79..a4b99f15 100644 --- a/rclcpp/actions/minimal_action_client/not_composable_with_feedback.cpp +++ b/rclcpp/actions/minimal_action_client/not_composable_with_feedback.cpp @@ -56,7 +56,7 @@ int main(int argc, char ** argv) send_goal_options.feedback_callback = feedback_callback; auto goal_handle_future = action_client->async_send_goal(goal_msg, send_goal_options); - if (rclcpp::spin_until_future_complete(g_node, goal_handle_future) != + if (rclcpp::spin_until_complete(g_node, goal_handle_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(g_node->get_logger(), "send goal call failed :("); @@ -73,7 +73,7 @@ int main(int argc, char ** argv) auto result_future = action_client->async_get_result(goal_handle); RCLCPP_INFO(g_node->get_logger(), "Waiting for result"); - if (rclcpp::spin_until_future_complete(g_node, result_future) != + if (rclcpp::spin_until_complete(g_node, result_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(g_node->get_logger(), "get result call failed :("); diff --git a/rclcpp/services/async_client/main.cpp b/rclcpp/services/async_client/main.cpp index 8922dd7d..430e49c0 100644 --- a/rclcpp/services/async_client/main.cpp +++ b/rclcpp/services/async_client/main.cpp @@ -168,7 +168,7 @@ int main(int argc, char * argv[]) [stop_token = stop_async_spinner.get_future(), node]() { rclcpp::executors::SingleThreadedExecutor executor; executor.add_node(node); - executor.spin_until_future_complete(stop_token); + executor.spin_until_complete(stop_token); }); while (1) { std::string buffer; diff --git a/rclcpp/services/minimal_client/main.cpp b/rclcpp/services/minimal_client/main.cpp index 34b0ed2f..0967aae2 100644 --- a/rclcpp/services/minimal_client/main.cpp +++ b/rclcpp/services/minimal_client/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char * argv[]) request->a = 41; request->b = 1; auto result_future = client->async_send_request(request); - if (rclcpp::spin_until_future_complete(node, result_future) != + if (rclcpp::spin_until_complete(node, result_future) != rclcpp::FutureReturnCode::SUCCESS) { RCLCPP_ERROR(node->get_logger(), "service call failed :("); diff --git a/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py b/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py index 26af729b..af52dd32 100644 --- a/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py +++ b/rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py @@ -43,7 +43,7 @@ def main(args=None): send_goal_future = action_client.send_goal_async( goal_msg, feedback_callback=lambda feedback: feedback_cb(node.get_logger(), feedback)) - rclpy.spin_until_future_complete(node, send_goal_future) + rclpy.spin_until_complete(node, send_goal_future) goal_handle = send_goal_future.result() @@ -58,7 +58,7 @@ def main(args=None): get_result_future = goal_handle.get_result_async() - rclpy.spin_until_future_complete(node, get_result_future) + rclpy.spin_until_complete(node, get_result_future) result = get_result_future.result().result status = get_result_future.result().status diff --git a/rclpy/services/minimal_client/examples_rclpy_minimal_client/client.py b/rclpy/services/minimal_client/examples_rclpy_minimal_client/client.py index 16ed5908..3640eb3f 100644 --- a/rclpy/services/minimal_client/examples_rclpy_minimal_client/client.py +++ b/rclpy/services/minimal_client/examples_rclpy_minimal_client/client.py @@ -29,7 +29,7 @@ def main(args=None): node.get_logger().info('service not available, waiting again...') future = cli.call_async(req) - rclpy.spin_until_future_complete(node, future) + rclpy.spin_until_complete(node, future) result = future.result() node.get_logger().info(