Software
r2r
By Sequence Planner, from github.com/sequenceplanner/r2r (opens in a new tab)
- Middleware
- Library
- MIT AND Apache-2.0
Rust bindings for ROS2 that build with cargo alone, without hooking into the ROS2 build system. They offer async APIs based on futures and streams.
Facts
- GitHub stars
- 443read on 6 Nov 2026
- Last update
- 13 Sept 2026Newest commit on master
- Maintenance
- Activea commit in the last 90 days
- Difficulty
- Intermediate
Checked on GitHub on 6 Nov 2026.
Licenses
- Code
- MIT (opens in a new tab) AND Apache-2.0 (opens in a new tab)
Read by Robotheca from LICENSE (opens in a new tab) (Apache-2.0) at commit 653167a (opens in a new tab), on 16 Oct 2026. A person at Robotheca set it on 9 Nov 2026.
- Commercial use
- Yes
Overview
What it does: Robotheca's summary
- Generates Rust message types from the C introspection libraries of the ROS2 installation, so no separate .msg/.idl build step is needed.
- Supports publish/subscribe, services, actions, and parameter handling.
- Uses Rust futures and streams instead of synchronous callbacks, and does not pick an async runtime, leaving task spawning to the user.
- Can limit which message packages are built with the IDL_PACKAGE_FILTER environment variable to reduce build time.
- Tracks recent ROS2 distributions, from Foxy through Jazzy and Lyrical.
- Works with simulated time when rosgraph_msgs is sourced at build time.
Written by Robotheca from the project's README (opens in a new tab) at commit 653167a, not by its creator.
The README
The creator's own README, copied as written: README.md by Sequence Planner, at commit 653167a, under MIT AND Apache-2.0 (opens in a new tab). The original on GitHub (opens in a new tab).
Read the README here
R2R - Easy to use, runtime-agnostic, async rust bindings for ROS2.
Easy to use bindings for ROS2 that do not require hooking in to the ROS2 build infrastructure -- cargo build is all you need. Convenience Rust types are created by calling into the c introspection libraries. This circumvents the ROS2 .msg/.idl pipeline by relying on already generated C code. By default, the behavior is to build bindings to the RCL and all message types that can be found in the currently sourced ros environment, but it is possible to be more specific to save on build time (see note below).
When integration with the colcon build system is desired, a CMakeLists.txt file can be used to limit the generation of bindings to only include specific (idl) dependencies. This is done through additional environment variables. A minimal example of the colcon integration is available here: https://github.com/m-dahl/r2r_minimal_node (opens in a new tab).
This library differ a bit in style from rclpy and rclcpp as it eliminates all synchronous callbacks in favor of rust futures and streams. Coupled with the rust await syntax, this makes it very pleasant to work with ROS services and actions, even in a single threaded setup (see service.rs example). The library purposefully does not chose an async runtime -- this means that the user needs to take care of any task spawning. This also limits the API to what futures-rs provides.
Documentation can be found on docs.rs: https://docs.rs/r2r/latest/r2r (opens in a new tab).
These bindings are being written organically when things are needed by me and others so please be aware that the API will change. As of now I have no intention of wrapping all of the RCL just for the sake of completeness. However, if you need some specific functionality, feel free to open an issue or a PR!
How to use
- Make sure you have libclang installed. (e.g. libclang-dev on ubuntu)
- Depend on this package in Cargo.toml:
r2r = "0.9.7" - You need to source your ROS2 installation before building/running.
- The bindings will rebuild automatically if/when you source your workspace(s).
- If you make changes to existing message types, run
cargo clean -p r2r_msg_gento force recompilation of the rust message types on the next build.
Examples of how to use the crate are included in examples/
. /opt/ros/humble/setup.sh
cargo build
cargo run --example subscriber
# In other shell
ros2 topic pub /topic std_msgs/msg/String "data: 'Hello, world'"
A note on build times
Since the default behavior is to build all sourced message types, build time can quickly become a problem for larger workspaces. To avoid building everything, it is possible to declare only the message packages needed using the environment variable IDL_PACKAGE_FILTER. Setting this can be done in .cargo/config.toml for convenience, e.g. https://github.com/m-dahl/r2r_minimal_node/blob/master/r2r_minimal_node/.cargo/config.toml (opens in a new tab). Note there is no automatic dependency resolution done for nested message types, so all used message packages need to be explicitly included.
What works?
- Up to date with ROS2
DashingEloquentFoxy Galactic Humble Iron Jazzy Lyrical - Building Rust types
- Publish/subscribe
- Services
- Actions
- Parameter handling
- Simulated time (make sure
rosgraph_msgsis sourced when building to enable) - Runs on Linux, OSX, and Windows.
Changelog
[Unreleased]
[0.9.7] - 2026-09-13
- Bump bindgen version to fix errors with LLVM 22 and later https://github.com/sequenceplanner/r2r/pull/133 (opens in a new tab).
[0.9.6] - 2025-06-04
- rcl_timer_init wrapper to compile for Foxy Galactic Humble Iron Jazzy and Lyrical
[0.9.5] - 2025-04-22
- Add
/set_parameters_atomicallyhttps://github.com/sequenceplanner/r2r/pull/120 (opens in a new tab), https://github.com/sequenceplanner/r2r/pull/121 (opens in a new tab). Fixesros2 param ...on Jazzy. - Update bindgen 0.63.0 -> 0.71.1 https://github.com/sequenceplanner/r2r/pull/116 (opens in a new tab). (Issues may persist until next bindgen version, see PR).
[0.9.4] - 2024-11-21
- Fix cargo syntax for older rust versions < 1.77 https://github.com/sequenceplanner/r2r/commit/74ad4410c79b1be7e42eb1822a291639e3c40ec4 (opens in a new tab)
- Fix message generation for WChar idl type https://github.com/sequenceplanner/r2r/commit/94db799db282c8b1e0222f1699e6a6420b5fd544 (opens in a new tab)
[0.9.3] - 2024-11-09
- Expose WrongParameterType https://github.com/sequenceplanner/r2r/pull/111 (opens in a new tab)
- Add functions to destroy a publisher https://github.com/sequenceplanner/r2r/pull/110 (opens in a new tab)
[0.9.2] - 2024-10-13
- Fix cfg warnings https://github.com/sequenceplanner/r2r/commit/4cb5bd362e81154924cc7dc21f8edbf470c4604a (opens in a new tab)
- More convinent one time parameter access https://github.com/sequenceplanner/r2r/pull/107 (opens in a new tab)
[0.9.1] - 2024-10-12
- Minor code fixes: https://github.com/sequenceplanner/r2r/pull/105 (opens in a new tab), https://github.com/sequenceplanner/r2r/pull/106 (opens in a new tab)
- Update for ros2 jazzy https://github.com/sequenceplanner/r2r/pull/100 (opens in a new tab)
[0.9.0] - 2024-05-17
- Fix unsafe precondition(s) violated with rust 1.78 https://github.com/sequenceplanner/r2r/issues/96 (opens in a new tab). There may be more of these to fix, please report if you encounter.
- Expose QoS settings for service clients and servers https://github.com/sequenceplanner/r2r/pull/95 (opens in a new tab). Note, slight API change!
- Make the order of parameters deterministic https://github.com/sequenceplanner/r2r/pull/94 (opens in a new tab)
- Add a r2r_info example to print environmental information https://github.com/sequenceplanner/r2r/pull/92 (opens in a new tab)
- Code cleanups https://github.com/sequenceplanner/r2r/pull/90 (opens in a new tab), https://github.com/sequenceplanner/r2r/pull/91 (opens in a new tab)
- Remove is_available's node mut-ref dependency https://github.com/sequenceplanner/r2r/pull/89 (opens in a new tab). Note, slight API change!
- Support simulated time https://github.com/sequenceplanner/r2r/pull/88 (opens in a new tab)
[0.8.4] - 2024-03-19
- Fix QoS for rolling https://github.com/sequenceplanner/r2r/pull/87 (opens in a new tab)
- Update for ros2 iron https://github.com/sequenceplanner/r2r/pull/84 (opens in a new tab)
[0.8.3] - 2024-01-14
- Add
get_publishers_info_by_topichttps://github.com/sequenceplanner/r2r/pull/80 (opens in a new tab) - Raw publishers https://github.com/sequenceplanner/r2r/pull/76 (opens in a new tab)
- Add
rcl_publisher_get_subscription_countrelated methods https://github.com/sequenceplanner/r2r/pull/75 (opens in a new tab) - From serialized bytes for
WrappedNativeMsgUntypedhttps://github.com/sequenceplanner/r2r/commit/d5f2ef0eac7072c66fe8866a3dbbfc2326b13804 (opens in a new tab) - Message (de-)serialization helpers https://github.com/sequenceplanner/r2r/pull/74 (opens in a new tab).
- Raw message subscribers. https://github.com/sequenceplanner/r2r/pull/73 (opens in a new tab)
[0.8.2] - 2023-12-11
- Fix include path regression on linux. https://github.com/sequenceplanner/r2r/pull/71 (opens in a new tab)
[0.8.1] - 2023-11-30
- Fix regression when building with colcon/cmake. https://github.com/sequenceplanner/r2r/commit/7fc96e3eb2fd9f7f272258e07204041aeecfba76 (opens in a new tab)
[0.8.0] - 2023-10-05
- Windows support! https://github.com/sequenceplanner/r2r/pull/66 (opens in a new tab)
- Derive macro for ros parameters. https://github.com/sequenceplanner/r2r/pull/65 (opens in a new tab) and https://github.com/sequenceplanner/r2r/pull/68 (opens in a new tab). NOTE: Breaks old parameters API, see commit message for details https://github.com/sequenceplanner/r2r/commit/00d7a3db0b48c27a61ce153b084eadeef799765a (opens in a new tab).
- Implement rcl_interfaces::srv::ListParameters service. https://github.com/sequenceplanner/r2r/pull/64 (opens in a new tab)
- Eliminate compiler warnings about virtual workspace's resolver. https://github.com/sequenceplanner/r2r/pull/63 (opens in a new tab)
[0.7.5] - 2023-06-27
- Fix issue with snake case conversion for idl header files. https://github.com/sequenceplanner/r2r/pull/61 (opens in a new tab)
- Fix build issue with race condition between header file generation and calling bindgen. https://github.com/sequenceplanner/r2r/commit/f5f41baa2554b24813cc2f212ecf2e45476063e1 (opens in a new tab)
[0.7.4] - 2023-06-26
- Refactor code generation using syn and quote and improve build times https://github.com/sequenceplanner/r2r/pull/58 (opens in a new tab)
- Replace (e)println with log https://github.com/sequenceplanner/r2r/pull/51 (opens in a new tab)
[0.7.3] - 2023-06-20
- Fix mistake in docs generation.
[0.7.2] - 2023-06-20
- Various CI improvements: https://github.com/sequenceplanner/r2r/pull/54 (opens in a new tab), https://github.com/sequenceplanner/r2r/pull/56 (opens in a new tab)
- Fix build problem at docs.rs https://github.com/sequenceplanner/r2r/pull/56 (opens in a new tab)
- Clarify compilation flags related to build time in README.md as suggested in https://github.com/sequenceplanner/r2r/issues/53 (opens in a new tab)
[0.7.1] - 2023-05-21
- Add associated constants to generated message types. https://github.com/sequenceplanner/r2r/pull/46 (opens in a new tab)
- Log loaned message error only once. https://github.com/sequenceplanner/r2r/pull/44 (opens in a new tab)
- Update r2r_cargo.cmake to latest version (see here (opens in a new tab))
[0.7.0] - 2023-03-21
- Use non-mangled names for serde serialization. https://github.com/sequenceplanner/r2r/pull/40 (opens in a new tab)
- Avoid segfault when rcl_init fails. https://github.com/sequenceplanner/r2r/pull/41 (opens in a new tab)
- Loaned message support. (Changes
publish_nativeapi). https://github.com/sequenceplanner/r2r/pull/42 (opens in a new tab)
[0.6.7] - 2023-02-20
- Fix undeclared type on Foxy. https://github.com/sequenceplanner/r2r/pull/39 (opens in a new tab)
TODO
- Documentation is lacking. (For now, look at the examples.)
LICENSING
All code is under the MIT licence unless another license is specified in the source files. Some parts from the rclrust (https://github.com/rclrust/rclrust (opens in a new tab)) package are included in this repo and these are licensed under Apache 2.0.
Image: rosin_logo (opens in a new tab) (opens in a new tab)
Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu (opens in a new tab)
Image: eu_flag (opens in a new tab)
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.
Files and versions
- Repository on GitHubgithub.com/sequenceplanner/r2r (opens in a new tab)
- The version Robotheca read653167a (opens in a new tab)
- Latest releaseNone published on GitHub
Robotheca never hosts the code: each link goes to the creator's own page.
Use it
How to install it, in the creator's words: The project's README (opens in a new tab)
Robotheca doesn't review code. Read it before running it.
Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.