# Announcing Rust bindings for ROS2

**URL:** <https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870>\
**Category:** ROS General\
**Tags:** ros2, rust\
**Created:** [February 2, 2018, 10:03pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870 "2018-02-02T22:03:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [February 2, 2018, 10:03pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/1 "2018-02-02T22:03:45Z")

</div>

Hi,

I hacked together a generator and a client library for writing [ROS2 applications in Rust](https://github.com/esteve/ros2_rust) over the holidays, and finally found some time to write a README file… the last 10% is always the hardest part 🙂

Anyway, publishers and subscriber work, along with simple messages. There’s still missing a bunch of things and I’m still learning Rust, so if anyone is interested in contributing (including criticizing my Rust), you’re more than welcome!

---

<div class="post-metadata">

**Author:** ![jjadams](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/jjadams/32/4875_2.png) [@jjadams](https://discourse.openrobotics.org/u/jjadams)\
**Post date:** [March 1, 2018, 6:25pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/2 "2018-03-01T18:25:20Z")

</div>

I mentioned an idea to do this to Mikael at ROSCon last year. I’m glad to hear it’s underway.

---

<div class="post-metadata">

**Author:** ![excaliber](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@excaliber](https://discourse.openrobotics.org/u/excaliber)\
**Post date:** [April 10, 2018, 4:46pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/3 "2018-04-10T16:46:18Z")

</div>

Is there any material or documentation that gives an insight into why use Rust for ROS? I have never used Rust before so would like to get an understanding why before deciding to go down that path. Any reference material would be helpful to me. Thank you.

---

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [April 19, 2018, 8:10am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/4 "2018-04-19T08:10:10Z")

</div>

I’m far from being a Rust expert, so take my advise with a grain of salt.

I’ve found Rust to be a more modern (perhaps better) version of what C++ would be if it were designed today. The tooling is much better (actually, the tooling in C++ is non-existent, so that’s easy to beat): things like a proper package manager (Cargo) and an official repository of packages ([crates.io](http://crates.io)) make the Rust ecosystem much easier to start with and contribute to.

The language itself feels better designed as well. Concurrency in Rust is much more pleasant: among other things, variables are immutable by default and values are moved instead of assigned, and thanks to that, the compiler will tell you before compiling your program whether it’s valid or not, preventing most data races (you can still deadlock a Rust program, though [Races - The Rustonomicon](https://doc.rust-lang.org/beta/nomicon/races.html)). Rust doesn’t have a runtime, so when you compile a program it’ll already have all the dependencies, so crosscompiling for embedded devices becomes trivial (or even crosscompiling Rust for WASM!). You can also compile a Rust program without Rust’s standard library, and thanks to that, you can have Rust programs running on a microcontroller.

And that’s only a few things that are directly applicable to robotics. But there are many other advantages in general. For example, template metaprogramming in C++ is difficult since the language does not yet support concepts (try debugging an ill-formed template), whereas Rust has traits ([Traits: Defining Shared Behavior - The Rust Programming Language](https://doc.rust-lang.org/book/second-edition/ch10-02-traits.html)) that will check that a template implements a given behavior before being instantiated. Rust is also very is to embed, you can write your library in Rust and expose a C API. For example MesaLink ([GitHub - mesalock-linux/mesalink: OpenSSL compatibility layer for the Rust SSL/TLS stack](https://github.com/mesalock-linux/mesalink)) uses the Rust rtls and sct cryptographic libraries and exposes a OpenSSL-compatible C API that can be used by C and C++ programs as a replacement for OpenSSL, while having all the advantages of Rust. Unlike Go, Rust doesn’t have a garbage collector, so it’s closer to C and C++ than to higher-level languages like Java or Python.

That being said, there are a few things in Rust that need to be properly stabilized (e.g. it doesn’t have a defined memory model, it just inherits whatever model LLVM has [Rust needs a memory model · Issue #1447 · rust-lang/rfcs · GitHub](https://github.com/rust-lang/rfcs/issues/1447)). In any case, I think Rust has a lot of potential and IMHO it’s on the right track to become a serious alternative to C and C++.

BTW, if you want to try out Rust on ROS1, check out Adnan Ademovic’s rosrust [GitHub - adnanademovic/rosrust: Pure Rust implementation of a ROS client library](https://github.com/adnanademovic/rosrust) It might help you get a better idea of what’s possible with Rust while not having to learn ROS2.

---

<div class="post-metadata">

**Author:** ![gbiggs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/gbiggs/32/30361_2.png) [@gbiggs](https://discourse.openrobotics.org/u/gbiggs)\
**Post date:** [April 19, 2018, 8:40am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/5 "2018-04-19T08:40:34Z")

</div>

I looked at [crate.io](http://crate.io), but as someone who actively uses Rust, what’s the availability of libraries like compared with C++? Both on the STL-equivalent side and on the broader ecosystem side?

Also, what is the quality level like overall of the available and commonly-used libraries?

---

<div class="post-metadata">

**Author:** ![ruffsl](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/ruffsl/32/83_2.png) [@ruffsl](https://discourse.openrobotics.org/u/ruffsl)\
**Post date:** [March 4, 2019, 7:47pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/6 "2019-03-04T19:47:02Z")

</div>

I’ve been learning rust recently, going through [The Book](https://doc.rust-lang.org/book/), as well as [The Cargo Book](https://doc.rust-lang.org/cargo/index.html) to get a better grasp on both the memory safety features of the compiler and build ecosystem. Would there be any other folks who’d like to help start a working group for developing rclrs client library?

---

<div class="post-metadata">

**Author:** ![gbiggs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/gbiggs/32/30361_2.png) [@gbiggs](https://discourse.openrobotics.org/u/gbiggs)\
**Post date:** [March 4, 2019, 8:09pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/7 "2019-03-04T20:09:34Z")

</div>

Absolutely! I was thinking the very same thing yesterday!

---

<div class="post-metadata">

**Author:** ![ruffsl](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/ruffsl/32/83_2.png) [@ruffsl](https://discourse.openrobotics.org/u/ruffsl)\
**Post date:** [March 5, 2019, 3:30am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/8 "2019-03-05T03:30:07Z")

</div>

Should we open a new thread to poll others interested for an inaugural meeting time?

---

<div class="post-metadata">

**Author:** ![gbiggs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/gbiggs/32/30361_2.png) [@gbiggs](https://discourse.openrobotics.org/u/gbiggs)\
**Post date:** [March 5, 2019, 5:32am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/9 "2019-03-05T05:32:56Z")

</div>

I don’t know if it needs to be a new thread or not, but yes, I think polling for a meeting time is a good idea.

---

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [March 5, 2019, 7:45am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/10 "2019-03-05T07:45:17Z")

</div>

Yay! So happy to see more people interested in ROS2 and Rust. However I can’t help but wonder what’s the need for a meeting. The code is up there for anyone to contribute to, there’s still a lot of work to do and any contribution is more than welcome.

---

<div class="post-metadata">

**Author:** ![ruffsl](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/ruffsl/32/83_2.png) [@ruffsl](https://discourse.openrobotics.org/u/ruffsl)\
**Post date:** [March 5, 2019, 6:29pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/11 "2019-03-05T18:29:20Z")

</div>

> [@esteve](#):
>
> there’s still a lot of work to do and any contribution is more than welcome.

Well, a lot of other working groups meet and organize regularly to catch up and discuss new ideas: Some concepts I’d like to float for an agenda off the top of my head:

- improving cargo build integration: [colcon\_cargo](https://github.com/colcon/colcon-cargo) + [tools::cargo-plugins](https://crates.io/categories/development-tools::cargo-plugins)?
- how much of rclrs could be shared with rust’s ecosystem: [crates.io](http://crates.io)
- soliciting guidance from the larger friendly rust community: [users.rust-lang.org](http://users.rust-lang.org)
- improving message IDL integration: avoid re-generating default messages
- design goals for making the API overall more idiomatic with rust code

Others may have more ideas I’d like to listen to. I think syncing up over a discussion would be a lot quicker than prematurely cycling across timezones on tickets that may be otherwise too unclear to tackle.

---

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [March 5, 2019, 7:36pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/12 "2019-03-05T19:36:22Z")

</div>

> [@ruffsl](#):
>
> - improving cargo build integration: [colcon\_cargo](https://github.com/colcon/colcon-cargo) + [tools::cargo-plugins](https://crates.io/categories/development-tools::cargo-plugins)?
> - how much of rclrs could be shared with rust’s ecosystem: [crates.io](http://crates.io)
> - soliciting guidance from the larger friendly rust community: [users.rust-lang.org](http://users.rust-lang.org)
> - improving message IDL integration: avoid re-generating default messages
> - design goals for making the API overall more idiomatic with rust code

I’d say those items would make great GitHub tickets.

Gérard Long has just added support for Crystal after I opensourced rclrs a year ago, and he also added support for Cargo to colcon a couple of months back.

> [@ruffsl](#):
>
> Others may have more ideas I’d like to listen to. I think syncing up over a discussion would be a lot quicker than prematurely cycling across timezones on tickets that may be otherwise too unclear to tackle.

I’d love to see more activity in rclrs, but I don’t see how a working group and meeting would solve that. rclrs has been opensource for well over a year, the code is there and available for everyone to contribute to in any way they feel capable (e.g. reviewing pull requests, proposing new features, suggesting improvements, filing bug reports, etc.)

---

<div class="post-metadata">

**Author:** ![ruffsl](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/ruffsl/32/83_2.png) [@ruffsl](https://discourse.openrobotics.org/u/ruffsl)\
**Post date:** [March 5, 2019, 11:16pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/13 "2019-03-05T23:16:55Z")

</div>

> [@esteve](#):
>
> I’d say those items would make great GitHub tickets.

Cool, sounds good! I’ve opened some tickets:

- [Improve build integration with cargo #13](https://github.com/esteve/ros2_rust/issues/13)
- [Releasing and Packaging #9](https://github.com/esteve/ros2_rust/issues/9)
- [Outreach with the Rust Community #10](https://github.com/esteve/ros2_rust/issues/10)
- [Improve message generation #11](https://github.com/esteve/ros2_rust/issues/11)
- [Idiomatic API for Rust #12](https://github.com/esteve/ros2_rust/issues/12)

Most aren’t as informative as I’d like, but barring any prelmerary dialogue, this is what I came up with.

> [@esteve](#):
>
> I’d love to see more activity in rclrs, but I don’t see how a working group and meeting would solve that. rclrs has been opensource for well over a year,

Ok, it’s just there hasn’t been much rclrs activity ‘for well over a year’, so I was thinking we could try and organize our efforts a little more. Also, I prefer brainstorming over a call given my typing impairment.

---

<div class="post-metadata">

**Author:** ![gbiggs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/gbiggs/32/30361_2.png) [@gbiggs](https://discourse.openrobotics.org/u/gbiggs)\
**Post date:** [March 6, 2019, 1:43am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/14 "2019-03-06T01:43:45Z")

</div>

What I personally need to be able to contribute is a list of contributions that a rust beginner could handle. I don’t have much experience with rust so I can’t handle complex contributions or write idiomatic code yet.

---

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [March 6, 2019, 9:49am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/15 "2019-03-06T09:49:56Z")

</div>

> [@ruffsl](#):
>
> Cool, sounds good! I’ve opened some tickets:
> 
> - [Improve build integration with cargo #13](https://github.com/esteve/ros2_rust/issues/13)
> - [Releasing and Packaging #9](https://github.com/esteve/ros2_rust/issues/9)
> - [Outreach with the Rust Community #10](https://github.com/esteve/ros2_rust/issues/10)
> - [Improve message generation #11](https://github.com/esteve/ros2_rust/issues/11)
> - [Idiomatic API for Rust #12](https://github.com/esteve/ros2_rust/issues/12)
> 
> Most aren’t as informative as I’d like, but barring any prelmerary dialogue, this is what I came up with.

Thanks!

> [@ruffsl](#):
>
> Ok, it’s just there hasn’t been much rclrs activity ‘for well over a year’, so I was thinking we could try and organize our efforts a little more. Also, I prefer brainstorming over a call given my typing impairment.

Yeah, it’s unfortunate that rclrs hasn’t attracted more attention since I opensourced it, but I’m happy that it has now and I’m hopeful users will file tickets and submit pull requests.

---

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [March 6, 2019, 10:58am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/16 "2019-03-06T10:58:24Z")

</div>

> [@gbiggs](#):
>
> What I personally need to be able to contribute is a list of contributions that a rust beginner could handle. I don’t have much experience with rust so I can’t handle complex contributions or write idiomatic code yet.

That’s a great idea. However, I’d argue that any contribution is great, no matter how small or unidiomatic they may be, I believe more in iterating than in getting it right at the first try. I’ll create tickets for issues that might be straightforward to work on, however there’s the added difficulty of learning the internals of the message generation pipeline in ROS2.

---

<div class="post-metadata">

**Author:** ![bergercookie](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/bergercookie/32/3357_2.png) [@bergercookie](https://discourse.openrobotics.org/u/bergercookie)\
**Post date:** [April 12, 2019, 9:21am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/17 "2019-04-12T09:21:59Z")

</div>

Hey all,

What’s the status of the ROS2 rust bindings?  
This is a project that I would potentially be very interested in contributing as I am a big believer of rust in future robotics..

After taking a look at [GitHub - ros2-rust/ros2\_rust: Rust bindings for ROS 2](https://github.com/ros2-rust/ros2_rust) I gather that it’s not under active maintainance. Am I wrong? Is support for rust bindings at any point of your roadmap for ROS 2?

---

<div class="post-metadata">

**Author:** ![esteve](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/esteve/32/12_2.png) [@esteve](https://discourse.openrobotics.org/u/esteve)\
**Post date:** [April 12, 2019, 9:47am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/18 "2019-04-12T09:47:18Z")

</div>

It’s still somewhat maintained, unfortunately I haven’t been able to dedicate much time to continue development lately, but I’m more than happy to accept pull requests and tickets.

[Crystal and more by lelongg · Pull Request #3 · ros2-rust/ros2\_rust · GitHub](https://github.com/ros2-rust/ros2_rust/pull/3) is pending for merging which will add support for Crystal, but I’m waiting for some feedback to be addressed. I’ll make the changes myself in the following days if the submitter can’t do it.

---

<div class="post-metadata">

**Author:** ![bergercookie](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/bergercookie/32/3357_2.png) [@bergercookie](https://discourse.openrobotics.org/u/bergercookie)\
**Post date:** [April 12, 2019, 9:56am UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/19 "2019-04-12T09:56:42Z")

</div>

Hey @esteve,

Thanks for your work on this. 🙂  
I’ll take a look at the next couple of days

---

<div class="post-metadata">

**Author:** ![ruffsl](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/ruffsl/32/83_2.png) [@ruffsl](https://discourse.openrobotics.org/u/ruffsl)\
**Post date:** [October 27, 2020, 1:23pm UTC](https://discourse.openrobotics.org/t/announcing-rust-bindings-for-ros2/3870/20 "2020-10-27T13:23:56Z")

</div>

For folks still subscribed to this old thread, check here for more recent news about a Rust WG:

> **[Proposal: Rust Working Group for ROS](https://discourse.ros.org/t/proposal-rust-working-group-for-ros/16993)**
>
> TL;DR: Help empower everyone to build reliable and efficient ROS software with Rust!🦀🐢 Summary We’ve had several discussions come up in the past revolving around Rust support for ROS, and so, to help address those, I propose we setup a Rust...
