Robot Arm Basics: Rotation and Translation

14 minute read

Published:

Last updated:

Learning from: It is Easier Than Solving Quadratic Equation (YouTube)

These are my notes on the video above, written the way I understand it. If you find a mistake, please email or message me.

1. Parts of a robot arm

Robot arm with base, joint and end effector
Fig 1. Base, joint and end effector.

A robot arm has three main parts:

  • Base: fixed to the ground.
  • Joints: the parts that rotate. Rigid links connect them. For example, the Franka arm has 7 joints and the Piper arm has 6.
  • End effector (EE): the tool at the tip of the arm. It can be a gripper, a pen, a laser, or anything else the task needs.

The end effector is not a joint. It is mounted after the last joint, and the arm moves it by moving its joints.

2. The question: where is the apple?

Fixed frame F at the base and moving frame M at the end effector
Fig 2. Fixed frame F and moving frame M.

We use two coordinate frames:

  • F (fixed frame): attached to the base. It never moves.
  • M (moving frame): attached to the end effector. It moves and rotates with the EE.

Suppose we know where the apple is as seen from M: the vector \(\vec{x}\). To control the robot we need the apple’s position as seen from F: the vector \(\vec{X}\). We want a transformation matrix \(T\) such that

\(\vec{X} = T\vec{x}\) where \(T\) is made of two parts: a translation (shift) and a rotation.

3. Pure translation

Pure translation example
Fig 3. Pure translation.

Suppose M is only shifted from F by a vector \(\vec{d}\), and its axes are still parallel to F’s axes. Then we just add the two vectors:

\[\vec{X} = \vec{x} + \vec{d}\]

Example: \(\vec{d} = (3, 2)\) and \(\vec{x} = (1, -1)\), so \(\vec{X} = (4, 1)\).

On a robot, \(\vec{d}\) is the link that goes from the origin of F to the origin of M.

4. Pure rotation

Now put M at the same origin as F, but rotate it by an angle \(\theta\) (counter-clockwise is positive). Where do M’s axes point when we look from F?

Rotating the x-axis of M
Fig 4. M's x-axis seen from F.

M’s x-axis. The unit vector \((1, 0)\) in M has length 1 and makes angle \(\theta\) with F’s x-axis. Right-triangle trigonometry gives \((\cos\theta, \sin\theta)\) in F. For example, with \(\theta = 90^\circ\) it becomes \((0, 1)\), pointing along F’s y-axis.

Rotating the y-axis of M
Fig 5. M's y-axis seen from F.

M’s y-axis. The unit vector \((0, 1)\) in M also turns by \(\theta\), so it leans to the left of F’s y-axis, toward negative x. It becomes \((-\sin\theta, \cos\theta)\). That is where the minus sign comes from.

Rotation matrix R
Fig 6. The rotation matrix R.

Put these two results side by side as columns and we get the rotation matrix:

\[R = \begin{bmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta\end{bmatrix}, \qquad \vec{X} = R\vec{x}\]

Each column of \(R\) is one axis of M written in F’s coordinates. For a clockwise rotation, use \(-\theta\): the minus sign then moves to the bottom-left entry.

5. Chaining two joints

Two frames M1 and M2 chained from F
Fig 7. Two joints, two moving frames.

A real arm has several joints, and each joint has its own frame. With two joints:

  • M1 is rotated by \(\theta_1\) and shifted by \(\vec{d}_1\) from F.
  • M2 is rotated by \(\theta_2\) and shifted by \(\vec{d}_2\) from M1 (both measured in M1).
  • And \(\vec{x}\) is the apple seen from M2.

We work from the tip back to the base, one frame at a time:

  1. Apple seen from M1: \(\vec{y} = R_2\vec{x} + \vec{d}_2\)
  2. Apple seen from F: \(\vec{X} = R_1\vec{y} + \vec{d}_1\)
Substituting y into X
Fig 8. Substituting one step into the next.

Substituting the first into the second:

\[\vec{X} = \underbrace{R_1R_2\vec{x}}_{\text{rotation}} + \underbrace{R_1\vec{d}_2 + \vec{d}_1}_{\text{translation}}\]
Total rotation angle equals theta1 plus theta2
Fig 9. In 2D, the angles add up.

Rotation. Let’s multiply \(R_1R_2\) out and see what we get.

First, a quick recall of the angle-sum and angle-difference formulas:

\[\begin{aligned} \cos(a + b) &= \cos a\cos b - \sin a\sin b \\ \cos(a - b) &= \cos a\cos b + \sin a\sin b \\ \sin(a + b) &= \sin a\cos b + \cos a\sin b \\ \sin(a - b) &= \sin a\cos b - \cos a\sin b \end{aligned}\]

Now multiply the two rotation matrices (row × column):

\[R_1R_2 = \begin{bmatrix}\cos\theta_1 & -\sin\theta_1 \\ \sin\theta_1 & \cos\theta_1\end{bmatrix}\begin{bmatrix}\cos\theta_2 & -\sin\theta_2 \\ \sin\theta_2 & \cos\theta_2\end{bmatrix}\] \[= \begin{bmatrix}\cos\theta_1\cos\theta_2 - \sin\theta_1\sin\theta_2 & -(\sin\theta_1\cos\theta_2 + \cos\theta_1\sin\theta_2) \\ \sin\theta_1\cos\theta_2 + \cos\theta_1\sin\theta_2 & \cos\theta_1\cos\theta_2 - \sin\theta_1\sin\theta_2\end{bmatrix}\]

Each entry matches one of the formulas above:

  • \[\cos\theta_1\cos\theta_2 - \sin\theta_1\sin\theta_2 = \cos(\theta_1 + \theta_2)\]
  • \[\sin\theta_1\cos\theta_2 + \cos\theta_1\sin\theta_2 = \sin(\theta_1 + \theta_2)\]

So:

\[R_1R_2 = \begin{bmatrix}\cos(\theta_1 + \theta_2) & -\sin(\theta_1 + \theta_2) \\ \sin(\theta_1 + \theta_2) & \cos(\theta_1 + \theta_2)\end{bmatrix} = R(\theta_1 + \theta_2)\]

This is just the rotation matrix for the angle \(\theta_1 + \theta_2\). So in 2D, the total rotation is the sum of the joint angles. (If a joint turns clockwise, its angle is negative, and the \(a - b\) formulas give the same result with \(\theta_1 - \theta_2\).)

Translation. The total shift is not simply \(\vec{d}_1 + \vec{d}_2\). Because \(\vec{d}_2\) is measured in M1, which is already rotated, we must rotate it first:

\[\vec{d} = \vec{d}_1 + R_1\vec{d}_2\]

6. One matrix for both: homogeneous coordinates

3x3 homogeneous transformation matrix
Fig 10. Rotation and translation in one matrix.

Rotation is a multiplication, but translation is an addition. To do both with a single matrix multiplication, add an extra 1 at the end of each vector and make the matrix 3×3:

\[\begin{bmatrix}X\\Y\\1\end{bmatrix} = \begin{bmatrix}\cos\theta & -\sin\theta & a\\ \sin\theta & \cos\theta & b\\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}\]

Multiply it out to check:

\[\begin{aligned} X &= x\cos\theta - y\sin\theta + a \\ Y &= x\sin\theta + y\cos\theta + b \\ 1 &= 1 \end{aligned}\]

This is exactly \(\vec{X} = R\vec{x} + \vec{d}\) with \(\vec{d} = (a, b)\). The extra 1 is not a real z-coordinate. It is a trick that lets us write a translation as a multiplication.

The payoff: a whole arm becomes a chain of matrix products, one matrix per joint:

\[\vec{X} = T_1 T_2 \cdots T_n \, \vec{x}\]

Summary

  • A robot arm = base + joints (connected by links) + end effector.
  • Translation: add \(\vec{d}\). Rotation: multiply by \(R\); the columns of \(R\) are M’s axes seen from F.
  • Chain frames from the tip back to the base: \(\vec{X} = R_1R_2\vec{x} + R_1\vec{d}_2 + \vec{d}_1\).
  • Homogeneous coordinates pack rotation and translation into one matrix (3×3 in 2D, 4×4 in 3D), so chaining joints is just multiplying matrices.
  • Adding angles only works in 2D. In 3D you must multiply the rotation matrices, and the order matters.

Revision history

  • : First published.
  • : Added the angle-sum formulas and a step-by-step derivation of R1R2 = R(θ1 + θ2).