Guide 5 - Homogeneous Matrices
Guide 5 - Homogeneous Matrices
1. Objectives:
1.1. Acquire skills in the computational calculation of mathematical tools for locating robots.
1.2. Familiarize the student with the basic tools to perform homogeneous matrix
transformations with the MATLAB software.
2. Introduction
The homogeneous transformation matrix T is analogous to the rotation matrix R; a screw axis S
is analogous to a rotation axis 𝜔; a twist 𝜈 can be expressed as Sθ and is analogous to an angular
velocity ω= ω θ; and exponential coordinates Sθ ∈ ℝ6 for rigid-body motions are analogous to
exponential coordinates ωθ ∈ ℝ3 for rotations.
There are three major uses for a transformation matrix T:
a) to represent the configuration (position and orientation) of a rigid body;
b) to change the reference frame in which a vector or frame is represented;
c) to displace a vector or frame.
The special Euclidean group SE (3), also known as the group of rigid-body motions or
homogeneous transformation matrices in ℝ3 , is the set of all 4 × 4 real matrices T, where R ∈ SO
(3) and p ∈ ℝ3 is a column vector:
1
Biomedical Engineering
Robotic and Bionic – 2021
a.
b.
2.2. MATLAB
In robotics applications, many different coordinate systems can be used to define where robots,
sensors, and other objects are located. The Matlab software tool can be used to translate, rotate
and simulate an element in space within the three axes (x, y, z) corresponding to a part, using the
transformation and translation matrices. These matrices are used to describe the location of
solids in n-dimensional space, expressing the relationships between Cartesian coordinates. The
great innovation introduced by these matrices is that they allow the position and orientation of
the body to be represented in a single matrix.
Robotics Toolbox by Peter Corke provides tools and algorithms to design, simulate, and test
manipulators, mobile robots, and humanoid robots. Additionally, you can transform between
coordinate systems when you apply these representations to 3D points.
4. Method
2
Biomedical Engineering
Robotic and Bionic – 2021
Here you can get the .mltbx file and necessary documentation.
You must click on the download button on the page. You can also click directly on the
following link: rtb10-4.mltbx
Using MATLAB navigate to the folder where you downloaded the file and double-click it
(or right-click then select Install). The Toolbox will be installed within the local MATLAB
file structure, and the paths will be appropriately configured for this, and future MATLAB
sessions.
To check that the toolbox has been correctly installed we will use the following
command:
>> rtbdemo
In this window you can test different features of the toolbox. You can exit the window,
and you will be able to use the toolbox in the next sessions.
For the manipulation and creation of transformation matrices there are several useful
commands, as you can see in the Table 1. To see the documentation of each one use the
command help.
4
Biomedical Engineering
Robotic and Bionic – 2021
Command Description
5
Biomedical Engineering
Robotic and Bionic – 2021
clear all
close all
clc
S1=transl(0,0,0);% Initial coordinate frame
P=[1 2 3]; % Initial point
V=[4 3 2]; % Displacement vector
T=transl(V)*troty(45);% Homogeneous transformation matrix, translation
and rotation
P2=T*[P';1]; % Final point
S2=S1*T; % Displaced and rotated frame
%% Plotting
hold on % Maintain plot in the same figure
% Plot oxyz frame and o'uvw frame
trplot(S1,'frame','O','color','b','labels','XYZ','length',1)
trplot(S2,'frame',"O'",'color','r','labels','UVW','length',1)
axis([-2 7 -2 7 -2 7])
view([33.19 14.03])
%plot point in the original frame and transformed frame
plot3(P(1),P(2),P(3),'b.','MarkerSize',10)
text(P(1)+0.2,P(2)+0.2,P(3)+0.2,"P",'Color','k')
arrow3([0 0 0],P,'*g')
plot3(P2(1),P2(2),P2(3),'b.','MarkerSize',10)
text(P2(1)+0.2,P2(2)+0.2,P2(3)+0.2,"P'",'Color','k')
arrow3(P,P2(1:3)','*r')
arrow3(V,P2(1:3)','*k')
hold off
Output:
6
Biomedical Engineering
Robotic and Bionic – 2021
We can observe how the oxyz system is displaced and rotated until it reaches the o'uvw
system. Also, is clear how the point is displaced easily with homogeneous
transformation matrix. Figure 8
5. Activities
5.1. Attach the corresponding code and screenshot of the results. Obtain the homogeneous
transformation matrices resulting from:
𝜋
a) Translation to ( 3, 2 , 5 ,)
b) Translation to ( 1,4, 2)
a) Rotation of 25° on the Y axis.
b) Rotation of -270° on the Z axis.
c) Rotation of 30° on the X axis.
d) Rotation of 45° on the X axis and translation to (-2,4,10).
e) Translation to (2,5,8) and Rotation of -30° on the Y axis.
7
Biomedical Engineering
Robotic and Bionic – 2021
5.2. Attach the corresponding code, the resulting graph 3D graphic in each literal and the
resulting homogeneous transformation matrix for which the Toolbox installed tools are
used. Check the code and modify it to obtain the following transformations
a) Obtain the transformation matrix that represents the O'UVW system obtained from
the OXYZ system by means of a 45° angle rotation around the OY axis, of a vector
translation pxyz (1, 5,1) and a rotation by 25° about the world OZ axis. Also, find pxyz, if
puvw = [-2, 0, 1].
5.6. Four reference frames are shown in the robot workspace of Figure 9: the fixed frame {a},
the end-effector frame effector {b}, the camera frame {c}, and the workpiece frame {d}.
I. Find 𝑇𝑎𝑑 and 𝑇𝑐𝑑 in terms of the dimensions given in the figure.
II. Find 𝑇𝑎𝑏 given that
9
Biomedical Engineering
Robotic and Bionic – 2021
5.7. The use of homogeneous transformation matrices is very important to generate robot
movements, because in this way we can create trajectories. Within the Peter Corke toolbox
we have the possibility to use known robot models. One of them is the Puma robot. For this
activity you will have to create a function that generates a movement of the robot arm, by
using a homogeneous transformation matrix. Optional: the function must keep the last
movement to make the next one.
To perform the algorithm of the requested function, you should employ the commands
used previously for the creation of homogeneous matrices. In addition, you should take the
necessary commands from Table 3 and arrange them in such a way that the arm can
generate a movement from a homogeneous matrix.
T ABLE 3. COMMAND TO CONTROL PUMA ROBOT
Commands Description
mdl_puma560 mdl_puma560 Create model of Puma 560 manipulator
Notes::
- When a time vector is provided the velocity and acceleration outputs are
scaled assuming that the time vector starts at zero and increases linearly.
p560.plot p560.plot(W, ‘view’, [A Z], options) displays a graphical animation of a robot
based on the kinematic model. A stick figure polyline joins the origins of the link
coordinate frames. The robot is displayed at the joint angle w (1xN), or if a
matrix (MxN) it is animated as the robot moves along the M-point trajectory. A
and Z is the altitude and azimuth of the angle of view, recommended [138 8].
p560.plot3d p560.plot3d(W, ‘view’, [A Z], options) displays and animates a solid model of
the robot. The robot is displayed at the joint angle Q (1xN), or if a matrix (MxN)
it is animated as the robot moves along the M-point trajectory. A and Z is the
altitude and azimuth of the angle of view, recommended [138 8].
References
1. Lynch, K. M., & Park, F. C. (2017). Modern robotics. Cambridge University Press.
2. Corke, P. I., & Khatib, O. (2011). Robotics, vision and control: fundamental algorithms in
MATLAB (Vol. 73, p. 2). Berlin: Springer.
3. Siciliano, B., Sciavicco, L., Villani, L., & Oriolo, G. (2009). Modelling, planning and control. Advanced
Textbooks in Control and Signal Processing. Springer.
Additional Resources
1. Pons, J. L. (2008). Wearable Robots: Biomechatronic Exoskeletons
2. Lynch, K. M., & Park, F. C. (2017). Robot Mechanics and Control.
3. https://modernrobotics.northwestern.edu/nu-gm-book-resource/3-3-1-homogeneous-
transformation-matrices/#department
4. https://robotacademy.net.au/masterclass/3d-geometry/?lesson=102
11