Skip to content

Commit 573209c

Browse files
committed
Replace deprecated spin_until_future_complete with spin_until_complete
Signed-off-by: Hubert Liberacki <[email protected]>
1 parent 7d6f14a commit 573209c

File tree

8 files changed

+21
-18
lines changed

8 files changed

+21
-18
lines changed

launch_testing/launch_testing_examples/launch_testing_examples/set_param_launch_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,19 @@ def test_set_parameter(self, proc_output):
5252

5353

5454
def set_parameter(dummy_node, value=True, timeout=5.0):
55-
parameters = [rclpy.Parameter('demo_parameter_1', value=value).to_parameter_msg()]
55+
parameters = [rclpy.Parameter(
56+
'demo_parameter_1', value=value).to_parameter_msg()]
5657

57-
client = dummy_node.create_client(SetParameters, 'demo_node_1/set_parameters')
58+
client = dummy_node.create_client(
59+
SetParameters, 'demo_node_1/set_parameters')
5860
ready = client.wait_for_service(timeout_sec=timeout)
5961
if not ready:
6062
raise RuntimeError('Wait for service timed out')
6163

6264
request = SetParameters.Request()
6365
request.parameters = parameters
6466
future = client.call_async(request)
65-
rclpy.spin_until_future_complete(dummy_node, future, timeout_sec=timeout)
67+
rclpy.spin_until_complete(dummy_node, future, timeout_sec=timeout)
6668

6769
response = future.result()
6870
return response.results[0]

rclcpp/actions/minimal_action_client/not_composable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char ** argv)
4141
RCLCPP_INFO(node->get_logger(), "Sending goal");
4242
// Ask server to achieve some goal and wait until it's accepted
4343
auto goal_handle_future = action_client->async_send_goal(goal_msg);
44-
if (rclcpp::spin_until_future_complete(node, goal_handle_future) !=
44+
if (rclcpp::spin_until_complete(node, goal_handle_future) !=
4545
rclcpp::FutureReturnCode::SUCCESS)
4646
{
4747
RCLCPP_ERROR(node->get_logger(), "send goal call failed :(");
@@ -58,7 +58,7 @@ int main(int argc, char ** argv)
5858
auto result_future = action_client->async_get_result(goal_handle);
5959

6060
RCLCPP_INFO(node->get_logger(), "Waiting for result");
61-
if (rclcpp::spin_until_future_complete(node, result_future) !=
61+
if (rclcpp::spin_until_complete(node, result_future) !=
6262
rclcpp::FutureReturnCode::SUCCESS)
6363
{
6464
RCLCPP_ERROR(node->get_logger(), "get result call failed :(");

rclcpp/actions/minimal_action_client/not_composable_with_cancel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main(int argc, char ** argv)
4040
RCLCPP_INFO(node->get_logger(), "Sending goal");
4141
// Send goal and wait for result (registering feedback callback is optional)
4242
auto goal_handle_future = action_client->async_send_goal(goal_msg);
43-
if (rclcpp::spin_until_future_complete(node, goal_handle_future) !=
43+
if (rclcpp::spin_until_complete(node, goal_handle_future) !=
4444
rclcpp::FutureReturnCode::SUCCESS)
4545
{
4646
RCLCPP_ERROR(node->get_logger(), "send goal call failed :(");
@@ -56,7 +56,7 @@ int main(int argc, char ** argv)
5656
// Wait for the server to be done with the goal
5757
auto result_future = action_client->async_get_result(goal_handle);
5858

59-
auto wait_result = rclcpp::spin_until_future_complete(
59+
auto wait_result = rclcpp::spin_until_complete(
6060
node,
6161
result_future,
6262
std::chrono::seconds(3));
@@ -65,7 +65,7 @@ int main(int argc, char ** argv)
6565
RCLCPP_INFO(node->get_logger(), "canceling goal");
6666
// Cancel the goal since it is taking too long
6767
auto cancel_result_future = action_client->async_cancel_goal(goal_handle);
68-
if (rclcpp::spin_until_future_complete(node, cancel_result_future) !=
68+
if (rclcpp::spin_until_complete(node, cancel_result_future) !=
6969
rclcpp::FutureReturnCode::SUCCESS)
7070
{
7171
RCLCPP_ERROR(node->get_logger(), "failed to cancel goal");
@@ -80,7 +80,7 @@ int main(int argc, char ** argv)
8080
}
8181

8282
RCLCPP_INFO(node->get_logger(), "Waiting for result");
83-
if (rclcpp::spin_until_future_complete(node, result_future) !=
83+
if (rclcpp::spin_until_complete(node, result_future) !=
8484
rclcpp::FutureReturnCode::SUCCESS)
8585
{
8686
RCLCPP_ERROR(node->get_logger(), "get result call failed :(");

rclcpp/actions/minimal_action_client/not_composable_with_feedback.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int main(int argc, char ** argv)
5656
send_goal_options.feedback_callback = feedback_callback;
5757
auto goal_handle_future = action_client->async_send_goal(goal_msg, send_goal_options);
5858

59-
if (rclcpp::spin_until_future_complete(g_node, goal_handle_future) !=
59+
if (rclcpp::spin_until_complete(g_node, goal_handle_future) !=
6060
rclcpp::FutureReturnCode::SUCCESS)
6161
{
6262
RCLCPP_ERROR(g_node->get_logger(), "send goal call failed :(");
@@ -73,7 +73,7 @@ int main(int argc, char ** argv)
7373
auto result_future = action_client->async_get_result(goal_handle);
7474

7575
RCLCPP_INFO(g_node->get_logger(), "Waiting for result");
76-
if (rclcpp::spin_until_future_complete(g_node, result_future) !=
76+
if (rclcpp::spin_until_complete(g_node, result_future) !=
7777
rclcpp::FutureReturnCode::SUCCESS)
7878
{
7979
RCLCPP_ERROR(g_node->get_logger(), "get result call failed :(");

rclcpp/services/async_client/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ int main(int argc, char * argv[])
168168
[stop_token = stop_async_spinner.get_future(), node]() {
169169
rclcpp::executors::SingleThreadedExecutor executor;
170170
executor.add_node(node);
171-
executor.spin_until_future_complete(stop_token);
171+
executor.spin_until_complete(stop_token);
172172
});
173173
while (1) {
174174
std::string buffer;

rclcpp/services/minimal_client/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main(int argc, char * argv[])
3737
request->a = 41;
3838
request->b = 1;
3939
auto result_future = client->async_send_request(request);
40-
if (rclcpp::spin_until_future_complete(node, result_future) !=
40+
if (rclcpp::spin_until_complete(node, result_future) !=
4141
rclcpp::FutureReturnCode::SUCCESS)
4242
{
4343
RCLCPP_ERROR(node->get_logger(), "service call failed :(");

rclpy/actions/minimal_action_client/examples_rclpy_minimal_action_client/client_not_composable.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def main(args=None):
4343
send_goal_future = action_client.send_goal_async(
4444
goal_msg, feedback_callback=lambda feedback: feedback_cb(node.get_logger(), feedback))
4545

46-
rclpy.spin_until_future_complete(node, send_goal_future)
46+
rclpy.spin_until_complete(node, send_goal_future)
4747

4848
goal_handle = send_goal_future.result()
4949

@@ -58,15 +58,16 @@ def main(args=None):
5858

5959
get_result_future = goal_handle.get_result_async()
6060

61-
rclpy.spin_until_future_complete(node, get_result_future)
61+
rclpy.spin_until_complete(node, get_result_future)
6262

6363
result = get_result_future.result().result
6464
status = get_result_future.result().status
6565
if status == GoalStatus.STATUS_SUCCEEDED:
6666
node.get_logger().info(
67-
'Goal succeeded! Result: {0}'.format(result.sequence))
67+
'Goal succeeded! Result: {0}'.format(result.sequence))
6868
else:
69-
node.get_logger().info('Goal failed with status code: {0}'.format(status))
69+
node.get_logger().info(
70+
'Goal failed with status code: {0}'.format(status))
7071

7172
action_client.destroy()
7273
node.destroy_node()

rclpy/services/minimal_client/examples_rclpy_minimal_client/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main(args=None):
2929
node.get_logger().info('service not available, waiting again...')
3030

3131
future = cli.call_async(req)
32-
rclpy.spin_until_future_complete(node, future)
32+
rclpy.spin_until_complete(node, future)
3333

3434
result = future.result()
3535
node.get_logger().info(

0 commit comments

Comments
 (0)