Professional Documents
Culture Documents
Lab 4
Lab 4
Lab 4
Air University
Lab # 4
Objective
Familiarization with Corke MATLAB Robotics Toolbox for programming the pertinent
robotics mathematics in MATLAB and understand its utilization in verifying the
analytical solution.
Given Cartesian coordinates, define a frame and apply various transformations on the
defined frame. Show plots against each result obtained.
Lab Exercise
(a) Define a frame at origin, transform it to (1.5, 2, 0) followed by the rotation at 30 degrees.
Represent this transformation as a translation followed by a rotation and vice versa.
Verify that the solution is the same. Plot each result obtained.
Defining a frame
MATLAB CODE:clc
clear all
axis([-2 5 -2 5])
hold on
T1=se2([0,0,0])
pause(1);
trplot2(T1)
pause(1);
Spring 2016
Air University
Spring 2016
Air University
(b) Animate the transformations in question 1) and describe in steps in your own
words what happens when you
Apply translation followed by a rotation
Apply rotation followed by translation
Translation followed by Rotation:
clc
clear all
axis([-2 5 -2 5])
hold on
T1=se2([0,0,0])
pause(1);
trplot2(T1, 'frame', 'A', 'color', 'g')
pause(1);
T2=se2([1.5,2,0*pi/180])
pause(1);
tranimate(T2)
trplot2(T2, 'frame', 'I', 'color', 'b')
pause(1);
T3=se2([1.5,2,40*pi/180])
pause(1);
trplot2(T3, 'frame', 'B', 'color', 'r')
tranimate(T3)
Spring 2016
Air University
clc
clear all
axis([-2 5 -2 5])
hold on
T1=se2([0,0,0])
pause(1);
trplot2(T1, 'frame', 'A', 'color', 'g')
pause(1);
T2=se2([0,0,40*pi/180])
pause(1);
trplot2(T2, 'frame', 'I', 'color', 'b')
tranimate(T2)
pause(1);
T3=se2([1.5,2,40*pi/180])
pause(1);
trplot2(T3, 'frame', 'B', 'color', 'r')
tranimate(T3)
Spring 2016
Air University
(c) Decompose the rotation obtained in question 1) as a sequence of rotations about the axes
X, Y, and Z.
clc
clear all
axis([-2 2 -2 2 -2 2])
hold on
T1=se2([0,0,0])
pause(1);
trplot2(T1, 'frame', 'A', 'color', 'g')
pause(1);
T1=rotx(60*pi/180)
pause(1);
trplot(T1, '3d')
pause(1);
T1=roty(60*pi/180)
pause(1);
trplot(T1, '3d')
pause(1);
T1=rotz(60*pi/180)
pause(1);
trplot(T1, '3d')
Spring 2016
Air University
(d) The same as above but as a sequence of rotations about the axes Z, Y, and Z
clc
clear all
axis([-2 2 -2 2 -2 2])
hold on
T1=se2([0,0,0])
pause(1);
trplot2(T1, 'frame', 'A', 'color', 'g')
pause(1);
T1=rotz(60*pi/180)
pause(1);
trplot(T1, '3d')
pause(1);
T1=roty(60*pi/180)
pause(1);
trplot(T1, '3d')
pause(1);
T1=rotz(60*pi/180)
pause(1);
trplot(T1, '3d')
Spring 2016
Air University
Also use the following commands on a random frame of your choice and observe the results as
your practice. (You might be asked to use them in lab quizzes)
Spring 2016
Air University
Spring 2016