Robotics StackExchange | Archived questions

Client response with loop vs spin_until_future_complete

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 spinuntilfuture_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!

Asked by Og on 2022-09-12 01:07:43 UTC

Comments

Answers

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

Asked by pcoenen on 2022-09-12 07:26:56 UTC

Comments