Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
tf2_rs
tf2_rs provides Rust bindings for a focused subset of ROS 2 TF2. It wraps
tf2::BufferCore through cxx, integrates with rclrs, and exposes Rust-first
types for transform lookup, listening, broadcasting, and PointCloud2
transforms.
Status
- Validated against ROS 2 Humble, Jazzy, Kilted, Lyrical, and Rolling. Iron is
not supported because it is end-of-life and current
rclrsno longer ships Iron bindings. - Recommended build path:
ament_cargoinside a sourced ROS 2 workspace. - Currently implemented
Transformablesupport:sensor_msgs::msg::PointCloud2. - This crate is not a full
tf2_rosreplacement yet; it covers the core pieces needed for TF lookup and a small set of transform operations from Rust.
Public API
The current crate surface is centered on these types:
BufferCore: store transforms, query availability, look them up, and apply them to supported message types.TransformListener: subscribe to/tfand/tf_staticand keep a sharedBufferCoreupdated.TransformBroadcasterandStaticTransformBroadcaster: publish transforms from Rust nodes.TransformStamped: owned Rust representation of a TF transform, with conversion to and fromgeometry_msgs::msg::TransformStamped.LookupTimeandTimeSpec: chooseLatest, a specific timestamp, or a timestamp taken from a message header.TransformAvailability: richer result for preflight checks viaBufferCore::check_transform.TransformableandHasHeader: traits used by supported transformable messages.Tf2Error: Rust error enum for TF lookup, connectivity, extrapolation, and argument failures.
Frame semantics follow TF2: lookup_transform(target, source, when) returns the
transform target <- source, which is the transform you use to express data
from source in target.
Requirements
- ROS 2 installed locally and sourceable from
/opt/ros/<distro>/setup.bash - Rust 1.88 or newer
cargo,colcon,rosdep, and a C++17-capable compilerrosidl_generator_rsand the generated Rust interfaces from the selected ROS installationcolcon-cargoandcolcon-ros-cargo
build.rs reads ROS_DISTRO and AMENT_PREFIX_PATH. If your shell is not
sourced before building, the crate will fail to compile.
Installation
From crates.io (recommended)
In your own ament_cargo package, add tf2_rs next to the rclrs and
ros-env versions it is built against:
[]
= "0.1"
= "0.8"
= "0.3"
tf2_rs compiles a small C++ wrapper against the TF2 headers of your ROS
installation, so your package.xml also needs the packages it uses:
geometry_msgs
sensor_msgs
std_msgs
tf2
tf2_geometry_msgs
tf2_msgs
tf2_sensor_msgs
Then build your workspace as usual from a sourced shell:
API documentation is published at https://olingo99.github.io/tf2_rs/. docs.rs cannot build this crate because it needs a ROS installation.
From source
Current ROS binary installations from Humble through Rolling contain the Rust
generator and generated interfaces needed by ros-env, so no source message
repositories or geometry2 checkout are required. For example, on Jazzy:
With Docker
docker/Dockerfile builds the repository against any supported distribution
without installing ROS or Rust locally. From the repository root:
Usage
Manual transform insertion and lookup
use Duration;
use ;
Listen on /tf and transform a PointCloud2
TransformListener owns the subscriptions that populate the buffer, so it must
be kept alive for as long as you want TF updates.
use Duration;
use ;
use PointCloud2;
use ;
If you want lower-level control, call lookup_transform(...) yourself and then
use msg.apply_transform(&tf) on any type that implements Transformable.
Citation
The paper describing this work, tf2_rs: Bringing tf2 to
Rust, was published in the
Proceedings of the 8th International Workshop on Robotics Software Engineering
(RoSE 2026). If you use tf2_rs in academic
work, please cite:
Contributing
Issues and PRs are welcome.
CI builds and tests every push and pull request on Humble, Jazzy, Kilted,
Lyrical and Rolling. Releases are described in RELEASING.md.
License
MIT. See LICENSE.