Professional Documents
Culture Documents
Fundamental of Robotics: Lab Report # 1
Fundamental of Robotics: Lab Report # 1
Lab Report # 1
Inverse kinematics
BS Electrical Engineering
Session 2017-21
Section-A (Electronics)
The SCARA's construction comprises of two arms joined at the base and the crossing
point of arms one and two. Two autonomous motors utilize opposite kinematics and
introduction at joints J1 and J2 to control the SCARA's X-Y movement. The last X-Y
area toward the finish of arm two is a factor of the J1 point, J2 point, length of arm one
and length of arm two.
MATLAB code:
%constant values
d1=26.04;
d5=16.83;
a2=22.86;
a3=22.86;
a4=0.95;
%input the W matrix
prompt1='Enter 1st element of Tool Configuration Vector W1:';
prompt2='Enter 2nd element of Tool Configuration Vector W2:';
prompt3='Enter 3rd element of Tool Configuration Vector W3:';
prompt4='Enter 4th element of Tool Configuration Vector W4:';
prompt5='Enter 5th element of Tool Configuration Vector W5:';
prompt6='Enter 5th element of Tool Configuration Vector W6:';
w1=input(prompt1);
w2=input(prompt2);
w3=input(prompt3);
w4=input(prompt4);
w5=input(prompt5);
w6=input(prompt6);
%computation
q1=atan2(w2,w1);
q234=atan2((-((cos(q1)).*w4)+sin(q1).*w5),-w6);
b1=cos(q1).*w1+sin(q1).*w2-a4.*cos(q234)+d5.*sin(q234);
b2=d1-a4.*sin(q234)-d5.*cos(q234)-w3;
b=sqrt(b1.^2+b2.^2);
q3=acos((b.^2-a2.^2-a3.^2)/(2.*a2.*a3));
q2=atan2((a2+a3.*cos(q3)).*b2-a3.*sin(q3).*b1,
((a2+a3.*cos(q3)).*b1+a3.*sin(q3).*b2));
q4=q234-q2-q3;
q5=pi.*log(sqrt(w4.^2+w5.^2+w6.^2));
%display results
x1= 'q1 is: ';
disp(x1);
disp(q1);
x2= 'q2 is: ';
disp(x2);
disp(q2);
x3= 'q3 is: ';
disp(x3);
disp(q3);
x4= 'q4 is: ';
disp(x4);
disp(q4);
x5= 'q5 is: ';
disp(x5);
disp(q5);
Output:
MATLAB code:
L(1) = Link([0 26.04 0 -pi/2]);
L(2) = Link([-pi/2 0 22.86 0]);
L(3) = Link([pi/2 0 22.86 0]);
L(4) = Link([0 0 0.95 -pi/2]);
L(5) = Link([-pi/2 16.83 0 0]);
RhinoXR3 = SerialLink(L);
RhinoXR3.teach;
Output:
DH parameters:
MATLAB code:
%function for SCARA reverse kinematics
%declaring constants
d1=877;
d2=0;
%d3 is not specified. d3 is variable ranging from 0 to 195mm.
%tool length
d4=200;
a1=425;
a2=375;
a3=0;
a4=0;
%take inputs
prompt1='Enter the first element of the tool configuration vector "w1": ';
prompt2='Enter the second element of the tool configuration vector "w2": ';
prompt3='Enter the third element of the tool configuration vector "w3": ';
prompt4='Enter the fourth element of the tool configuration vector "w4": ';
prompt5='Enter the fifth element of the tool configuration vector "w5": ';
prompt6='Enter the sixth element of the tool configuration vector "w6": ';
w1=input(prompt1);
w2=input(prompt2);
w3=input(prompt3);
w4=input(prompt4);
w5=input(prompt5);
w6=input(prompt6);
t1=acos((w1*w1+w2*w2-a1*a1-a2*a2)/(2*a1*a2));
c=input('Input "1" for left and "2" for right: ');
if (c == 1)
q2=t1;
else if (c == 2)
q2=-1*t1;
end
end
t2=a2*sin(q2);
t3=a2*cos(q2);
q1=atan2((t2*w1+(a1+t3)*w2), ((a1+t3)*w1-a2*t2*w2));
q3=d1-d4-w3;
q4=pi*log(abs(w6));
Q=[q1; q2; q3; q4];
%show the output
disp(Q);
Output:
Animation of SCARA:
MATLAB code:
L(1) = Link([0 877 425 pi]);
L(2) = Link([0 0 375 0]);
L(3) = Link('prismatic', 'theta', 0, 'a', 0, 'alpha', 0, 'qlim', [0 195]);
L(4) = Link([pi/2 200 0 0]);
SCARA = SerialLink(L);
SCARA.teach;
Output: