0% found this document useful (0 votes)
128 views11 pages

Guide 5 - Homogeneous Matrices

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views11 pages

Guide 5 - Homogeneous Matrices

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Biomedical Engineering

Robotic and Bionic – 2021

Lab 5 – Homogeneous Matrices


Instructor: Fernando Villalba
Assistant professor: Mario Gualsaqui – Wendy Fonseca

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:

For a matrix T ∈ SO (2), where θ ∈ [0, 2π), is always of the form:

2.1. PROPERTIES OF TRANSFORMATION MATRICES


These properties can be proven by calculation:
I. The inverse of a transformation matrix T ∈ SE (3) is also a transformation matrix, and it
has the following form:

1
Biomedical Engineering
Robotic and Bionic – 2021

II. The product of two transformation matrices is also a transformation matrix


III. The multiplication of transformation matrices is associative, but generally not
commutative.
IV. T is regarded as a transformation on points in ℝ3 ; T transforms a point x to Tx. Property
(a) asserts that T preserves distances, while property (b) asserts that T preserves angles.
Given T = (R, p) ∈ SE (3) and x, y ∈ ℝ3 , the following hold:

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.

3. Equipment and materials

 MATLAB® and Simulink


 Robotics Toolbox by Peter Corke

4. Method

4.1. Installing Toolbox


 Get the toolbox for free from the page: https://petercorke.com/toolboxes/robotics-
toolbox/

2
Biomedical Engineering
Robotic and Bionic – 2021

F IGURE 1 PETER C ORKE WEB

 Here you can get the .mltbx file and necessary documentation.

F IGURE 2. DOCUMENTS REQUIRED TO INSTALL TOOLBOX

 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.

F IGURE 3. TOOLBOX EXTENSION


3
Biomedical Engineering
Robotic and Bionic – 2021

 To check that the toolbox has been correctly installed we will use the following
command:
>> rtbdemo

F IGURE 4. TOOLBOX SUCCESSFUL INSTALL COMMAND

 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.

4.2. Getting starting with Robotic toolbox

 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

T ABLE 1. MAIN USEFUL COMMANDS , CLASSIC AND NEW

 The commands we are interested in are for the creation of homogeneous


transformation matrices, which can have rotations, displacement or both. The ones we
are interested in will be in Table 2.

T ABLE 2. COMMAND USED TO WORK WITH TRANSFORMATION MATRICES

Command Description

Create a translational SE(3) matrix.


transl T = TRANSL(X, Y, Z) is an SE(3) homogeneous transform (4×4) representing a pure translation of X, Y
and Z.

SE(3) rotation about X,Y and Z axis, respectively.


trotx,
T = TROTX(THETA)| TROTY(THETA) | TROTZ(THETA) is a homogeneous transformation (4×4)
troty, trotz
representing a rotation of THETA degrees about the x-axis, y-axis and z-axis.

Plot a 3D coordinate frame.


TRPLOT(T, OPTIONS) draws a 3D coordinate frame represented by the SE(3) homogeneous
transform T (4×4).
Options::
trplot 'frame',F The coordinate frame is named {F} and the subscript on the axis labels is F.
'labels',L Label the X,Y,Z axes with the 1st, 2nd, 3rd character of the string L
'length',s Length of the coordinate frame arms (default 1)
'color',C The color to draw the axes, MATLAB ColorSpec

Animate a 3D coordinate frame.


TRANIMATE(P1, P2) animates a 3D coordinate frame moving from pose X1 to pose X2. Poses X1 and
tranimate X2 can be represented by:
• SE(3) homogeneous transformation matrices (4×4)
• SO(3) orthonormal rotation matrices (3×3)

5
Biomedical Engineering
Robotic and Bionic – 2021

 As an example we will create and represent the homogeneous transformation matrix


where is displaced V [4,3,2] and rotated 45 degrees around the current y-axis, a point
P[1,2,3] in the system oxyz.

 The code used is:

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

F IGURE 5. HOMOGENEOUS TRANSFORMATION MATRIX

 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) Translation to (-2,8, -3)


b) Translation to (4, 7, -4)
c) Rotation of 112° on the X axis.
d) Rotation of 90° on the Y axis.
e) Rotation of 180° on the Z axis.
f) Rotation of -60° on the Y axis.
g) Rotation of -180 ° on the X axis.
h) Rotation of -90° on the Z axis.
i) Translation to (8,10,2) and rotation of 90° on the X axis.
j) Translation to (8,10,2) and rotation of 30° on the Z axis.
k) Translation to (8,10,2) and rotation of 180° on the Y axis.
l) Rotation of 0° to 360° on the Y axis.
m) Rotation of 0° to 180° on the Y axis and rotation of 0° to 90° on the X axis.
n) Rotation of 0° to 270° on the Z axis and rotation of 0° to -45° on the Y axis.
o) Rotation of 0° to 180° on the Z axis, rotation of -90° on the Y axis and Rotation of 0° to
15° on the X axis.
5.3. Attach the corresponding code and screenshot of the results when applying the installed
toolbox of the following exercises:

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].

b) Obtain the transformation matrix that represents the following transformations on a


fixed reference OXYZ system: translation of a vector pxyz (-6, -2,4); -180° turn on the
O'W axis of the transferred system and rotate by 35° about the world O'U axis. Also,
find pxyz, if puvw = [3, -2, 7].

c) Obtain the transformation matrix that represents the following transformations on a


fixed reference OXYZ system: 75° turn on the O'Z axis, rotate by -120 about the word
O'X axis and rotate by -45° about the word O'Y axis. Also, find pxyz, if puvw = [-4, 1, 2].

d) Obtain the transformation matrix that represents the following transformations on a


fixed reference OXYZ system: -90° turn on the O'V axis, rotate by 180° about the word
O'W axis and -25° turn on the word O 'axis U. Also, find pxyz, if puvw =[ 2, 1, 4]
8
Biomedical Engineering
Robotic and Bionic – 2021

5.4. Animate a rotating cube.


I. Write a function to plot the edges of a cube centered at the origin.
II. Modify the function to accept an argument which is a homogeneous
transformation which is applied to the cube vertices before plotting.
III. Animate rotation about the x-axis.
IV. Animate rotation about all axes.

5.5. Animate a rotating pyramid.


I. Write a function to plot the edges of a pyramid centered at the origin.
II. Modify the function to accept an argument which is a homogeneous
transformation which is applied to the cube vertices before plotting.
III. Animate rotation about the x-axis.
IV. Animate rotation about all axes.

F IGURE 6. F OUR REFERENCE FRAMES DEFINED IN A ROBOT ’S WORKSPACE

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

III. Plot the frames using trplot.

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

mdl_puma560 is a script that creates the workspace variable p560 which


describes the kinematic and dynamic characteristics of a Unimation Puma 560
manipulator using standard DH conventions.
Also define the workspace vectors:
qz zero joint angle configuration
qr vertical 'READY' configuration
qs arm is stretched out in the X direction
qn arm is at a nominal non-singular configuration
Notes::
- SI units are used.
- The model includes armature inertia and gear ratios.
p560.ikine6s Q = p560.ikine(T) are the joint coordinates (1xN) corresponding to the robot
end-effector pose T which is an SE3 object or homogeneous transform matrix
(4x4), and N is the number of robot joints. This is an analytic solution for a 6-axis
robot with a spherical wrist (the most common form for industrial robot arms).

Q = p560.ikine6s(T, CONFIG) as above but specifies the configuration of the arm


in the form of a string containing one or more of the configuration codes:

'l' arm to the left (default)


'r' arm to the right
'u' elbow up (default)
'd' elbow down
'n' wrist not flipped (default)
10
Biomedical Engineering
Robotic and Bionic – 2021

'f' wrist flipped (rotated by 180 deg)


jtraj jtraj Compute a joint space trajectory

W = jtraj(Q0, QF, M) is a joint space trajectory W(MxN) where the joint


coordinates vary from Q0 (1xN) to QF (1xN). A quintic (5th order) polynomial is
used with default zero boundary conditions for velocity and acceleration. Time
is assumed to vary from 0 to 1 in M steps. Joint velocity and acceleration can be
optionally returned as WD (MxN) and WDD (MxN) respectively. The trajectory
W, WD and WDD are MxN matrices, with one row per time step, and one
column per joint.

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

You might also like