Matlab Assignment
Submitted in fulfillment of the requirements of
DEZG561 – Mechanisms and Robotics
(Assignment)
By
Name: Ankith A
(ID NO: 2019HT30510)
BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI
CAMPUS
First Semester 2019-2020
Assignment
Choose a six-axis robot from the attached brochure (TX 90 series). Using the given dimensions,
write a MATLAB code for forward kinematics of the arm for the given home position and find the tool
point. Plot the representation of the robot using a 3D plot.
Matlab code
%MATLAB code for forward kinematics of the arm for the given
home position and to find the tool point of TX90
clc
clear all
%code line enter varying theta value
theta1=input('enter the desired theta 1 value = ')
theta2=input('enter the desired theta 2 value = ')
theta3=input('enter the desired theta 3 value = ')
theta4=input('enter the desired theta 4 value = ')
theta5=input('enter the desired theta 5 value = ')
theta6=input('enter the desired theta 6 value = ')
% Defining dimensions of the robot
L1=478;
L2=289;
L3=425;
L4=-239;
L5=425;
d1=50;
d2=100;
%Origin
O=[0; 0; 0; 1]
%Articulated arm movement transformation definition
T01=rotz(theta1)*transz(L1)*rotx(90)
T12=transz(L2)
T21=transx(d1)*rotz(theta2)
T23=rotz(90)*transx(L3)*rotz(theta3)
T34=transz(L4)*rotz(theta4)*rotz(-90)*rotx(-90)
T45=transz(L5)*rotz(theta5)*rotx(90)
T56=rotx(-90)*rotz(theta6)*transz(d2)
Pn=T01*T12*T21*T23*T34*T45*T56*O
x1=T01*O
x2=T01*T12*O
x3=T01*T12*T21*O
x4=T01*T12*T21*T23*O
x5=T01*T12*T21*T23*T34*O
x6=T01*T12*T21*T23*T34*T45*O
x7=T01*T12*T21*T23*T34*T45*T56*O
X=[O(1) x1(1) x2(1) x3(1) x4(1) x5(1) x6(1) x7(1)];
Y=[O(2) x1(2) x2(2) x3(2) x4(2) x5(2) x6(2) x7(2)];
Z=[O(3) x1(3) x2(3) x3(3) x4(3) x5(3) x6(3) x7(3)];
%3D Plot
plot3(X,Y,Z,'-ys','LineWidth',5,...
'MarkerEdgeColor','g',...
'MarkerFaceColor','b',...
'MarkerSize',10)
xlabel('X-Rolling')
ylabel('Y-Pitching')
zlabel('Z-Yaw')
axis([-500 2000 -500 2000 -500 2000])
hold on