ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Example project for embedding Rust in a C++ ROS 2 node

I just wanted to share a little proof-of-concept project that I worked on a while ago where I embedded Rust inside of a ROS 2 C++ node using the cxx crate. Admittedly, it’s not the most amazing of demonstrations (I just modified the example publisher), but I think it shows how Rust can be added into projects for those so inclined - at least until the official client library stabilizes.

Additionally, it shows the use of the corrosion crate to allow the Rust code to be built alongside the C++ code, and have all the code be built by colcon build!

Source code is here: https://github.com/jhdcs/rust_colcon_experiment

2 Likes