Current state of Rust client libraries? Which one to use (ros2-client, rus2, ros2_rust, rclrust, rosrust, or r2r)?

I am very interested in using Rust for ROS2, but it has been some time since I last explored it, and I am unable to find any recent updates on its current state.

There are numerous client libraries available, indicating significant interest in Rust for ROS2. However, how many of these libraries are mature enough to be considered serious alternatives to rclpy or rclcpp? Which should I choose? What is the difference between them?

What progress has been made in discussions about creating an official Rust client? I have heard that Zenoh is to become an officially supported RMW, which would require the ROS2 CI pipeline / build farm to support compiling Rust projects. Could this lead to a Rust client library being shipped by default alongside rclpy and rclcpp? Also, how does code generation work in these libraries? If they are installed, will every .msg and .srv file also generate some rust code, i.e, all of the std_msgs and any other third party package in my workspace?

I believe that including it by default would encourage more people to adopt Rust in robotics, potentially making future robotics development safer and faster. I work in robotics but want to code in rust, so it’s something I personally would love to see!

Here are the Rust client libraries that I could find. Am I missing any?

5 Likes

This is a bit of an oversimplification of the current situation. It’s true that the buildfarm is currently compiling binaries out of at least one cargo project (zenoh-bridge-dds is one that I know of), but this is very different from distributing a library crate, which is what the buildfarm would need to do for first-class support of a client library for Rust.

While the binaries that are compiled from a Rust bin crate are pretty normal artifacts as far as the buildfarm is concerned, library crates operate in a very different way than what the buildfarm is accustomed to with C, C++, and Python. There is considerable groundwork that needs to be done to figure out the right way to distribute those library crates in a way that makes them both accessible and useful for ROS buildfarm users.

Thank you for your reply.

Has the option of distributing source code, rather than compiled libraries been considered? This seems to be the usual way of using library code in rust. I suppose it isn’t too different from python, as I imagine rclpy is distributed as source code. Or am I misunderstanding something?