ROS2 Transforms (TF2)

Implements ROS2 TF2 transform lookups and broadcasting with Clean Architecture in Python and C++.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill ros2-transforms-tf2-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ROS2 Transforms (TF2)
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/ros2_transforms
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill ros2-transforms-tf2-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It shows how to use the ROS2 TF2 transform library without leaking TF2 and geometry_msgs dependencies into the domain layer, keeping robotics business logic testable and framework-independent. ## Core Features & Use Cases - Clean Architecture Isolation: Domain entities (Pose, Point3D, Quaternion) are plain data structures with no ROS dependencies, while TF2 lives only in the infrastructure layer. - TF2 Wrapper Service: A C++ TFService implementing a domain ITransformService interface that wraps tf2_ros::Buffer and TransformListener, returning std::optionaldomain::entities::Pose. - Static Transform Broadcaster: A C++ helper using tf2_ros::StaticTransformBroadcaster to publish fixed frame relationships. - Use Case: When building a ROS2 robot application, use this pattern to look up transforms like base_link to camera_frame in infrastructure code while keeping use cases free of tf2_ros imports. ## Quick Start Ask the AI to implement a ROS2 TF2 transform lookup service following Clean Architecture so the domain layer has no tf2_ros dependency.

Frequently Asked Questions about ROS2 Transforms (TF2)

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I look up a transform between two frames in ROS2 C++?

Use tf2_ros::Buffer's lookupTransform with the target frame, source frame, and a time point, wrapped in a try-catch for tf2::TransformException. The result is a geometry_msgs::msg::TransformStamped containing translation and rotation.

How to use TF2 without coupling domain logic to ROS2?

Define plain domain entities like Pose with position, orientation, frame_id, and timestamp, plus an ITransformService interface. Implement the interface in the infrastructure layer with tf2_ros so domain use cases never import tf2_ros or geometry_msgs.

How do I publish a static transform in ROS2 C++?

Create a tf2_ros::StaticTransformBroadcaster with your node, fill a TransformStamped with parent frame, child frame, translation, and rotation, then call sendTransform. Static transforms are latched and published once.

Why does lookupTransform throw tf2::TransformException?

The exception occurs when the requested frames are not connected in the TF tree, the transform is not yet available at the requested time, or data is older than the buffer cache time, which defaults to about 10 seconds. Always catch it and handle the failure gracefully.

Should I use Time(0) or precise timestamps for TF2 lookups?

Time(0) returns the latest available transform and is convenient for general lookups. For data synchronization between sensors, use precise timestamps matching the message header so the transform corresponds to the exact measurement time.