Async executor in ROS2

I’m playing with ROS2 Beta 1 and I’ve been looking for async executor (something which would start spinning the nodes, but would not block the thread it is being called from). Is something like that available?

Thanks.

No, we don’t have that atm. You can have it use multiple threads with the MultiThreadedExecutor, but we don’t have an async one. Partly because we haven’t needed it, and partly because C++'s std::thread and std::async are now available and could easily wrap either the SingleThreadedExecutor or the MultiThreadedExecutor. For example we use std::thread in a similar situation here in one of our tests:

Great, thanks, this is exactly what I need :slight_smile:

You might want to have a look at this:

I implemented asynchronous spinning for my ros2_components a while ago.
But I have to warn you that the standard syntax for using clients won’t work anymore if you spin the executor async.