ROS2-021-ROS2 Tools: Coordinate Transforms (2) — The Common Internal Interface Messages
Introduction
From what the previous article said it isn't hard to see that a coordinate transform is, at heart, a publisher/subscriber model built on topic communication. The publishing side can publish the relative pose between frames, and the subscribing side can listen to those messages and carry out the transform between different frames. According to the bit about message interfaces in "ROS2-004-Communication Mechanisms: Topic Communication", in topic communication the interface message is a fairly important part of the whole communication model, since it is what carries the data.
This chapter introduces the two interface messages you will use most in coordinate transforms: geometry_msgs/msg/TransformStamped and geometry_msgs/msg/PointStamped.
The first describes the relative pose between two frames at a given moment; the second describes the position of a point inside a frame at a given moment. In the coordinate transforms that follow, we will use the relative pose between frames and information about points very often.
The exact definition format
We can use the ros2 interface show command to confirm the definitions of these two interfaces:
ros2 interface show geometry_msgs/msg/TransformStamped
ros2 interface show geometry_msgs/msg/PointStampedThe definitions look like this:
# This expresses a transform from coordinate frame header.frame_id
# to the coordinate frame child_frame_id at the time of header.stamp
#
# This message is mostly used by the
# <a href="https://docs.ros.org/en/rolling/p/tf2/">tf2</a> package.
# See its documentation for more information.
#
# The child_frame_id is necessary in addition to the frame_id
# in the Header to communicate the full reference for the transform
# in a self contained message.
# The frame id in the header is used as the reference frame of this transform.
std_msgs/Header header
builtin_interfaces/Time stamp # Time stamp
int32 sec
uint32 nanosec
string frame_id
# The frame id of the child frame to which this transform points.
string child_frame_id
# Translation and rotation in 3-dimensions of child_frame_id from header.frame_id.
Transform transform
Vector3 translation
float64 x
float64 y
float64 z
Quaternion rotation
float64 x 0
float64 y 0
float64 z 0
float64 w 1Note: Quaternion rotation here means a quaternion rotation. It doesn't describe a rotation the same way Euler angles do, but it can describe rotational problems very efficiently. TF2 internally integrates conversion functions for the two different descriptions, so when you rotate a frame you can just feed in Euler angles — no need to convert them to quaternions by hand.
# This represents a Point with reference coordinate frame and timestamp
std_msgs/Header header
builtin_interfaces/Time stamp
int32 sec
uint32 nanosec
string frame_id
Point point
float64 x
float64 y
float64 zImportant
This article was translated by Hermes Agent; the original text can be found at here. The translation is for reference only. Translation time: 2026-11-05
