Chapter 4: Matrix Equations in Robotics
Four hundred kilometres above the Earth, a robotic arm about seventeen metres long moves across the outside of the International Space Station. Canadarm2, built in Canada and installed on the station in 2001, has seven joints and a gripping mechanism at each end. Astronauts have used it to catch arriving supply craft, to move equipment weighing several tonnes, and to carry a spacewalking crew member to a work site.
Photograph
Fig. 4.0-1 – Canadarm2 extended from the exterior of the International Space Station, with the Earth visible behind it; the full length of the arm and at least one of its joints must be clearly visible, and one of the gripping mechanisms at the end of the arm must be identifiable in the frame. Source from NASA or Canadian Space Agency public image libraries; a rendering or an artist’s impression is not acceptable.
The arm has an unusual habit. It has no permanent base. To travel around the station, it grips a fixture with one end, releases the other, and swings itself over, end over end, like a caterpillar. The end that was moving becomes the end that is anchored.
Every time that happens, the arm’s software has to change its mind about what everything is measured from. The station has not moved. The arm’s numbers must move instead.
That is the problem this chapter solves. Positions in robotics are never absolute, and the mathematics that converts one point of view into another is written entirely in matrices.
Keep these five questions in mind as you read. Each one is answered somewhere in this chapter, at the point where you have learnt enough to see why the answer must be so.
4.1 Vectors, Points and Space
Ask someone where a switch is and they will point. Ask a robot the same question and it cannot point — it must answer with numbers. Those numbers are useless on their own. “Thirty centimetres” is not a position until you say thirty centimetres from what, and in which direction.
This is the first habit of thought that robotics demands. A position is never a property of an object by itself. It is a statement about an object and a set of axes you have agreed to measure from. Change the axes and every number changes, although the object has not stirred.
The rest of this chapter builds the machinery for changing those numbers safely. Before any of it works, you need a compact way to write a position down, and that is where we begin.
4.1.1 Describing a Position with a Vector
Fix a starting point in space and call it the origin. From the origin, draw three straight lines at right angles to one another and label them the x, y and z axes. Any point in the room can now be reached by travelling a certain distance along x, then along y, then along z.
Those three distances are the coordinates of the point. Taken together, they form a vector — a quantity that carries both a size and a direction, unlike a scalar, which carries only a size. Temperature is a scalar. Displacement is a vector.
A point P with coordinates \(P_x\), \(P_y\) and \(P_z\) is written in component form as
\[\vec{P} = a_x\hat{i} + a_y\hat{j} + a_z\hat{k}\]
where \(\hat{i}\), \(\hat{j}\) and \(\hat{k}\) are the unit vectors along the x, y and z axes — arrows of length one, whose only job is to say “this way”. The numbers \(a_x\), \(a_y\) and \(a_z\) say how far along each axis to go, and they carry the unit of length, usually mm or m. Fig. 4.1-1 shows the arrangement.
Diagram
Fig. 4.1-1 – a right-handed set of axes with origin O, axes labelled x, y and z; a point P in general position; the vector from O to P drawn as a solid arrow labelled P-vector; dashed projection lines dropped from P to each axis, with the three segments labelled a-x, a-y and a-z; the unit vectors i-hat, j-hat and k-hat drawn as short arrows on the three axes near the origin
A vector drawn from the origin to a point is called a position vector, because its whole purpose is to name where that point is. Its length is the straight-line distance from the origin to the point, and its direction is the line of sight along which you would look to see it.
The magnitude of a vector is its length, written \(|\vec{P}|\) and obtained by Pythagoras’ theorem extended to three dimensions:
\[|\vec{P}| = \sqrt{a_x^{\,2} + a_y^{\,2} + a_z^{\,2}}\]
For a robotic arm, this single number answers a practical question: how far from the base is the tool at this instant, and is that within the arm’s reach?
4.1.2 Vectors and Vector Spaces in Robotics
Vectors do three separate jobs in a robot, and it is worth separating them before they get mixed up.
The first is position, which you have just met. The second is direction — the way a gripper points, the line along which a sensor looks, the axis a joint turns about. Direction is carried by a vector of length one, obtained by dividing a vector by its own magnitude:
\[\hat{u} = \frac{\vec{v}}{|\vec{v}|}\]
The result keeps the direction of \(\vec{v}\) and throws away its size, which is exactly what you want when the size is irrelevant.
The third job is force. When a gripper presses on a component, the push has a strength in newtons and a direction in space, and both matter. Squeeze a glass tumbler with the right force in the wrong direction and it still slips.
Notice that direction vectors carry no unit at all. That is not an oversight — dividing metres by metres leaves a pure number, and a direction has no size to measure.
Adding vectors, and what a vector space is
Two forces acting on the same gripper jaw do not act one after the other. They act together, and their combined effect is found by adding them component by component. The same holds for displacements: a move of \(\vec{a}\) followed by a move of \(\vec{b}\) lands you at \(\vec{a} + \vec{b}\).
This is the property that makes the collection of all three-component vectors a vector space. Add any two members and the answer is still a member. Multiply any member by a number and the answer is still a member. Nothing you do with addition and scaling can take you outside the space.
The number of independent components a space needs is its dimension. Ordinary space needs three, so position and force live in a three-dimensional vector space. This is where the syllabus phrase “multi-dimensional tasks” earns its keep: an arm with six joints has six joint values to set at any instant, and that set of six numbers is a point in a six-dimensional space of its own. You will meet that idea properly when you study kinematics. For now, hold on to the smaller point — a space has as many dimensions as it needs independent numbers, and three is only the most familiar case.
Fig. 4.1-2 shows two forces applied to a gripper jaw and the single force that would have the same effect.
Diagram
Fig. 4.1-2 – a parallel-jaw gripper holding a small block; two force arrows applied at the same point on one jaw, labelled F1 and F2 and drawn in different directions; the resultant arrow drawn from the same point as a bolder arrow labelled R; the parallelogram of the two forces shown in fine dashed lines to indicate how R is obtained; the x, y and z axes of the gripper drawn at the corner of the figure for reference
4.1.3 Representing a Point as a Column Matrix
The form \(a_x\hat{i} + a_y\hat{j} + a_z\hat{k}\) is convenient to read, but it is awkward to compute with. The moment you want to rotate a point, or shift it, or do both to a hundred points in a row, you want an arrangement that a machine can process by a fixed rule.
That arrangement is a column matrix. The same three components are stacked vertically:
\[P = \begin{bmatrix} a_x \\ a_y \\ a_z \end{bmatrix}\]
Nothing has been added and nothing lost. The point is the same point; only the notation has changed. What the change buys you is the whole of matrix algebra, because a matrix written this way can be multiplied by another matrix, and — as the later sections will show — every movement a robot can make is a matrix multiplication.
The choice of a column rather than a row is a convention, but it is not an arbitrary one. Robotics writes the transformation on the left and the point on the right, as \(T \times P\), and for that product to be legal the point must be a column. A row would have to be written on the left of the transformation instead, which reverses the order of every calculation in the subject.
4.1.4 Homogeneous Coordinates and the Scale Factor
Three numbers are enough to name a point. Robotics nevertheless stores four, and the reason is worth understanding rather than accepting.
Rotating a point turns out to be a multiplication by a matrix. Shifting a point, on the face of it, is an addition. Two different operations mean two different rules, and a chain of ten joints would need them interleaved in the right order every time — a good source of mistakes and a poor thing to build hardware around.
The escape is to add one extra entry to the column, called the scale factor and written \(w\). The point is then stored as
\[P = \begin{bmatrix} a_x \\ a_y \\ a_z \\ w \end{bmatrix}\]
and its actual coordinates in space are recovered by dividing:
\[P_x = \frac{a_x}{w}, \qquad P_y = \frac{a_y}{w}, \qquad P_z = \frac{a_z}{w}\]
Coordinates written in this four-entry form are called homogeneous coordinates.
In almost all robotics work \(w\) is simply 1, so the first three entries are the coordinates themselves and the division changes nothing. The fourth entry is there to make the arithmetic uniform, not to make it harder.
What the scale factor actually does
It is tempting to read a scale factor of 2 as “the point has moved twice as far out”. It has not. Multiplying all four entries by the same number leaves the point exactly where it was, because the division by \(w\) undoes the multiplication.
\[\begin{bmatrix} 3 \\ 6 \\ 2 \\ 1 \end{bmatrix} \quad \text{and} \quad \begin{bmatrix} 12 \\ 24 \\ 8 \\ 4 \end{bmatrix} \quad \text{name the same point } (3,\ 6,\ 2)\]
What the scale factor changes is the size of the stored numbers, not the position they describe. That distinction matters when you read someone else’s data and find a fourth entry that is not 1: the point has not been enlarged, it has only been written differently.
The special case of w = 0
One value of \(w\) is not just a matter of bookkeeping. If \(w\) is zero, the division cannot be carried out, so the four numbers do not name any position at all. What survives is the ratio between the first three entries — in other words, a direction with no location attached.
Robotics uses this deliberately. A column ending in 1 is read as a point, which can be shifted about. A column ending in 0 is read as a direction, which cannot. When you later apply a transformation that both turns and shifts, the same matrix will correctly turn a direction without shifting it, purely because its last entry is 0. One matrix, two behaviours, no special cases in the software.
4.2 Frames and Reference Frames
Every number written in the previous section rested on an assumption that was never stated: that somebody had already fixed an origin and three axes. Until that is done, a coordinate is not merely unknown — it has no meaning at all.
In robotics the set of axes is not a piece of background scenery. There are many of them in a single machine, they move, and the whole subject consists of converting between them. So they are given a name, a symbol and a formal definition.
4.2.1 What a Frame Is
A frame is an origin together with three mutually perpendicular axes, labelled X, Y and Z. Perpendicular here is exact, not approximate: each axis makes a right angle with the other two, so that a distance measured along one contributes nothing to the other two.
Frames are written inside braces — {A}, {B}, {U} — so that a sentence can name a frame without confusion. A coordinate always belongs to a frame, and a careful engineer never writes one without knowing which.
Almost all robotics frames are right-handed, and the convention is worth learning with your hand rather than from a page. Point the fingers of your right hand along X and curl them towards Y; your extended thumb then points along Z. Fig. 4.2-1 shows the arrangement.
Diagram
Fig. 4.2-1 – left half: a right-handed frame with origin O and three axes labelled X, Y and Z drawn mutually perpendicular; right half: an outline of a right hand beside it, fingers pointing along X and curling towards Y, thumb extended along Z, with the three directions labelled to match the axes in the left half
The convention is a choice, but it must be the same choice everywhere in one machine. A frame set up left-handed by mistake reverses the sign of one axis, and a robot built on it will move correctly in two directions and backwards in the third.
4.2.2 The Universal Reference Frame
If every frame is described with respect to some other frame, the chain has to end somewhere. Robotics ends it by agreeing on one frame that everything else is ultimately measured from — a reference frame that is treated as the ground truth for the whole workspace.
The frame that sits at the top of this chain, in which all other frames are ultimately expressed, is called the universal reference frame. In a school workshop it might be the corner of the robotics bench, with its axes aligned to the edges of the bench and its Z axis pointing up from the floor. In a factory cell it is often a corner of the cell itself.
The choice is yours to make, and it is made for convenience. What matters is that it is made once, written down, and not quietly changed halfway through a project. Where a single arm is bolted to a table and nothing else in the cell matters, engineers often declare the base of the manipulator itself to be the universal frame and save a conversion.
4.2.3 Fixed Frames
A fixed frame is a frame that does not change with time. It is attached to something that does not move — the floor, the wall of a cell, the bench, or the bolted-down base of a robot — and it provides a stationary yardstick against which motion can be measured.
The frame attached to the bolted base of a manipulator is called the base frame, usually written {B}, and it is the fixed frame you will use most often. When a specification sheet says an arm can reach 850 mm, that reach is measured from the base frame; when a program commands the tool to (300, 200, 150) mm, the controller assumes those numbers are in the base frame unless told otherwise.
Notice that “fixed” describes a role, not a physical property. A frame is fixed because you have declared it to be the thing everything else is measured against for the duration of this calculation. Choose differently and a different frame becomes fixed.
4.2.4 Moving Frames, Joint Frames and the Tool Frame
A manipulator is built from rigid links connected by joints, and each of those parts turns and swings as the arm works. A frame attached to a part that moves is called a moving frame, and it travels with the part it is attached to.
Each link or joint carries its own local frame, describing its motion relative to the link before it. These are the joint frames, written {J1}, {J2} and so on, numbered outwards from the base.
The last frame in the chain is attached to the tool at the far end of the arm — the gripper, the welding head, the suction cup. That tool is called the end effector, and the frame attached to it is the tool frame or end-effector frame, written {E}. Fig. 4.2-2 shows the complete family on a single arm.
Diagram
Fig. 4.2-2 – a serial manipulator standing on a bench; five frames drawn as small sets of three labelled axes: {U} at the corner of the bench aligned with its edges, {B} at the bolted base of the arm, {J1} at the shoulder joint, {J2} at the elbow joint, and {E} at the gripper; {U} and {B} marked “fixed”, {J1}, {J2} and {E} marked “moving”; a small block on the bench with the target point P marked on it; curved arrows at {J1} and {J2} showing the sense of joint rotation
The end-effector frame carries the answer the whole machine exists to produce. Its origin says where the tool is; its axes say which way the tool is facing. Position and orientation taken together are called the pose of the end effector.
That combination is why frames cannot be avoided. A gripper at the right place but facing the wrong way will not pick anything up, so a robot that could compute position alone would still be useless.
4.2.5 Normal, Orientation and Approach Vectors
Saying that a tool frame has three axes is correct but unhelpful, because it does not say which axis is which. Robotics gives the three axes of the end-effector frame names taken from the job the tool does, and those names are worth memorising in the right order.
The approach vector, written \(a\), is aligned with the z-axis of the end-effector frame. It points along the direction in which the tool advances on its target. For a gripper it is the direction the jaws travel as they close on a component; for a drill it is the direction the bit goes in.
\[a = \begin{bmatrix} a_x \\ a_y \\ a_z \end{bmatrix}\]
The orientation vector, written \(o\), is aligned with the y-axis of the end-effector frame and describes the sideways alignment of the tool. For a parallel-jaw gripper it lies along the line joining the two jaws — the direction in which they open and close. Get the approach right and the orientation wrong and the jaws close along the length of the component instead of across it.
\[o = \begin{bmatrix} o_x \\ o_y \\ o_z \end{bmatrix}\]
The normal vector, written \(n\), is aligned with the x-axis of the end-effector frame and is perpendicular to both of the others. It is not chosen independently; it is whatever makes the three axes a right-handed set, and it is obtained from the other two by the cross product \(n = o \times a\).
\[n = \begin{bmatrix} n_x \\ n_y \\ n_z \end{bmatrix}\]
Fig. 4.2-3 shows all three on a parallel-jaw gripper approaching a block lying on a bench.
Diagram
Fig. 4.2-3 – a parallel-jaw gripper positioned above a rectangular block on a bench; three labelled unit-vector arrows drawn from the centre point between the jaws: a pointing down along the direction of approach towards the block, o pointing sideways along the line joining the two jaws, n pointing perpendicular to both; each arrow labelled with its name and the axis it corresponds to (a = z, o = y, n = x); the base frame {B} of the arm drawn in the corner for reference
4.2.6 Writing a Frame as a Matrix
The three vectors \(n\), \(o\) and \(a\) are unit vectors expressed in the reference frame, and together they contain everything there is to know about the tool’s orientation. Stack them side by side as columns and a frame becomes a matrix:
\[F = \begin{bmatrix} n_x & o_x & a_x \\ n_y & o_y & a_y \\ n_z & o_z & a_z \end{bmatrix}\]
Read this column by column and it says something plain: the first column is where the tool’s x-axis points, the second where its y-axis points, the third where its z-axis points — all measured in the reference frame.
But a frame has an origin as well as a direction, and a 3 × 3 matrix has no room for it. The origin is supplied by a fourth column holding the position of the tool frame’s origin, and the matrix is squared off by a fourth row:
\[F = \begin{bmatrix} n_x & o_x & a_x & P_x \\ n_y & o_y & a_y & P_y \\ n_z & o_z & a_z & P_z \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
The last row is not a piece of decoration. It exists so that the matrix is square and can be multiplied by, and combined with, other matrices of the same shape. Its three zeros keep it from interfering with the x, y and z directions, and its final 1 is the scale factor you met in section 4.1.4.
Read across the table and the structure of the whole chapter appears in outline. The left three columns are orientation, and they are what a rotation changes. The fourth column is position, and it is what a translation changes. Sections 4.5 and 4.6 take those two apart; section 4.7 puts them back together.
4.3 Matrix Operations Used in Robotics
So far a matrix has only been a tidy way of storing numbers. That is not why robotics uses them. A list would store numbers just as well.
Matrices earn their place because they can be operated on. Two of them can be combined by a fixed rule into a third, and — this is the point of the whole chapter — that rule turns out to be exactly what happens physically when one movement is followed by another. A robot’s motion is not merely described by matrix arithmetic; it obeys it.
This section sets out the operations you will need. Each is stated first as a rule and then as the physical statement it makes about a machine.
4.3.1 Matrix Addition and Multiplication by a Scalar
A matrix is a rectangular array of numbers. Its order is written as rows × columns, so a matrix with three rows and one column is of order 3 × 1, and the frame matrix of section 4.2.6 is of order 4 × 4. The entry in row \(i\) and column \(j\) is written \(a_{ij}\).
Two matrices are added by adding the entries that sit in the same position:
\[\begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix} + \begin{bmatrix} 3 \\ -1 \\ 4 \end{bmatrix} = \begin{bmatrix} 5 \\ 4 \\ 5 \end{bmatrix}\]
Addition is only defined when the two matrices have exactly the same order, and the reason is not a technicality. Position 3 in one column and position 3 in the other must mean the same thing — the z component of a force, say — or adding them is nonsense. If the orders differ, the entries do not correspond, and there is nothing to add.
You have already used this operation without calling it that. The resultant force in section 4.1.2 was a matrix addition, written in component form.
Multiplying a matrix by a scalar multiplies every entry by that number. Doubling a displacement column doubles the move in all three directions at once, which is what “twice as far in the same direction” should mean.
4.3.2 Matrix Multiplication and Why Order Matters
Multiplication is where matrices stop resembling ordinary numbers. Two matrices can be multiplied only if the number of columns in the first equals the number of rows in the second:
\[(m \times n) \times (n \times p) \ \longrightarrow \ (m \times p)\]
The two inner numbers must match and then disappear; the two outer numbers survive as the order of the answer. This single rule explains why a 4 × 4 transformation multiplied by a 4 × 1 point gives a 4 × 1 point — another point, ready to be transformed again.
Each entry of the product is formed from one row of the first matrix and one column of the second: multiply them term by term and add the results. Fig. 4.3-1 shows the pattern.
Diagram
Fig. 4.3-1 – schematic of matrix multiplication: a 2 × 3 matrix on the left and a 3 × 2 matrix on the right, with the product 2 × 2 matrix shown after the equals sign; the second row of the left matrix and the first column of the right matrix highlighted in a contrasting shade, with arrows leading from both into the entry in row 2, column 1 of the product; a caption line inside the figure showing that entry written out as the sum of three products; the inner dimensions labelled to show that they must match
The last line is the one that catches people out, so it is worth seeing in numbers.
What the order means physically
Stand at a doorway. Walk four paces forward, then turn ninety degrees to your right. Now go back to the doorway and do it the other way about — turn ninety degrees first, then walk four paces. You end up somewhere else, facing the same way. Fig. 4.3-2 shows both journeys on the workshop floor.
Diagram
Fig. 4.3-2 – a plan view of a workshop floor with a marked starting position and a small figure-of-a-robot symbol; two paths drawn from the same start: path 1 in a solid line goes straight forward four squares and then turns right, with the robot symbol at the end facing right; path 2 in a dashed line turns right first and then goes four squares, ending at a different position with the robot symbol facing the same direction; both end positions marked and labelled “move then turn” and “turn then move”
That is non-commutativity, and it is not a quirk of the notation. Rotating an arm and then extending it puts the tool in a different place from extending it and then rotating it. Because matrix multiplication behaves the same way, the algebra records the difference automatically instead of hiding it.
One convention follows from this and must be held firmly. When a chain of transformations acts on a point written as a column on the right, the matrix standing nearest the point acts first, and the one furthest to the left acts last.
4.3.3 Identity, Transpose and Inverse
Three particular matrices and operations come up constantly in transformation work.
The identity matrix
The identity matrix, written I, is a square matrix with ones down the leading diagonal and zeros everywhere else:
\[I = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}\]
Multiplying any matrix by I leaves it unchanged, which makes I the matrix equivalent of the number 1. In robotics it has a physical reading too: the identity is the transformation that does nothing — no turn and no shift. You will see it appear in the top-left corner of the pure translation matrix in section 4.5, and that is exactly what it is saying there.
The transpose
The transpose of a matrix, written \(A^{T}\), is obtained by turning its rows into columns:
\[\begin{bmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{bmatrix}^{T} = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}\]
It is a small operation with one very large use in this subject, which appears below.
The inverse
The inverse of a square matrix A, written \(A^{-1}\), is the matrix that satisfies
\[A \times A^{-1} = A^{-1} \times A = I\]
The inverse undoes what the matrix did. If a matrix takes a description of a point in the base frame and gives you its description in the tool frame, the inverse of that matrix takes you back the other way. Robots need this constantly: a camera reports where a component is in the camera’s own frame, and the controller must convert that into the base frame before the arm can be sent to fetch it.
Not every square matrix has an inverse. A matrix whose determinant is zero has none, and no amount of algebra will produce one. Physically, such a matrix has flattened space in some direction, and information that has been destroyed cannot be recovered.
The property that saves the most work
Here is a fact you will use in section 4.6, and it depends on section 4.2.6. The three direction columns of a frame matrix are unit vectors at right angles to one another. A matrix built from such columns has a remarkable property: its inverse is simply its transpose.
\[R^{-1} = R^{T}\]
Take the matrix that describes a frame turned by 90° about the z-axis, whose columns are still three perpendicular unit vectors:
\[R = \begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}, \qquad R^{T} = \begin{bmatrix} 0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}\]
\[R \times R^{T} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} = I\]
The product is the identity, so the transpose really is the inverse. Since transposing means copying nine numbers into different places while inverting in general means a long calculation, this is not a small saving. A robot controller recomputing frames hundreds of times a second depends on it.
4.3.4 Why Square Matrices Are Preferred
Robotics works almost entirely with 3 × 3 and 4 × 4 matrices, and there are three solid reasons for it.
The first is invertibility. Only a square matrix can have an inverse in the ordinary sense, so if you want to be able to convert a description back the way it came, square is not a preference but a requirement.
The second is compatibility for multiplication. Two matrices multiply only when the inner dimensions agree, and this condition is satisfied automatically whenever both matrices are square and of the same size. An arm with six joints contributes six transformation matrices, and they must all multiply together in a chain without a single mismatch.
The third follows from the second. If A and B are both \(m \times m\), then both AB and BA exist, and both are again \(m \times m\), so a result can always be fed into the next stage of a calculation. Note carefully what this does and does not say: both products exist and have the same size, but as section 4.3.2 showed, they are usually not equal.
The limitation of the 3 × 3 matrix
A 3 × 3 matrix multiplied into a 3 × 1 point can turn that point about the origin, and it can stretch or shrink it. What it cannot do is move it bodily across the table.
The reason is visible in the arithmetic. Every entry of the answer is built by multiplying the point’s own coordinates by numbers from the matrix. If the point happens to be at the origin, all its coordinates are zero, every product is zero, and the answer is the origin again. No 3 × 3 matrix, whatever its entries, can shift the origin anywhere — and shifting is precisely what a translation must do.
Translation therefore requires addition, and addition cannot be expressed within a pure 3 × 3 multiplication. That is the whole limitation, and section 4.7 shows how the extra row and column remove it.
4.4 Transformation in a Manipulator
So far the frames have stood still while you learnt to describe them. A working robot is nothing but frames in motion: the shoulder turns, the elbow swings, the tool frame travels across the bench, and every joint frame between them shifts as well.
Describing that motion in words is hopeless. Describing it as a change of one matrix into another is exact, and it is what the word transformation means in this subject.
4.4.1 What a Transformation Means
A transformation is a movement in space, expressed mathematically. It describes how a robotic arm, or any of its parts, goes from one position and orientation to another.
Two things can change when a body moves, and a transformation must account for both.
The first is translation — the shifting of a link or the end effector from one location to another, with the direction it faces left alone. The second is rotation, also called orientation change — the turning of a link or the end effector so that it faces a new direction, with the point it occupies left alone.
Any movement a manipulator can make is one of these, or both together. There is no third possibility for a rigid body.
In practice a transformation is applied at every joint and every link of the arm. Each joint contributes a matrix describing how its frame stands relative to the frame before it, and multiplying those matrices in order gives the position and orientation of the end effector with respect to the base frame. Fig. 4.4-1 shows the chain.
Diagram
Fig. 4.4-1 – a three-link manipulator drawn from base to gripper; frames marked at the base {B}, at each of the two joints {J1} and {J2}, and at the gripper {E}; between consecutive frames an arrow labelled with a transformation matrix, in order T1 from {B} to {J1}, T2 from {J1} to {J2}, T3 from {J2} to {E}; a single long arrow beneath the arm from {B} to {E} labelled as the product T1 × T2 × T3, showing that the whole chain reduces to one matrix
The single matrix at the bottom of that figure is the practical payoff. Whatever the arm’s shape, however many joints it carries, the pose of its tool with respect to its base is one 4 × 4 array — and it is obtained by multiplication, not by trigonometry repeated joint by joint.
4.4.2 Translation and Orientation Change
Take a concrete task. A small arm on a school workshop bench has a parallel-jaw gripper and must pick up a metal block lying flat on the bench.
The gripper starts at some rest position A, above and behind the block. To reach the block at position B, it must travel across and down, with its jaws still facing the way they faced at A. Nothing about its alignment has altered — only its location. That is translation.
Once the gripper is over the block, it is still facing forward, and jaws facing forward cannot pick up an object lying flat. So the gripper turns through 90° until the jaws point vertically downwards. During that turn the gripper stays over the same spot; only the directions of its axes change. That is an orientation change. Fig. 4.4-2 shows the two stages separately.
Diagram
Fig. 4.4-2 – two panels side by side on the same bench. Left panel labelled “translation”: a parallel-jaw gripper shown at position A and again at position B, the two drawings identical in alignment, joined by a straight arrow labelled d; the n, o, a axes drawn on both and clearly parallel. Right panel labelled “orientation change”: the gripper shown at position B in its forward-facing alignment and again at the same position turned through 90 degrees so the jaws point downwards, joined by a curved arrow labelled theta; the origin marked with a dot in both drawings to show it has not moved; a metal block lying flat on the bench beneath
Keeping these two apart is not fussiness. They are governed by different parts of the 4 × 4 matrix — translation by the fourth column, orientation by the upper-left three columns — and a fault in a robot’s behaviour is diagnosed much faster once you can say which of the two has gone wrong.
The next two sections take each case on its own. Section 4.5 builds the matrix for a movement that shifts without turning, and section 4.6 builds the matrix for one that turns without shifting. Section 4.7 combines them into the single form a controller actually uses.
4.5 Representation of Pure Translation
Of the two kinds of movement, translation is the simpler, and it is worth setting out completely before rotation complicates the picture.
When a frame — or an object, or the end effector carrying that frame — moves through space without changing the direction it faces, the motion is called pure translation.
The consequence is worth stating explicitly, because everything in this section follows from it. The nine direction entries \(n_x\), \(n_y\), \(n_z\), \(o_x\), \(o_y\), \(o_z\), \(a_x\), \(a_y\), \(a_z\) stay exactly as they were, since the frame has not turned. The only thing that changes is the position of the frame’s origin with respect to the reference frame.
4.5.1 The Translation Matrix
Suppose the frame moves through a distance whose components along the reference axes are \(d_x\), \(d_y\) and \(d_z\). Fig. 4.5-1 shows the situation: the frame at its new place is a copy of the frame at its old place, slid across.
Diagram
Fig. 4.5-1 – a reference frame with origin O and axes X, Y and Z; a small frame drawn at position P with its three axes labelled n, o and a; the same small frame drawn again at a new position, its axes labelled n, o and a and drawn clearly parallel to the first set; a straight arrow from the first origin to the second labelled d, with its three components d-x, d-y and d-z shown as dashed lines parallel to the reference axes
The transformation that produces this movement is written as a 4 × 4 matrix:
\[T = \begin{bmatrix} 1 & 0 & 0 & d_x \\ 0 & 1 & 0 & d_y \\ 0 & 0 & 1 & d_z \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
Read it against Table 4.3 and it explains itself. The upper-left 3 × 3 block is the identity matrix, and you met in section 4.3.3 what the identity means physically: no rotation at all. The fourth column holds the three components of the shift, in mm. The last row is the usual \(0\ 0\ 0\ 1\) that keeps the matrix square without disturbing the x, y and z directions.
Because writing the array out in full is tedious, this matrix is given a symbol:
\[T = \text{Trans}(d_x,\ d_y,\ d_z)\]
4.5.2 Translating a Point
To move a point, multiply its homogeneous column by the translation matrix. Writing the point as \(P\) and the moved point as \(P'\):
\[P' = \text{Trans}(d_x,\ d_y,\ d_z) \times P\]
Expanding the multiplication shows what the matrix is really doing:
\[\begin{bmatrix} 1 & 0 & 0 & d_x \\ 0 & 1 & 0 & d_y \\ 0 & 0 & 1 & d_z \\ 0 & 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} P_x \\ P_y \\ P_z \\ 1 \end{bmatrix} = \begin{bmatrix} P_x + d_x \\ P_y + d_y \\ P_z + d_z \\ 1 \end{bmatrix}\]
Each new coordinate is the old one plus the corresponding distance. That is ordinary addition, and you may reasonably ask what the matrix has bought. The answer is that it has bought a common language: translation is now written in the same form as rotation, so the two can be multiplied together and chained, which addition alone could never do.
Notice also where the addition comes from. The fourth entry of the point is 1, and it is that 1 which multiplies \(d_x\), \(d_y\) and \(d_z\) into the answer. Change it to 0 and the shift disappears:
\[\begin{bmatrix} 1 & 0 & 0 & d_x \\ 0 & 1 & 0 & d_y \\ 0 & 0 & 1 & d_z \\ 0 & 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 0 \\ 0 \\ -1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ -1 \\ 0 \end{bmatrix}\]
This is the behaviour promised in section 4.1.4. A column ending in 0 is a direction, and a direction should not be shifted — an approach vector pointing downwards still points downwards after the gripper has been carried across the bench. The same matrix handles points and directions correctly, with no extra instruction, purely because of the last entry.
4.5.3 Translating a Complete Frame
An end effector is not a bare point. It carries a frame, and moving it means moving all four columns of that frame’s matrix. The rule is unchanged — multiply on the left by the translation matrix:
\[F' = \text{Trans}(d_x,\ d_y,\ d_z) \times F\]
Carrying out the multiplication in general shows precisely which parts of the frame survive:
\[\begin{bmatrix} 1 & 0 & 0 & d_x \\ 0 & 1 & 0 & d_y \\ 0 & 0 & 1 & d_z \\ 0 & 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} n_x & o_x & a_x & P_x \\ n_y & o_y & a_y & P_y \\ n_z & o_z & a_z & P_z \\ 0 & 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} n_x & o_x & a_x & P_x + d_x \\ n_y & o_y & a_y & P_y + d_y \\ n_z & o_z & a_z & P_z + d_z \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
The first three columns come through untouched, because each of them ends in 0 and is therefore treated as a direction. Only the fourth column, which ends in 1, picks up the shift. The mathematics has separated orientation from position without being told to.
4.6 Representation of Pure Rotation
Translation was simple because nothing interfered with anything else: a shift along x had no effect on y or z. Rotation is not like that. Turning a frame about one axis redistributes coordinates between the other two, and the whole of this section is about how that redistribution is written down.
When a frame turns about an axis through its own origin, so that its origin stays where it is while its axes take up new directions, the motion is called pure rotation.
Throughout this section the reference frame and the rotating frame share an origin. A positive angle means a counter-clockwise turn as seen by someone looking back along the axis of rotation towards the origin — the same right-handed convention set up in section 4.2.1.
4.6.1 Rotation in a Plane
Start with the two-dimensional case, where the geometry can be seen at a glance. A point P lies at a distance \(r\) from the origin, at an angle \(\phi\) from the x-axis. Its coordinates are
\[x = r\cos\phi, \qquad y = r\sin\phi\]
Now turn the point counter-clockwise through an angle \(\theta\) about the origin, as in Fig. 4.6-1. It is still at distance \(r\) — turning does not move anything nearer or further — but its angle is now \(\phi + \theta\).
Diagram
Fig. 4.6-1 – a set of x and y axes with origin O; a point P at distance r from O, with the angle from the x-axis to OP marked as phi; the same point shown after rotation at P-dash, also at distance r, with the additional angle from OP to OP-dash marked as theta; an arc of a circle of radius r drawn through both points to show the distance is unchanged; the coordinates x, y dropped from P and x-dash, y-dash dropped from P-dash as dashed lines
\[x' = r\cos(\phi + \theta), \qquad y' = r\sin(\phi + \theta)\]
Expanding the two compound-angle formulae and substituting back gives
\[x' = r\cos\phi\cos\theta - r\sin\phi\sin\theta = x\cos\theta - y\sin\theta\] \[y' = r\sin\phi\cos\theta + r\cos\phi\sin\theta = x\sin\theta + y\cos\theta\]
Notice that \(r\) and \(\phi\) have vanished from the final expressions. The new coordinates depend only on the old coordinates and the angle turned through, which is precisely what makes a matrix possible:
\[\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix}\]
That 2 × 2 array is the rotation matrix in a plane, written \(\text{Rot}(\theta)\).
4.6.2 Rotation about the x-axis
In three dimensions a rotation must name the axis it turns about. Take that axis to be x first, and imagine the x-axis pointing out of the page towards you, with y and z in the plane of the page.
Let the reference frame be \(F_{Ref}\) and the rotating frame \(F_{Rot}\). The two share an origin and start out parallel, so before the rotation a point has the same coordinates in both. Call its coordinates in the rotating frame \(p_n\), \(p_o\) and \(p_a\), using the axis names from section 4.2.5, and its coordinates in the reference frame \(P_x\), \(P_y\) and \(P_z\).
Now turn \(F_{Rot}\) through an angle \(\theta\) about the shared x-axis. The point is fixed in the rotating frame and travels with it, so \(p_n\), \(p_o\) and \(p_a\) do not change at all. What changes is how that same point looks from the reference frame. Fig. 4.6-2 shows the geometry.
Diagram
Fig. 4.6-2 – the y and z axes of the reference frame drawn in the plane of the page, with the x-axis marked as coming out of the page towards the reader; the rotated frame’s o and a axes drawn turned through an angle theta from y and z respectively, with theta marked at the origin; a point P shown with its coordinates p-o and p-a measured along the rotated axes as dashed lines, and its coordinates P-y and P-z measured along the reference axes as dashed lines of a different style; right-angle marks where each dashed line meets its axis
Resolving the rotated components onto the reference axes gives
\[P_x = p_n\] \[P_y = p_o\cos\theta - p_a\sin\theta\] \[P_z = p_o\sin\theta + p_a\cos\theta\]
The first line says that the coordinate along the axis of rotation is untouched — turning about x cannot move anything along x. The other two lines are the plane rotation of section 4.6.1, acting in the yz-plane. In matrix form:
\[\begin{bmatrix} P_x \\ P_y \\ P_z \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta \\ 0 & \sin\theta & \cos\theta \end{bmatrix}\begin{bmatrix} p_n \\ p_o \\ p_a \end{bmatrix}\]
which is written compactly as
\[P_{xyz} = \text{Rot}(x,\ \theta) \times p_{noa}\]
Read that equation carefully, because it is easy to read backwards. It says: to obtain the coordinates of a point in the reference frame, take its coordinates in the rotated frame and multiply them by the rotation matrix. The matrix is the translator between the two frames.
To take its place beside the 4 × 4 translation matrix of section 4.5, \(\text{Rot}(x, \theta)\) is padded out with a fourth row and column:
\[\text{Rot}(x,\ \theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta & 0 \\ 0 & \sin\theta & \cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
The fourth column is all zeros because a pure rotation shifts nothing, and the last row is the familiar \(0\ 0\ 0\ 1\).
4.6.3 Rotation about the y-axis and the z-axis
The same argument, applied to the other two axes, gives the other two matrices. Rotation about y leaves the y coordinate alone and mixes z and x; rotation about z leaves the z coordinate alone and mixes x and y.
\[\text{Rot}(y,\ \theta) = \begin{bmatrix} \cos\theta & 0 & \sin\theta & 0 \\ 0 & 1 & 0 & 0 \\ -\sin\theta & 0 & \cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
\[\text{Rot}(z,\ \theta) = \begin{bmatrix} \cos\theta & -\sin\theta & 0 & 0 \\ \sin\theta & \cos\theta & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
Students often notice that the minus sign sits in a different place in the y matrix and suspect a misprint. It is not one. The axes follow a cyclic order — x to y to z and back to x — and each rotation acts on the next two axes in that order. Rotation about x acts on the pair (y, z), and rotation about z acts on the pair (x, y), so both take the pattern of section 4.6.1 directly. Rotation about y acts on the pair (z, x), which appears in the matrix as x above z, that is, in reverse order — and reversing the pair moves the minus sign to the other off-diagonal position.
4.6.4 Properties of a Rotation Matrix
Rotation matrices are not arbitrary arrays that happen to contain sines and cosines. They have a rigid internal structure, and knowing it lets you check your own work and lets a controller save a great deal of arithmetic.
The inverse property is worth seeing once in numbers. For the quarter turn about z used above, with the 3 × 3 block written out:
\[R = \begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}, \qquad R^{T} = \begin{bmatrix} 0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}, \qquad R^{T}R = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}\]
The transpose is the inverse, and it is also, read as a matrix in its own right, the rotation through \(-90^\circ\) about z. Undoing a turn and turning the other way are the same operation, which is reassuring rather than surprising.
4.7 The Homogeneous Transformation Matrix
Two matrices are now in hand. One shifts a frame without turning it; the other turns a frame without shifting it. A real arm does both at once, at every joint, all the time.
Keeping the two apart and applying them alternately would work, but it would mean two kinds of object, two rules and a fresh chance of error at every joint. The whole point of the fourth row and column is that it is unnecessary.
4.7.1 Combining Rotation and Translation
Look again at the two matrices of the previous sections. The translation matrix had an identity block in its upper-left corner and its shift in the fourth column. The rotation matrix had a rotation block in its upper-left corner and zeros in its fourth column. Neither used both regions at once — so put both to work.
\[T = \begin{bmatrix} R & d \\ 0 & 1 \end{bmatrix}\]
Here R is the 3 × 3 rotation matrix describing orientation, \(d\) is the 3 × 1 column describing position, and the bottom row is three zeros and a 1. Written out in full:
\[T = \begin{bmatrix} R_{3\times3} & d_{3\times1} \\ 0 \quad 0 \quad 0 & 1 \end{bmatrix}\]
A matrix of this form is called a homogeneous transformation matrix, and it is the central object of this chapter.
Suppose a gripper is turned about the z-axis by an angle \(\theta\) and moved to the point (3, 2, 0). Its transformation matrix is
\[T = \begin{bmatrix} \cos\theta & -\sin\theta & 0 & 3 \\ \sin\theta & \cos\theta & 0 & 2 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
One array, sixteen numbers, and the complete answer to “where is it and which way is it facing”.
4.7.2 Structure of the 4 × 4 Matrix
The matrix divides into three regions, and being able to point to them by name is worth more than being able to recite the whole array. Fig. 4.7-1 marks them out.
Diagram
Fig. 4.7-1 – a 4 by 4 grid of cells drawn large; the upper-left 3 by 3 block shaded and labelled “rotation: orientation of the frame’s axes, n o a”; the top three cells of the fourth column shaded differently and labelled “translation: position of the frame’s origin, in mm”; the bottom row’s first three cells labelled “three zeros: keep the last row from disturbing the x, y and z directions”; the bottom-right cell labelled “scale factor, normally 1”; a note at the side stating that each of the three rotation columns ends in 0 and is therefore read as a direction, while the fourth column ends in 1 and is read as a point
The three zeros in the last row are there so that the extra row required by the homogeneous system does not interfere with the x, y and z directions above it. The final 1 is the scale factor of section 4.1.4.
There is a deeper point in Fig. 4.7-1, and it is easy to miss because nothing new appears on the page. Compare it with the frame matrix of section 4.2.6. They are identical in shape: three direction columns, a position column, and \(0\ 0\ 0\ 1\) underneath.
That is not a coincidence. Saying “frame {E} stands here, oriented like this, with respect to frame {B}” and saying “this transformation carries {B} onto {E}” are two readings of the same sixteen numbers. A description of where something is and an instruction for how to get there are, in this notation, the same object.
4.7.3 Applying a Combined Transformation
Applying the matrix is the same operation as before. Write the point in homogeneous form and multiply on the left:
\[P' = T \times P\]
The result is a point that has been both turned and shifted, in one multiplication.
4.7.4 Composing Transformations Along an Arm
An arm has more than one joint, and each joint’s frame is described relative to the frame before it. Section 4.4.1 showed the chain; now it can be written down.
\[T_{BE} = T_1 \times T_2 \times T_3\]
Here \(T_1\) carries the base frame to the first joint frame, \(T_2\) carries the first joint frame to the second, and \(T_3\) carries the second joint frame to the end-effector frame. The single matrix \(T_{BE}\) that results describes the pose of the tool with respect to the base — and because multiplication is associative, a controller may form that product once and then reuse it for every point it must reach.
The order of the matrices is fixed and cannot be rearranged. Reading from right to left, the matrix nearest the point acts first; reading from left to right, the matrices appear in the order the frames occur along the arm, from base outwards.
The same reasoning explains the fixed order in the chain \(T_1 \times T_2 \times T_3\). Each matrix describes a frame relative to the one before it, so the sequence records the physical order in which the links are joined. Writing the elbow’s matrix before the shoulder’s does not describe a different arm; it describes no arm at all.
Finally, note that the whole chain can be undone. Since each \(T\) is square with a non-zero determinant, \(T_{BE}^{-1}\) exists, and it answers the reverse question: where is the base, as seen from the tool? A robot uses that inverse whenever a camera or a sensor mounted on the end effector reports a target in its own frame and the controller has to express it in the base frame before moving.
4.8 Summary
Points, vectors and space
- A position is never a property of an object alone. It is a statement about the object and the axes it is measured from, so a coordinate quoted without its frame carries no information.
- A vector has magnitude and direction; a scalar has magnitude only. A position vector runs from a stated origin to a point and names its location.
- Vectors do three jobs in a robot: they carry position, in mm or m; direction, as unit vectors of magnitude 1 and no unit; and force, in N.
- A vector space is a set of vectors closed under addition and under multiplication by a scalar. Ordinary space needs three independent components, but the joint values of a multi-jointed arm form a space of as many dimensions as there are joints.
- A point is stored as a column matrix so that a transformation can be written on its left and applied by multiplication.
Homogeneous coordinates
- Homogeneous coordinates store a point as four numbers, the first three being the coordinates multiplied by a scale factor \(w\) and the fourth being \(w\) itself. The coordinates are recovered as \(P_x = a_x/w\), \(P_y = a_y/w\), \(P_z = a_z/w\).
- Multiplying all four entries by the same number changes the stored numbers but not the point they name. In robotics \(w\) is normally 1.
- A column ending in 1 is read as a point, which a transformation may shift. A column ending in 0 is read as a direction, which it may not.
Frames
- A frame is an origin together with three mutually perpendicular axes X, Y and Z, and robotics frames are right-handed.
- A reference frame is the frame with respect to which another frame is described. The universal reference frame sits at the top of that chain and is the global system in which all other frames are ultimately expressed.
- A fixed frame does not change with time and is attached to the environment or to the robot’s bolted base. Being fixed is a role assigned for the duration of a calculation, not a property of the metal.
- A moving frame travels with the part it is attached to. The joint frames {J1}, {J2} … belong to the links and joints, and the tool or end-effector frame {E} belongs to the end effector.
- Position and orientation taken together are the pose of a body, stated with respect to a named reference frame.
The three axes of the end-effector frame
- The approach vector \(a\) lies along the z-axis of the end-effector frame and points the way the tool advances on its target.
- The orientation vector \(o\) lies along the y-axis and gives the sideways alignment of the tool — for a parallel-jaw gripper, the line along which the jaws open and close.
- The normal vector \(n\) lies along the x-axis, is perpendicular to both of the others, and is fixed by \(n = o \times a\) so that the three axes form a right-handed set.
- Stacking the three as columns and adding a position column gives the 4 × 4 frame matrix, whose last row is \(0\ 0\ 0\ 1\).
Matrix operations
- Matrices of the same order are added element by element, and a scalar multiplies every element. Forces and successive displacements may be added this way; frames may not, because the sum of two frames has columns that are neither unit length nor perpendicular.
- Two matrices multiply only when the columns of the first equal the rows of the second, and an m × n multiplied by an n × p gives an m × p result.
- Matrix multiplication is not commutative: \(AB\) and \(BA\) are generally different. It is associative, so \((AB)C = A(BC)\) — the grouping may change, the order may not.
- The identity matrix leaves any matrix unchanged and represents “no rotation”. The transpose writes rows as columns. The inverse undoes a transformation and exists only for a square matrix with a non-zero determinant.
- Robotics prefers square matrices because only they can be inverted, because two of the same size always multiply in either order, and because their product is of the same size, so chains of any length can be built.
- A 3 × 3 matrix can rotate and scale but cannot translate: applied to the origin it returns the origin, whatever its entries. The 4 × 4 form solves this, because the point’s fourth entry of 1 lets the fourth column add a constant shift.
Transformation
- A transformation is the mathematical description of how a frame changes its position and orientation with respect to a reference frame. It combines translation, a change of position, and rotation, a change of orientation.
- Pure translation shifts the origin and leaves the axis directions unchanged. Its matrix carries an identity block in the upper-left corner and the shift in the fourth column, and is written \(\text{Trans}(d_x,\ d_y,\ d_z)\).
- Applying a translation adds \(d_x\), \(d_y\) and \(d_z\) to the coordinates of a point, and leaves a direction vector untouched because that column ends in 0.
- Pure rotation turns the axes about an axis through the origin and leaves the origin where it is. In a plane the matrix is \(\begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}\), with a positive angle meaning a counter-clockwise turn.
- Rotation about x leaves the x coordinate unchanged and mixes y and z; rotation about y leaves y unchanged and mixes z and x; rotation about z leaves z unchanged and mixes x and y. The minus sign sits on the other off-diagonal position for \(\text{Rot}(y, \theta)\) because that rotation acts on the pair in the order z then x.
- The columns of a rotation matrix are mutually perpendicular unit vectors, its determinant is \(+1\), and its inverse equals its transpose, so \(R^{T}R = I\). A rotation therefore never changes the length of a vector.
The homogeneous transformation matrix
- A homogeneous transformation matrix is the 4 × 4 form \(T = \begin{bmatrix} R & d \\ 0 & 1 \end{bmatrix}\), whose upper-left 3 × 3 block holds the orientation, whose fourth column holds the position, and whose last row is three zeros and the scale factor 1.
- It has the same shape as the frame matrix, because a description of where a frame stands and an instruction for reaching it are the same sixteen numbers read two ways. Only the labelling of the two frames tells you which you are holding.
- A point is transformed by \(P' = T \times P\), which turns and shifts it in one multiplication.
- A chain of joints multiplies into a single matrix, \(T_{BE} = T_1 \times T_2 \times T_3\), giving the pose of the tool with respect to the base. The matrix nearest the point acts first, and reading left to right gives the frames in order from the base outwards.
- Because multiplication does not commute, rotating and then translating lands the tool somewhere different from translating and then rotating. The order in the product is the order the robot obeys.
- The inverse \(T^{-1}\) answers the reverse question — where the base lies as seen from the tool — and is needed whenever a sensor mounted on the end effector reports a target in its own frame.
4.9 Key Terms
- Approach vector — the unit vector along the z-axis of the end-effector frame, pointing in the direction in which the tool advances on its target.
- Column matrix — a matrix with a single column, used in robotics to hold the coordinates of a point.
- Determinant — a single number computed from a square matrix; a matrix whose determinant is zero has no inverse.
- Direction — the way a vector points, carried by a unit vector of magnitude 1 and no unit.
- End effector — the tool at the far end of a manipulator, such as a gripper, a welding head or a suction cup.
- End-effector frame — the moving frame attached to the end effector; also called the tool frame and written {E}.
- Fixed frame — a stationary frame attached to the environment or to a non-moving part of the robot, which does not change with time.
- Force — a push or pull represented as a vector, whose components are measured in N.
- Frame — a coordinate system consisting of an origin and three mutually perpendicular axes X, Y and Z.
- Homogeneous coordinates — a representation of a point by four numbers, the first three being the coordinates multiplied by the scale factor and the fourth being the scale factor itself.
- Homogeneous transformation matrix — a 4 × 4 matrix holding a rotation in its upper-left 3 × 3 block and a translation in its fourth column, describing the complete pose of one frame with respect to another.
- Identity matrix — a square matrix with ones on the leading diagonal and zeros elsewhere, which leaves any matrix unchanged when multiplied and which represents “no rotation”.
- Inverse — the matrix that returns the identity when multiplied by the original, and which undoes the transformation the original performs.
- Joint frames — the moving frames attached to the links and joints of a manipulator, written {J1}, {J2} and so on, numbered outwards from the base.
- Magnitude — the length of a vector, obtained as the square root of the sum of the squares of its components.
- Moving frame — a frame attached to a moving part of a robot, which travels with that part relative to the fixed frame.
- Order — the size of a matrix, written as rows × columns.
- Orientation vector — the unit vector along the y-axis of the end-effector frame, giving the sideways alignment of the tool.
- Origin — the point from which all coordinates in a frame are measured.
- Pose — the position and orientation of a body taken together, stated with respect to a named reference frame.
- Position — the location of a point, given by its distances along the axes of a stated frame, in mm or m.
- Position vector — a vector drawn from the origin of a frame to a point, naming the location of that point.
- Pure rotation — a movement in which the axes of a frame turn about an axis through its origin while the origin itself stays in place.
- Pure translation — a movement in which the origin of a frame shifts to a new position while the directions of its axes remain unchanged.
- Reference frame — the frame with respect to which the position and orientation of another frame or object are stated.
- Right-handed — the standard axis convention in which the fingers of the right hand point along X, curl towards Y, and the thumb points along Z.
- Rotation — a change in the orientation of a frame or body; also called orientation change.
- Scalar — a quantity having magnitude only, with no direction.
- Scale factor — the fourth entry of a homogeneous coordinate column, by which the first three entries are divided to recover the actual coordinates; normally 1 for a point and 0 for a direction.
- Transformation — the mathematical description of how a frame or object changes its position and orientation with respect to a stated reference frame.
- Translation — a change in the position of a frame or body, with no change in the direction its axes face.
- Transpose — the matrix obtained by writing the rows of a matrix as its columns; for a rotation matrix it equals the inverse.
- Unit vectors — vectors of magnitude 1 used to state direction, written \(\hat{i}\), \(\hat{j}\) and \(\hat{k}\) along the x, y and z axes.
- Universal reference frame — the global frame at the top of the chain, in which all other frames such as the base frame, the joint frames and the end-effector frame are ultimately expressed.
- Vector — a quantity having both magnitude and direction.
- Vector space — a set of vectors closed under addition and under multiplication by a scalar, so that these operations never produce a result outside the set.
4.10 Objective Questions
- The fourth entry of a homogeneous column that represents a direction rather than a point is
- 1
- 0
- −1
- the magnitude of the vector
- When a frame is translated without being turned, the part of its 4 × 4 matrix that changes is
- the upper-left 3 × 3 block
- the fourth column
- the last row
- all sixteen entries
- Assertion (A): A 3 × 3 matrix cannot represent a translation. Reason (R): Multiplying the column (0, 0, 0) by any 3 × 3 matrix returns (0, 0, 0).
- Both A and R are true, and R is the correct explanation of A.
- Both A and R are true, but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
- Assertion (A): The inverse of a rotation matrix is equal to its transpose. Reason (R): The determinant of a rotation matrix is +1.
- Both A and R are true, and R is the correct explanation of A.
- Both A and R are true, but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
- Match each item in Column A with its correct description in Column B.
| Column A | Column B |
|---|---|
| a. Approach vector | i. the global frame in which all other frames are ultimately expressed |
| b. Universal reference frame | ii. a moving frame attached to a link or joint of a manipulator |
| c. Joint frame | iii. a matrix representing no rotation at all |
| d. Identity matrix | iv. the direction along the z-axis of the end-effector frame |
Fill in the blanks. The three axes of a frame are mutually ______, and in robotics they follow the ______ convention, in which the thumb of that hand points along the Z axis.
State whether the following is true or false, and correct it if it is false. Multiplying all four entries of a homogeneous coordinate column by 5 places the point five times further from the origin.
4.11 Check Your Concepts
Define pure translation and pure rotation. In each case, state which part of the 4 × 4 matrix is affected and which part is left unchanged.
Name the three vectors that define the axes of the end-effector frame. For each, state the axis it is aligned with and explain, with one example, what it tells the robot about the tool.
Differentiate between a fixed frame and a moving frame, giving one example of each on a small arm bolted to a workshop bench.
Give reasons why robotics prefers square matrices, and explain why a 4 × 4 matrix is used in place of a 3 × 3 one for describing the pose of a tool.
A tool point lies at (60, 80, 25) mm in the frame of a rotary fixture. The fixture’s origin is at (200, 0, 40) mm in the base frame, and the fixture has been turned through 90° about the base frame’s z-axis. Write the homogeneous transformation matrix for the fixture and find the coordinates of the tool point in the base frame. Comment on why one of the three coordinates is unaffected by the turn.
Explain, using a numerical illustration of your own, why multiplying a rotation matrix and a translation matrix in one order gives a different result from multiplying them in the other. State the rule for deciding which matrix in a product acts on the point first, and explain what this means for the order in which the joint matrices of an arm are written.
4.12 Diagram, Circuit & Output Reading
- The pose of a gripper with respect to the base frame is given by
\[F = \begin{bmatrix} 0 & 0 & 1 & 300 \\ 0 & 1 & 0 & -50 \\ -1 & 0 & 0 & 120 \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
where the position entries are in mm. Read the matrix and answer the following. a. State the position of the gripper’s origin in the base frame. b. Write down the approach vector, and state in plain words which way the gripper is pointing. c. Show that the three direction columns are unit vectors at right angles to one another.
- A student writes the following and labels it a homogeneous transformation matrix for a shift of 50 mm along x, 20 mm along y and 10 mm along z:
\[T = \begin{bmatrix} 1 & 0 & 0 & 50 \\ 0 & 1 & 0 & 20 \\ 0 & 0 & 1 & 10 \\ 0 & 0 & 1 & 1 \end{bmatrix}\]
Identify the single error in the matrix, write the corrected form, and state what would go wrong with the fourth entry of a transformed point if the matrix were used as written.
- Using
\[\text{Rot}(y,\ 90^\circ) = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ -1 & 0 & 0 \end{bmatrix}\]
apply this rotation to the point (0, 15, 40) mm and state the resulting coordinates. Say which coordinate is unchanged and explain why it had to be. Then verify that the distance of the point from the origin is the same before and after.
- A gripper’s frame is specified by three columns: \(n = (1,\ 0,\ 0)\), \(o = (0,\ 1,\ 0)\) and \(a = (0,\ 1,\ 0)\).
- State which property of a frame this specification violates.
- Taking \(n\) and \(o\) as correct, work out what the approach vector must be, and say what physical direction the gripper then points in.
4.13 Case-Based Questions
- A school robotics team has a small arm bolted to a workshop bench. The bench frame {W} has its origin at one corner of the bench, its x and y axes along the bench edges and its z axis pointing up. The arm’s base frame {B} has its origin at (100, 50, 0) mm in {W}, and its axes are parallel to those of {W}. A metal block lies flat on the bench with its centre at (250, 150, 20) mm in {W}. The gripper is to approach the block vertically downwards, with its jaws opening and closing along the x direction of {B}.
- Write the transformation matrix from {W} to {B}, and use it to find the coordinates of the block’s centre in the base frame.
- Write the approach, orientation and normal vectors of the gripper in the base frame, and hence write the complete 4 × 4 frame matrix of the gripper when it is positioned directly above the block at a height of 120 mm.
- Before opening the jaws, the team raises the gripper by 40 mm without turning it. State which entries of the frame matrix change and which do not, and explain why.
- An inspection cell uses an arm with a small camera mounted on its end effector. The pose of the tool frame with respect to the base frame is
\[T = \begin{bmatrix} 0 & -1 & 0 & 300 \\ 1 & 0 & 0 & 120 \\ 0 & 0 & 1 & 250 \\ 0 & 0 & 0 & 1 \end{bmatrix}\]
with position entries in mm. The camera reports a surface defect at (30, −10, 200) mm in the tool frame.
- Find the coordinates of the defect in the base frame, showing the multiplication.
- The operator now wants the position of the base frame’s origin as seen from the tool. State which matrix is required, and explain why taking the transpose of T alone would not give the correct answer.
- The cell is later modified so that the workpiece sits on a turntable which rotates 90° about the base frame’s z-axis before the arm moves. Explain whether the turntable’s rotation matrix should be placed before or after the arm’s transformation in the product, and justify your answer by describing what the other order would physically mean.