ME3120 · Dynamic Modelling
Theme 4 · Robot geometry

Frames & the rotation matrix

To write the energy of a real arm we first need to say exactly where each link is. It starts with one tool: a matrix that turns a vector by an angle.

Source: course notes, Week 3 (robot geometry); Spong, Lynch & Park.

Before you start

What you need first

  • Coordinates as a vector \(\begin{bmatrix}x\\y\end{bmatrix}\), and the joint angle \(\theta\) as a generalized coordinate.
  • \(\sin,\cos\) and the angle-addition rules.

What you'll be able to do

  • Describe a point as a position vector and tell frames apart.
  • Build the rotation matrix \(R(\theta)\) and use it to turn a vector.
  • Know its two handy properties.

Why geometry now?

The energy method (Theme 3) needs the position of every mass (for \(V=mgh\)) and its velocity (for \(T=\tfrac12 mv^2\)). For a robot, both depend on the joint angles \(q\).

$$\text{joint angles } q \;\longrightarrow\; \boxed{\text{forward kinematics}} \;\longrightarrow\; \text{where each link \& tip is}$$
Forward kinematics = given the joint angles, compute where every part of the robot is. This theme builds it; today we start with rotation.

A point is a position vector

A point in the plane is two numbers — its coordinates — written as a column vector from the origin:

$$\mathbf{p}=\begin{bmatrix}x\\ y\end{bmatrix}$$
We treat every point as a position vector: an arrow from the origin out to the point. Rotating or shifting the point means acting on this vector.
x y p = (x, y) x y
A point \(\mathbf{p}\) as a position vector from the origin.

Coordinate frames

x₀ y₀ ground x₁ y₁ θ
A link frame \((x_1,y_1)\) rotated by \(\theta\) from the fixed ground frame \((x_0,y_0)\).

A frame is a set of axes we measure from. A robot uses many: one fixed to the ground, and one riding on each link.

  • Ground frame — fixed to the base; the "world" we report answers in.
  • Link frame — glued to a moving link; simple for a point on that link.
The whole job: a point is easy to write in its link frame — we want it in the ground frame. For a revolute joint, the turn angle \(\theta\) is the joint variable \(q\).

The core move

Rotating a point by an angle \(\theta\)

Take a point \(\mathbf{p}=(x,y)\) and spin it about the origin by \(\theta\). It moves to \(\mathbf{p}'=(x',y')\) at the same distance \(r\), just turned. We want a formula for \((x',y')\).

x y p p′ r θ
Spin \(\mathbf{p}\) by \(\theta\) about the origin to get \(\mathbf{p}'\) — same length \(r\), new direction.

Derivation

Build the rotation formula

1Write \(\mathbf{p}\) in polar form — distance \(r\), angle \(\phi\):
$$x=r\cos\phi, \qquad y=r\sin\phi$$
2Rotating by \(\theta\) keeps \(r\) and adds \(\theta\) to the angle:
$$x'=r\cos(\phi+\theta), \qquad y'=r\sin(\phi+\theta)$$
3Expand with the angle-addition rules:
$$x'=r\cos\phi\cos\theta-r\sin\phi\sin\theta, \quad y'=r\sin\phi\cos\theta+r\cos\phi\sin\theta$$
4Substitute \(r\cos\phi=x\) and \(r\sin\phi=y\):
$$x'=x\cos\theta-y\sin\theta, \qquad y'=x\sin\theta+y\cos\theta$$

The rotation matrix \(R(\theta)\)

Write those two lines as one matrix multiply:

$$\begin{bmatrix}x'\\ y'\end{bmatrix}=\underbrace{\begin{bmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{bmatrix}}_{R(\theta)}\begin{bmatrix}x\\ y\end{bmatrix}$$
where:
SymbolMeaningSI unit
\(R(\theta)\)the rotation matrix (turns a vector by \(\theta\))
\(\theta\)rotation angle (positive = counter-clockwise)rad
\((x,y)\)original pointm
\((x',y')\)rotated pointm
Multiplying any vector by \(R(\theta)\) turns it by \(\theta\). This one matrix is the workhorse of all robot geometry.
📐 Worked example

Rotate the point \((3,1)\) by \(30^\circ\)

Find the new coordinates after turning \((3,1)\) about the origin by \(\theta=30^\circ\) (\(\cos 30^\circ=0.866,\ \sin 30^\circ=0.5\)).

1Build \(R(30^\circ)\):
$$R(30^\circ)=\begin{bmatrix}0.866 & -0.5\\ 0.5 & 0.866\end{bmatrix}$$
2Multiply by \(\begin{bmatrix}3\\1\end{bmatrix}\):
$$\begin{bmatrix}x'\\ y'\end{bmatrix}=\begin{bmatrix}0.866(3)-0.5(1)\\ 0.5(3)+0.866(1)\end{bmatrix}=\begin{bmatrix}2.10\\ 2.37\end{bmatrix}$$
The point swung counter-clockwise to \((2.10,\,2.37)\) — still the same distance \(\sqrt{3^2+1^2}=\sqrt{10}\) from the origin (check: \(\sqrt{2.10^2+2.37^2}\approx\sqrt{10}\) ✓).

Two handy facts about \(R(\theta)\)

Its columns are the new axes

Column 1 is where the old \(x\)-axis points after turning; column 2 is the new \(y\)-axis.

Undo with the transpose

\(R(-\theta)=R(\theta)^{\mathsf T}\) — rotating back is just swapping rows and columns.

These keep the algebra clean. For this course you mainly need to apply \(R(\theta)\) — but knowing the transpose undoes it is handy.

✏️ Try it yourself

Rotate the point \((4,0)\) by \(\theta=60^\circ\) about the origin (\(\cos 60^\circ=0.5,\ \sin 60^\circ=0.866\)).

Step 1. \(R(60^\circ)=\begin{bmatrix}0.5 & -0.866\\ 0.866 & 0.5\end{bmatrix}\) Step 2. \(\begin{bmatrix}x'\\ y'\end{bmatrix}=\begin{bmatrix}0.5(4)-0.866(0)\\ 0.866(4)+0.5(0)\end{bmatrix}=\begin{bmatrix}2.00\\ 3.46\end{bmatrix}\) Check. Distance stays \(4\): \(\sqrt{2^2+3.46^2}=\sqrt{4+12}=4\) ✓

Common mistakes to avoid

MistakeFix
Sign slip in \(R(\theta)\)The top-right entry is \(-\sin\theta\); bottom-left is \(+\sin\theta\).
Rotating with degrees in the matrixPut numeric \(\cos,\sin\) values in — they don't care about deg/rad, but your calculator must be in the right mode.
Swapping rows and columns of the pointThe point is a column \(\begin{bmatrix}x\\y\end{bmatrix}\); \(R\) multiplies it from the left.
Expecting the length to changeA pure rotation keeps \(r\) the same — a good sanity check.

Recap — the whole topic on one screen

$$\begin{bmatrix}x'\\ y'\end{bmatrix}=R(\theta)\begin{bmatrix}x\\ y\end{bmatrix}, \qquad R(\theta)=\begin{bmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{bmatrix}$$
IdeaWhat you own now
Point as a vector\(\mathbf{p}=\begin{bmatrix}x\\y\end{bmatrix}\) from the origin
FramesGround (fixed) vs link (rides the link)
Rotation matrix\(R(\theta)\) turns any vector by \(\theta\)
Two factsColumns = new axes; \(R(-\theta)=R^{\mathsf T}\)

Next topic

Homogeneous transforms & chaining

Rotation alone is not enough — a link is also shifted from the base. Next we fold rotation and shift into one matrix, the homogeneous transform \(T\), and chain them down an arm — which is forward kinematics.

→ Homogeneous transforms & chaining