TL;DR:
A frame is a set of axes and an origin attached to something, such as a camera or a robot base.
A transform converts a point from one frame to another with a rotation followed by a translation.
Transforms chain: to go from camera to world, apply camera to base, then base to world.
A camera on a robot sees a cup and reports that it is 0.6 meters ahead. The arm needs to know where the cup is relative to the arm's own base. Same cup, same moment, but the numbers are different in each frame, and mixing them up is one of the most common bugs in robotics.
What frames do on a robot
A coordinate frame is an origin plus three perpendicular axes, attached to a thing. A robot has many: the world, the robot's base, each joint, the camera, the gripper. A position such as (0.8, −0.1, 0.45) means nothing until you say which frame it is in.
Common conventions help. For a robot base, x usually points forward, y left and z up. For a camera's optical frame, x usually points right, y down and z forward along the viewing direction. These two are different, which is the heart of the worked example.
Translation and rotation
Moving a point from frame A to frame B needs two things. A rotation R that re-expresses the axes, and a translation t that is the position of one origin relative to the other. A point p in the camera frame becomes p' = R·p + t in the base frame, where R and t describe the camera's pose in the base frame.
Rotations are not commutative. Rotating 90 degrees about x and then about z gives a different result than the reverse. Order matters, and so does the choice of whether you rotate the object or the frame.
Worked example: a camera seeing a cup, converted to the robot's base frame
The camera is mounted 0.2 m ahead of the base origin and 0.5 m above it, looking straight forward and level. It sees a cup at (0.10, 0.05, 0.60) m in its optical frame: 0.10 right, 0.05 down, 0.60 forward.
Match the axes. Camera forward (z) is base forward (x). Camera right (x) is base right, which is −y. Camera down (y) is base down, which is −z.
So the rotation maps
(x_c, y_c, z_c)to(z_c, −x_c, −y_c). Applied to the cup:(0.60, −0.10, −0.05).Add the camera's position in the base frame,
t = (0.2, 0, 0.5):(0.60 + 0.2, −0.10 + 0, −0.05 + 0.5) = (0.80, −0.10, 0.45).The cup is 0.80 m ahead of the base, 0.10 m to its right, and 0.45 m above the base origin.
Sanity checks. The cup is 0.05 m below the camera's centre line, and the camera is 0.5 m up, so the cup is at 0.5 − 0.05 = 0.45 m, which matches. The distance from the camera to the cup is √(0.10² + 0.05² + 0.60²) = √0.3725 ≈ 0.610 m. The distance between the two points in the base frame should be the same: the camera in the base frame is (0.2, 0, 0.5), and the offset to the cup is (0.6, −0.1, −0.05), which has the same length. A rotation never changes a distance, so this check catches many mistakes.
Chains of transforms
Frames are linked in a tree: world, then base, then camera, or world, then base, then each joint, then gripper. To go across several steps, apply the transforms one after another. Say the base sits in the world frame at (1, 2) and is turned 90 degrees to the left. The cup's horizontal position in base is (0.80, −0.10).
Rotate by 90 degrees counterclockwise:
(x, y)becomes(−y, x), so(0.80, −0.10)becomes(0.10, 0.80).Add the base position:
(0.10 + 1, 0.80 + 2) = (1.10, 2.80).The cup is at
(1.10, 2.80)m in the world frame.
Check it: the base is facing +y in the world, so 0.8 m ahead of the base should be about 0.8 m up in y, and 0.1 m to its right should be +0.1 in x. That fits. To go the other way, from world to camera, you apply the inverse of each transform in reverse order.
Where it goes wrong
Unknown frame. A number with no frame is unusable. Name the frame in variables, such as
cup_in_base.Wrong direction. The pose of A in B and the pose of B in A are inverses of each other. Mixing them up gives results mirrored in odd ways.
Wrong order. Applying two rotations in the wrong order gives a confident wrong answer.
Degrees versus radians. Most libraries expect radians.
Stale timing. A frame that moves (an arm) must be looked up at the time the camera image was taken, not now.
Optical versus body convention. Treating a camera frame as if it followed the robot convention is the classic error.
Safety: A frame mistake can send an arm to the wrong place at full speed. On the first test, command a slow move to a point above the table, not onto it, and keep the emergency stop within reach.
How real robots use it
Robot software keeps a tree of frames and publishes each frame's pose over time, so any node can ask for the transform between two frames at a given moment. The robot description, such as the one in URDF: describing a robot so software can use it, supplies the fixed parts. Joint angles supply the moving ones. Rotations in three dimensions are usually stored as quaternions, which is the topic of Euler angles vs quaternions.
Try it yourself
Put a cup on a desk and measure its position from the corner of the desk, with a ruler. Then pick a second frame: your laptop's corner, turned 90 degrees. Write the cup's position in that frame, then convert it back. You should end up with your original numbers. If not, a sign or a swap is wrong, and finding it by hand is the best way to remember it.
Frequently asked questions
Why use matrices for transforms?
A 4 by 4 matrix packs a rotation and a translation, so chaining transforms is one matrix multiplication per step.
Is the origin of a frame always at a physical point?
Usually it sits at a meaningful place such as the centre of a joint or the camera lens, chosen to make the numbers simple.
