r2r/README.md

2.8 KiB
Raw Blame History

R2R - Minimal ROS2 Rust bindings

Minimal bindings for ROS2 that do not require hooking in to the ROS2 build infrastructure. If you want a more ROS-oriented approach, see https://github.com/ros2-rust/ros2_rust. In these bindings, convenience Rust types are created by calling into the c introspection libraries to circumvent the .msg/.idl pipeline. The convenience types can be ignored when you need to trade convenience for performance, e.g. treating large chunks of data manually.

When integration with other ROS2 software is desired, instead of the default mode of r2r, which is to build bindings to RCL and messages depending on what is currently sourced, a CMakeLists.txt file can be used to limit the binding to only include specific dependencies. This is done through additional environment variables. See the minimal example at https://github.com/m-dahl/r2r_minimal_node/.

Manual is available on github pages https://sequenceplanner.github.io/r2r/

How to use

  1. Make sure you have libclang installed. (e.g. libclang-dev on ubuntu)
  2. Depend on this package: r2r = { git = "https://github.com/sequenceplanner/r2r" }.
  3. You need to source your ROS2 installation before building/running.
  4. The bindings will rebuild automatically if/when you source your workspace(s).
  5. If you make changes to existing message types, run cargo clean -p msg_gen to force recompilation of the rust message types on the next build.

A couple of examples are included in examples/

. /opt/ros/foxy/setup.sh
cargo build
cargo run --example subscriber_with_thread

An example application can be found here https://github.com/sequenceplanner/r2r-echo, which can be installed by running cargo install --git https://github.com/sequenceplanner/r2r-echo.

What works?

  • Up to date with ROS2 ~Dashing~ ~Eloquent~ Foxy
  • Building Rust types
  • Publish/subscribe
  • Services
  • Parameters

TODO

  • The code generation is currently just a big hack. Needs cleanup and refactoring.
  • Expose more of the RCL like QoS settings.
  • Action types?
  • Async API!

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Unions Horizon 2020 research and innovation programme under grant agreement no. 732287.