Expand description
A tf2-like transform library for roslibrust.
This crate provides a TransformManager that subscribes to /tf and /tf_static topics,
maintains a transform buffer using the transforms crate, and can publish transforms.
§Features
- Generic over roslibrust backends (ros1, rosbridge, zenoh, mock)
- Supports both ROS1 and ROS2 message formats
- Automatic subscription to
/tfand/tf_statictopics - Ability to publish transforms via
add_transform()
§ROS1 vs ROS2
The TransformManager is generic over the message type. Use the appropriate type alias
for your ROS version:
- ROS1:
TransformManager::<Ros1TFMessage, _>::new(&ros, buffer_duration) - ROS2:
TransformManager::<Ros2TFMessage, _>::new(&ros, buffer_duration)
§Example
use roslibrust_transforms::{Quaternion, Ros1TFMessage, Stamp, Timestamp, Transform, TransformManager, Vector3};
use roslibrust::traits::Ros;
// Generic over any roslibrust backend
async fn example<T: Ros>(ros: T)
{
let manager = TransformManager::<Ros1TFMessage, _>::new(&ros, std::time::Duration::from_secs(10)).await.unwrap();
// Look up a transform
let transform = manager.get_transform("base_link", "camera_link", Timestamp::now()).await.unwrap();
// Build an updated transform from its components
let updated = Transform::new(
transform.parent(),
transform.child(),
transform.translation() + Vector3::new(1.0, 0.0, 0.0),
transform.rotation(),
Stamp::At(Timestamp::now()),
)
.unwrap();
// Update the value in the buffer, and publish it's update to other nodes
manager.add_transform(updated).await.unwrap();
}Modules§
- messages
- Message type definitions for tf2_msgs.
Structs§
- Quaternion
- A quaternion representing a rotation in 3D space.
- Registry
- A registry for managing transforms between different frames. It can traverse the parent-child tree and calculate the final transform. It will interpolate between two entries if a time is requested that lies in between.
- Timestamp
- Default concrete time type used by this crate.
- Transform
- Where a child frame sits inside its parent frame, and when that holds.
- Transform
Manager - A manager that subscribes to /tf and /tf_static topics, maintains a transform buffer, and can publish transforms.
- Vector3
- A 3D vector with
x,y, andzcomponents.
Enums§
- Stamp
- When a transform is valid: at one instant, or for all time.
- Time
Error - Error type for timestamp and time-point operations.
- Transform
Error - Error type for building, composing, interpolating, and applying transforms.
- Transform
Manager Error - Error types for TransformManager operations.
Traits§
- From
Transform - Trait for converting a
transforms::Transformto a TransformStamped message. - Into
Transform - Trait for converting a TransformStamped message to a
transforms::Transform. - RosTimestamp
- Conversion between ROS header timestamps and transform timestamps.
- TFMessage
Type - Trait for TFMessage types that contain a list of TransformStamped messages.
- Time
Point - Trait describing time-point behavior required by the transform core.
Type Aliases§
- Ros1TF
Message - ROS1 TFMessage type alias for convenience.
- Ros1
Transform Stamped - ROS1 TransformStamped type alias for convenience.
- Ros2TF
Message - ROS2 TFMessage type alias for convenience.
- Ros2
Transform Stamped - ROS2 TransformStamped type alias for convenience.