ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Client response with loop vs spin_until_future_complete

asked 2022-09-12 01:07:43 -0500

Og gravatar image

Hello all, I'm new in ROS2 and I have a question about asynchronous client. In the examples I saw the usage of construction like this:

while not future.done():
        #sleep in some way

and in other I saw the usage of spin_until_future_complete.

self.future = self.cli.call_async(self.req)
rclpy.spin_until_future_complete(self, self.future)

Is there some way to get an event that indicates the call is done? Thank you in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-09-12 07:26:56 -0500

pcoenen gravatar image

You might be able to use add_done_callback of asyncio's futures.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-09-12 01:07:43 -0500

Seen: 113 times

Last updated: Sep 12 '22