Skip to content

Commit 5b41693

Browse files
Add new executor spin_until_complete API
Co-authored-by: stevemacenski <stevenmacenski@gmail.com> Signed-off-by: stevemacenski <stevenmacenski@gmail.com> Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
1 parent 737b023 commit 5b41693

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

source/How-To-Guides/Migrating-from-ROS1/Migrating-Python-Packages.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ In ROS 2:
166166
while not add_two_ints.wait_for_service(timeout_sec=1.0):
167167
node.get_logger().info('service not available, waiting again...')
168168
resp = add_two_ints.call_async(req)
169-
rclpy.spin_until_future_complete(node, resp)
169+
rclpy.spin_until_complete(node, resp)

source/Releases/Release-Jazzy-Jalisco.rst

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ New type support helper for services ``rclcpp::get_service_typesupport_handle``
4949

5050
See https://github.com/ros2/rclcpp/pull/2209 for more details.
5151

52+
New executor ``spin_until_complete`` interface
53+
""""""""""""""""""""""""""""""""""""""""""""""
54+
55+
``spin_until_complete`` was added to spin on arbitrary callable conditions.
56+
It goes alongside ``spin_until_future_complete``, which exclusively spins on futures.
57+
58+
See https://github.com/ros2/rclcpp/pull/2475 for more details.
59+
5260
``ros2cli``
5361
^^^^^^^^^^^
5462

source/Tutorials/Advanced/FastDDS-Configuration.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ Create the client in a file named ``src/ping_client.cpp`` with the following con
670670
auto result = client->async_send_request(request);
671671

672672
// Wait for the result and log it to the console
673-
if (rclcpp::spin_until_future_complete(node, result) ==
673+
if (rclcpp::spin_until_complete(node, result) ==
674674
rclcpp::FutureReturnCode::SUCCESS)
675675
{
676676
RCLCPP_INFO(rclcpp::get_logger("ping_client"), "Response received");

source/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ Since you'll be changing the original two integer request srv to a three integer
645645

646646
auto result = client->async_send_request(request);
647647
// Wait for the result.
648-
if (rclcpp::spin_until_future_complete(node, result) ==
648+
if (rclcpp::spin_until_complete(node, result) ==
649649
rclcpp::FutureReturnCode::SUCCESS)
650650
{
651651
RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "Sum: %ld", result.get()->sum);

source/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Service-And-Client.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Inside the ``ros2_ws/src/cpp_srvcli/src`` directory, create a new file called ``
227227

228228
auto result = client->async_send_request(request);
229229
// Wait for the result.
230-
if (rclcpp::spin_until_future_complete(node, result) ==
230+
if (rclcpp::spin_until_complete(node, result) ==
231231
rclcpp::FutureReturnCode::SUCCESS)
232232
{
233233
RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "Sum: %ld", result.get()->sum);

source/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Service-And-Client.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Inside the ``ros2_ws/src/py_srvcli/py_srvcli`` directory, create a new file call
197197
self.req.a = a
198198
self.req.b = b
199199
self.future = self.cli.call_async(self.req)
200-
rclpy.spin_until_future_complete(self, self.future)
200+
rclpy.spin_until_complete(self, self.future)
201201
return self.future.result()
202202
203203
@@ -254,7 +254,7 @@ Below the constructor is the ``send_request`` method, which will send the reques
254254
self.req.a = a
255255
self.req.b = b
256256
self.future = self.cli.call_async(self.req)
257-
rclpy.spin_until_future_complete(self, self.future)
257+
rclpy.spin_until_complete(self, self.future)
258258
return self.future.result()
259259
260260
Finally we have the ``main`` method, which constructs a ``MinimalClientAsync`` object, sends the request using the passed-in command-line arguments, and logs the results.

source/Tutorials/Intermediate/Writing-an-Action-Server-Client/scripts/client_0.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def main(args=None):
2727

2828
future = action_client.send_goal(10)
2929

30-
rclpy.spin_until_future_complete(action_client, future)
30+
rclpy.spin_until_complete(action_client, future)
3131

3232

3333
if __name__ == '__main__':

0 commit comments

Comments
 (0)