Coordinate Frames
Practical
Terminal window
Terminal window
Coordinate frames (or reference frames) are the foundation for how robots understand position in space. A frame consists of an origin point and three orthogonal axes (x, y, z) that define directions of measurement. Every position, velocity, or orientation in robotics is defined relative to some frame.
What Is a Coordinate Frame?
A coordinate frame defines:
- An origin — the (0, 0, 0) point where measurements start
- Three orthogonal axes — x, y, z directions
- A handedness — typically right-handed in robotics
z (up) │ │ │ ●───────► y (left) /origin / ↙ x (forward)
Right-Hand Rule (ROS Convention)Frames can be fixed (attached to the world) or moving (attached to a robot or sensor).
Why Frames Matter
- Sensors report locally: A camera sees objects in its frame — you must transform to the robot frame to act
- Multiple perspectives: “1 meter to the left” depends on whose left
- Kinematic chains: Robot arms have frames for each link: base → link1 → link2 → gripper
- Sensor fusion: Without consistent frames, you can’t combine data from multiple sensors
Standard Frames in Robotics
map ← World-fixed (SLAM corrected) └── odom ← Robot starting point (drifts over time) └── base_link ← Robot body center ├── camera_link │ └── camera_optical_frame ├── lidar_link └── arm_base └── ... → gripper_link| Frame | Description | ROS Name |
|---|---|---|
| World/Map | Fixed global reference, does not move | map |
| Odometry | Tracks motion from start, continuous but drifts | odom |
| Robot Base | Attached to robot body, moves with robot | base_link |
| Sensor | Local to each sensor (camera, LiDAR, IMU) | *_link |
| End-Effector | At gripper or tool tip | gripper_link |
Frame Conventions
Different systems use different axis conventions:
Convention X-axis Y-axis Z-axis Used By───────────────────────────────────────────────────────FLU (ROS) Forward Left Up ROS, ground robotsFRD Forward Right Down PX4, aircraftNED North East Down Aviation, GPSENU East North Up Geographic systemsCamera Right Down Forward Computer visionUSD/Graphics Right Up -Forward NVIDIA Isaac, BlenderTF2: The Frame Tree
ROS 2 uses TF2 to manage frames as a directed tree:
- Each frame has exactly one parent (except the root)
- No cycles — unambiguous path between any two frames
- Time-buffered — query where a frame was at a past time
Static vs Dynamic
- Static transforms (
/tf_static): Fixed relationships like sensor mounts - Dynamic transforms (
/tf): Changing relationships like odometry or joint positions
Working with Frames
Visualize the Frame Tree
# Generate PDF of current transform treeros2 run tf2_tools view_frames
# Print transform between two framesros2 run tf2_ros tf2_echo map base_linkPublish a Static Frame
ros2 run tf2_ros static_transform_publisher \ --x 0.1 --y 0.0 --z 0.2 \ --roll 0.0 --pitch 0.0 --yaw 0.0 \ --frame-id base_link \ --child-frame-id camera_linkQuery Frames in Python
import rclpyfrom rclpy.time import Timefrom tf2_ros import Buffer, TransformListener
rclpy.init()node = rclpy.create_node('frame_query')tf_buffer = Buffer()tf_listener = TransformListener(tf_buffer, node)
# Spin briefly to receive transformsrclpy.spin_once(node, timeout_sec=1.0)
# Check if transform existscan_transform = tf_buffer.can_transform('map', 'base_link', Time())print(f"Can transform map→base_link: {can_transform}")
# List all known framesprint(tf_buffer.all_frames_as_yaml())Common Mistakes
- Wrong frame assumption: Data is in a different frame than expected
- Forgetting camera conventions: Optical frames are oriented differently
- Ignoring time: Transforms change — use the correct timestamp
- Mixing conventions: ROS uses meters/radians, other systems may differ
Related Terms
Transforms Mathematical operations to convert between frames
Kinematics Computing positions through kinematic chains
Learn More
- TF2 Introduction Tutorial — Official ROS 2 TF2 tutorial
- Nav2 Transform Setup — Practical frame setup for navigation
- Articulated Robotics TF Tutorial — Beginner-friendly walkthrough