-
Notifications
You must be signed in to change notification settings - Fork 37
Lesson 5: Pose in Robotics ‐ Homogeneous Transformation Matrices
Up to this point, we have discussed orientations in robotics, and we have become familiarized with different representations to express orientations in robotics. In this lesson, we will start with configurations, and we will learn about homogeneous transformation matrices which are great tools for expressing pose (both position and orientation) in a compact matrix form.
In the lesson about the degrees of freedom of a robot, we saw that in 3D physical space, we need six parameters to explicitly represent the position and orientation of a rigid body (three parameters for the position and three parameters for the orientation).
In order to represent the pose of a rigid body, we adopt a sixteen-dimensional
In the rotation matrices lesson, we saw that the body frame is a fixed frame that is instantaneously attached to the moving body and the space frame is the fixed frame that is fixed somewhere in the space. Then the configuration of the body can be expressed by the pair
The configuration of a rigid body can be expressed using the pair (R,p) in which R and p are the orientation and the position of the origin of the body frame {b} relative to the space frame {s}, respectively.
If we package both
where
The advantage of adopting the
As many robotic mechanisms are planar:
The configuration of a toy car on a plane has a rather simpler form in terms of homogenous transformation matrices.
We also define another Special Euclidean Group SE(2) for planar motions. The Special Euclidean Group SE(2) is defined as the set of all
Where
where
Suppose that frame {a} is instantaneously attached to a small mobile robot and it is initially coincident with the space frame {s}. The robot starts to move and first rotates
The homogenous transformation matrices representing the configuration of the robot at each stage can be calculated as the following:
Now let’s discuss the properties of transformation matrices.
As we also studied with the rotation matrices, homogenous transformation matrices have a bunch of properties that are unique to them:
-
Identity matrix I is a trivial form of a transformation matrix and it means that the pose of the body frame {b} is the same as the space frame {s}.
-
The Special Euclidean Group SE(3) is a group because:
-
The inverse of a transformation matrix
$T \in SE(3)$ is also a transformation matrix and can be computed as:$T^{-1} = {\begin{pmatrix} R & p\\ o & 1 \end{pmatrix}}^{-1} = \begin{pmatrix} R^T & -R^{T}p\\ o & 1 \end{pmatrix} \in SE(3)$ Prove this using the fact that the multiplication of a matrix with its inverse is the identity matrix and use a simple matrix multiplication to find the elements of the inverse of the transformation matrix.
-
The product of two transformation matrices is also a transformation matrix:
$T_1 T_2 \in SE(3)$ . -
The multiplication of transformation matrices is associative:
$(T_{1} T_{2})T_{3} = T_{1}(T_{2} T_{3})$ . But not generally commutative:$T_{1} T_{2} \neq T_{2} T_{1}$ .
-
-
If we have
$T = (R,p) \in SE(3))$ and$x,y \in \mathbb{R}^3$ then:-
The transformation matrix T preserves distances between the points in
$\mathbb{R}^3$ , which means that the distance between these points after the transformation is the same as the original distance:$||Tx - Ty|| = ||x - y||$ . In which, ||.|| is the standard Euclidean norm in$\mathbb{R}^3$ and is defined as:$||x|| = \sqrt{x^T x}$ . -
The transformation matrix T preserves angles:
$(Tx - Tz).(Ty - Tz) = (x-z).(y-z) \, \text{for all } z \in \mathbb{R}^3$ . In which$.$ is the standard Euclidean inner (dot) product in$\mathbb{R}^3$ that can be defined as:$x.y = x^T y$ .
-
Note 1.
Note 2. If {x,y,z} are points on the rigid body, then {Tx,Ty,Tz} are displaced versions of the points on the rigid body.
Note 3. If
Similar to what we studied for the rotation matrix, the homogenous transformation matrix
- It can be used to express the configuration (position and orientation) of a frame relative to a fixed frame. If we consider the figure of the robot with body frame {b} and the space frame {s} that we saw at the beginning of this lesson, then the configuration of the body frame relative to the space frame can be defined as:
$T_{sb} = \begin{pmatrix} R_{sb} & p_{sb}\\ o & 1 \end{pmatrix}$ . Where$R_{sb}$ is the rotation matrix representing the orientation of the frame {b} relative to the frame {s} and by now you definitely feel conformable to easily calculate it, and p is the position of the body frame {b} origin in the space frame’s coordinates. Let's see an example of this application.
Example. As an illustration, suppose that three coordinate frames {a}, {b}, and {c} are positioned in space as the following figure:
This figure shows the position and orientation of the frames {a}, {b}, and {c} in space.
{a} is initially coincident with the space frame {s}. Thus, the pose of the frames {a}, {b}, and {c} relative to {s} can be calculated as:
- It can act as an operator and change the representation of a frame or vector from one coordinate frame to another coordinate frame.
Another application for the homogenous transformation matrix is that it can act as an operator and change the reference frame of a vector or a frame. For any three reference frames {a}, {b}, and {c} and any free vector v expressed in for example {b} frame as
Here, the transformation matrix T acts as an operator and changes the reference frame of the vector or a frame. In the second equation,
As an instance, in the example that we saw above, we can find the homogenous transformation matrix representing the pose of any frame relative to another frame. For example, in order to calculate the homogenous transformation matrix
Note that for any two frames {d} and {e},
And thus:
Let’s now see an example that uses these two applications to find the relative position and orientation of different coordinate frames.
Example. Suppose an arm-mounted mobile robot X-Terrabot is moving in a room and wants to pick up an object with body frame {e} using its end-effector with the attached frame {c}:
A camera is fixed to the ceiling, and based on its measurements, the configuration of the frames attached to the wheeled platform {b} and the object frame {e} relative to the camera’s frame {d} are known:
Also, using the arm’s joint angle measurements,
The configuration of the camera frame {d} relative to the fixed-frame {a} is known in advance:
In order to calculate how to move the robot arm so as to pick up the object, the configuration of the object relative to the robot hand,
Therefore, the configuration of the object relative to the robot’s end-effector can be calculated as:
Now, let’s see another example. In this example, we go back to an example from the lesson about rotation matrices, and this time we are not solely interested in the orientation, but we want to calculate configurations.
Example. Suppose that a camera and a gripper are attached to the end-effector of the industrial arm. The camera is used to observe the workpiece and position the end-effector in the right position, and the gripper is used to grip the workpiece. The overall system can be depicted in the figure below:
A camera is attached to the robot end-effector to observe the object and position the end-effector in the right position. Four reference frames are attached to different elements in the robot’s workspace, as shown in the figure. The configuration of one frame relative to the other can be represented by a homogenous transformation matrix.
Four frames are attached to different elements in the robot’s workspace, as shown above. {a} is the frame coincident with the space frame {s}, {b} is the gripper frame, {c} is the camera frame, and {d} is the workpiece frame.
First, we want to calculate the configuration of the workpiece frame {d} relative to the frame {a} and the camera frame {c}. To this end, we just need to calculate the homogenous transformation matrices,
Now, suppose that the configuration of the camera frame {c} relative to the end-effector frame {b} is given as:
And we’d like to calculate the configuration of the end-effector frame {b} relative to the frame {a}. To this end, we use the subscript cancellation rule, and we can write:
- It can act as an operator and can be used to translate and rotate (displace) a frame or a vector.
The homogenous transformation matrix can act on a vector or a frame and displace (rotate and translate) it. Then
By abuse of notation, we can define the
And the
Where
This translation operator causes a translation along the unit direction
Now let’s see the effect of pre-multiplying or post-multiplying a transformation matrix by the operator
-
Fixed-frame transformation: If we pre-multiply
$T_{sb}$ by T, then$\hat{\omega}$ , and p are interpreted in the space frame {s}:
In this case, the operator
-
Body-frame transformation: if we post-multiply
$T_{sb}$ by the operator T, then the rotation axis$\hat{\omega}$ and the position vector p are both interpreted in the body frame {b}:
In this case, the operator
Let’s see all these with examples.
Example: Suppose that the configuration of the body frame {b} relative to the space frame {s} is as the following figure:
Where the configuration of the body frame relative to the space frame, as we saw earlier in the lesson, can be represented by a 4×4 transformation matrix as:
Now suppose that displacement (rotation and translation) operator
-
Case (1):
$T_{sb}$ is pre-multiplied by T, then the rotation axis$\hat{\omega}$ is interpreted in the space frame {s} and is equal to the axis$\hat{z}_s$ . p is also interpreted in the {s} frame and represents a translation of two units along the$\hat{y}_s$ axis. Then the final pose of the body frame relative to the space frame can be visualized as:
The final pose of the body frame after going through a rotation about the space frame’s z-axis by 90 deg, and then translating along the space frame’s y-axis by 2 units.
The frame {b} first goes through a rotation by 90 deg about the z-axis of the {s} frame, and because the origins of the frames {b} and {s} are not initially coincident, this rotation displaces the origin of the {b} frame. Then it goes through a translation by two units along the y-axis of the space frame {s} to reach the frame {b’}. The simulation below shows a demonstration of this transformation:
Mathematically, we can say that the transformation matrix representing the pose of the frame {b’} relative to the space frame {s} can be calculated as:
where
-
Case (2):
$T_{sb}$ is post-multiplied by T (body-frame transformation), then the rotation axis$\hat{\omega}$ and the position vector p are both interpreted in the body frame {b}. In this case, first, a translation along the {b} frame’s y-axis,$\hat{y}_b$ , is done by two units, and then a rotation about the new body frame’s z-axis is done by 90 deg. This rotation does not change the origin of the new body frame. The final pose of the body frame relative to the space frame can be visualized as:
The final pose of the body frame after going through a translation about the {b} frame's y-axis followed by a rotation about the new body frame’s z-axis by 90 deg.
The simulation below shows a demonstration of this transformation:
Mathematically, we can also prove this. The transformation matrix representing the pose of the frame {b”} relative to the space frame {s} can be calculated as:
That verifies the result that we got from the visualization.
-
Kevin, M.L. and Frank, C.P., 2017. Modern robotics: mechanics, planning, and control
-
Murray, R.M., Li, Z. and Sastry, S.S., 2017. A mathematical introduction to robotic manipulation. CRC press.
-
Corke, P., 2023. Robotics, Vision and Control: Fundamental Algorithms in Python (Vol. 146). Springer Nature.
-
Cao, C.T., Do, V.P. and Lee, B.R., 2019. A novel indirect calibration approach for robot positioning error compensation based on neural network and hand-eye vision. Applied Sciences, 9(9), p.1940.