In order to proceed with writing a simple robot simulator, there are a number of mathematical concepts that must be introduced before we can describe the motion of a manipulator.
The position and orientation (together, pose) of a rigid body in space can be described with respect to a fixed coordinate frame in terms of a translation from the fixed frame’s origin and rotation about the axes of the fixed frame. Here, we let denote the fixed coordinate frame and the body coordinate frame, as shown below.
As shown, the fixed coordinate frame with origin is specified by unit axes , and , while the body coordinate frame with origin be specified by unit axes , and .
The translation of frame with respect to frame is
which can be written, in terms of the axes of the fixed frame, as the vector .
The rotation of the body frame with respect to the fixed frame is specified by expressing the axes of the body frame in terms of the axes of the fixed frame. This yields
These relations can be expressed compactly in the rotation matrix
This matrix simply describes the body frame’s axes in terms of the axes of the fixed frame. The rightmost expression can be verified by substituting in the definitions of , and from above and using the fact that these axes vectors are mutually orthogonal (actually, mutually orthonormal since they are unit vectors). This means that dot products between different axes vectors are zero, eg if we denote , and instead by , and respectively:
Also recall that the dot product can be written
where is the angle between the vectors. Since the axes of both body and fixed frames are unit vectors, we can rewrite the orientation of the body frame as
where again describes the angle between two axes unit vectors of the fixed and body frames. For this reason, the rotation matrix is sometimes referred to as the direction cosine matrix or DCM (where each element is referred to as a direction cosine).
Now, let’s take a quick look at propertis of the rotation matrix and how it’s used.
If the rotation matrix represents the orientation of the body frame with respect to the fixed frame, then its inverse represents the opposite rotation - the orientation of the fixed frame with respect to the body frame.
Recall from above that the columns of the rotation matrix were said to be mutually orthogonal - we call this an orthogonal matrix which has the special property that its inverse is equal to its transpose:
This makes transforming between frames easy and computationally-efficient. In addition, as was mentioned above, the columns of a rotation matrix are all unit vectors. This means its columns are mutually orthonormal, or in other words, is an orthonormal matrix.
Consider two frames with the same origin but different sets of unit axes, as shown below.
A vector can be described in terms of the first frame as and in terms of the second frame as . Since these vectors correspond to the same point in space, we must have and thus
This is, from above, ; is the rotation matrix which transforms the vector from the second frame to the first. Since is orthogonal, the inverse transformation is .
Note that since is an orthogonal transformation we have
The matrix therefore does not change the norm of the vector but only its direction, which is a property we expect from pure rotation.
Consider a point in space and its representations in the frames , and having a common origin . We introduce the noration to denote the rotation matrix describing the orientation of frame with respect to frame ; then we have
We also have, using the equation above,
Finally, we can write
From the above equation it is obvious that we must have
Here it is interpreted that a frame aligned with is first rotated into alignment with with and then this frame is rotated into alignment with frame using . That is, successive rotations can be applied to a vector via post-multiplication of the corresponding rotation matrices following the order of rotations.
The overall rotation is therefore expressed as the composition of partial rotations; each rotation is defined with respect to the axes of the current frame in the sequence. When each rotation is made instead with respect to the axes of a fixed frame, the elementary rotation matrices are premultiplied in the order in which the rotations are applied.
There’s a LOT more to be said about representing rotations in three dimensions, but that will have to wait for a dedicated post. For now, the point is that we understand what a rotation matrix is and how it’s formed from the axes of the fixed frame and frame of interest (here, the frame attached to a rigid body).
We’ve seen what it means to express the translation and rotation of one frame with respect to another, but for the sake of convenience we’d like to be able to desribe the full pose in one mathematical expression.
Recall from above that a point on a rigid body in frame is fully specified with respect to a fixed reference frame by a vector describing the origin of Frame 1 with respect to Frame 0 and a rotation matrix describing the orientation of Frame 1 with respect to Frame 0.
The position of point P in Frame 0 is then
This specifies a coordinate transformation of a vector between the two frames. The inverse transformation comes from premultiplying both sides of the above equation by and solving for ; this leads to
These transformations can be expressed in a more compact form by converting to homogeneous representations given by
and, for the inverse transform,
where is a homogeneous vector and and are homogeneous transformation matrices. It is important to note that, in general, homogeneous transformation matrices are NOT orthogonal, so unlike for rotation matrices we do not have .
Successive homogeneous transformations are composed in the same manner as for rotation matrices:
As before, note that post-multiplication is used because these matrices are all defined with respect to the preceding frame in the chain - this will be useful in defining a systematic way to transform between links of a robot manipulator. When transformations are all defined relative to the same fixed frame, we pre-multiply them as was done for pure rotations above.
We introduced the basics for 3D geometry, including rotations, translations and homogeneous transforms. Next time, we’ll build on this foundation to derive the kinematics of arbitrary robot manipulators.Written on January 22nd , 2020 by Nick Rotella