Skip to content

Port executor API from ROS2 #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
esteve opened this issue Apr 26, 2022 · 4 comments
Open

Port executor API from ROS2 #126

esteve opened this issue Apr 26, 2022 · 4 comments

Comments

@esteve
Copy link
Collaborator

esteve commented Apr 26, 2022

We currently use simple spin functions to interact with waitsets and any waitable entities (subscriptions, clients, services, etc.), porting the executor API would help us implement more waitable entities (e.g. timers) and support running more than one node in a single program.

@jhdcs
Copy link
Collaborator

jhdcs commented Apr 27, 2022

Would we be able to use some crates to help implement this solution (such as tokio or rayon), or do we want to make this a sort of 1:1 port of what rclcpp does?

@nnmm nnmm changed the title Port executor API from ROS2 Port executor API from rclcpp Apr 28, 2022
@esteve
Copy link
Collaborator Author

esteve commented May 2, 2022

@jhdcs for now I'd just port the rclcpp / rclpy API 1:1 as a first step, but then offer the possibility to integrate with async_std, tokio, etc. so that existing Rust applications can integrate with ROS2. Not sure how that'd look like, for example via an implementation of the ROS2 executor API that can call both the RMW constructs (e.g. waitsets) and the Rust executor crates. The Future implementation is highly dependent on the executor, so it'll require some work.

@esteve esteve changed the title Port executor API from rclcpp Port executor API from ROS2 May 2, 2022
@nnmm
Copy link
Contributor

nnmm commented Jun 6, 2022

This is an issue where I feel there is a lot to learn for us about what a good design would be.

For instance, if we tried to port the rclcpp API 1:1, we'd run into CallbackGroup being used a lot in the executor. Does the concept of a callback group make sense in Rust? There is no need to use a callback group to "guard access to shared critical or non-thread-safe resources" since the language forces you to be thread-safe.

Async is tricky too. One observation is that it would probably be possible to make all things that can be waited on, like nodes, subscriptions, timers etc., instances of std::task::Future, and then we would not need to write our own executor, we could simply use the tokio or smolexecutor in the single-threaded or multi-threaded configuration. This is not a suggestion yet to actually do this.

The Future implementation is highly dependent on the executor, so it'll require some work.

I thought a Future is generally independent of the async executor?

@nnarain
Copy link
Contributor

nnarain commented Aug 2, 2022

I believe the wake implementation ends up being executor specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants