Skip to content

Commit

Permalink
Add API change for spin_until_complete
Browse files Browse the repository at this point in the history
Co-authored-by: stevemacenski <[email protected]>
Signed-off-by: stevemacenski <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
  • Loading branch information
christophebedard and SteveMacenski committed Apr 2, 2024
1 parent 737b023 commit 612da76
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ In ROS 2:
while not add_two_ints.wait_for_service(timeout_sec=1.0):
node.get_logger().info('service not available, waiting again...')
resp = add_two_ints.call_async(req)
rclpy.spin_until_future_complete(node, resp)
rclpy.spin_until_complete(node, resp)
9 changes: 9 additions & 0 deletions source/Releases/Release-Jazzy-Jalisco.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ New type support helper for services ``rclcpp::get_service_typesupport_handle``

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

``spin_until_future_complete`` was renamed to ``spin_until_complete``
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

``spin_until_future_complete`` was renamed to ``spin_until_complete`` to represent the semantics of being able to spin on values that are not exclusively futures.
The API can now spin until arbitrary conditions.
A deprecation warning will appear for migration.

See https://github.com/ros2/rclcpp/pull/2475 for more details.

``ros2cli``
^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion source/Tutorials/Advanced/FastDDS-Configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ Create the client in a file named ``src/ping_client.cpp`` with the following con
auto result = client->async_send_request(request);

// Wait for the result and log it to the console
if (rclcpp::spin_until_future_complete(node, result) ==
if (rclcpp::spin_until_complete(node, result) ==
rclcpp::FutureReturnCode::SUCCESS)
{
RCLCPP_INFO(rclcpp::get_logger("ping_client"), "Response received");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ Since you'll be changing the original two integer request srv to a three integer

auto result = client->async_send_request(request);
// Wait for the result.
if (rclcpp::spin_until_future_complete(node, result) ==
if (rclcpp::spin_until_complete(node, result) ==
rclcpp::FutureReturnCode::SUCCESS)
{
RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "Sum: %ld", result.get()->sum);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Inside the ``ros2_ws/src/cpp_srvcli/src`` directory, create a new file called ``

auto result = client->async_send_request(request);
// Wait for the result.
if (rclcpp::spin_until_future_complete(node, result) ==
if (rclcpp::spin_until_complete(node, result) ==
rclcpp::FutureReturnCode::SUCCESS)
{
RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "Sum: %ld", result.get()->sum);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Inside the ``ros2_ws/src/py_srvcli/py_srvcli`` directory, create a new file call
self.req.a = a
self.req.b = b
self.future = self.cli.call_async(self.req)
rclpy.spin_until_future_complete(self, self.future)
rclpy.spin_until_complete(self, self.future)
return self.future.result()
Expand Down Expand Up @@ -254,7 +254,7 @@ Below the constructor is the ``send_request`` method, which will send the reques
self.req.a = a
self.req.b = b
self.future = self.cli.call_async(self.req)
rclpy.spin_until_future_complete(self, self.future)
rclpy.spin_until_complete(self, self.future)
return self.future.result()
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main(args=None):

future = action_client.send_goal(10)

rclpy.spin_until_future_complete(action_client, future)
rclpy.spin_until_complete(action_client, future)


if __name__ == '__main__':
Expand Down

0 comments on commit 612da76

Please sign in to comment.