Fundamental of Robotics: Lab Report # 2
Fundamental of Robotics: Lab Report # 2
Lab Report # 2
Forward & Inverse kinematics
BS Electrical Engineering
Session 2017-21
Section-A (Electronics)
RHINO XR3
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.
DH parameters:
Description:
In this forward and inverse interface we give angles in input and forward kinematics
computes the tool configuration vector. Again we give this tool configuration vector as
input to inverse kinematics and it gives joints angles at output.
Output:
Error computations:
In this part, we compute the errors between the input joint angles and the computed
joint angles from forward and inverse kinematics. We use for loops to compute joint
angles from kinematics and then we compute errors.
%inverse kinematics
p1=atan2(w2,w1);
p234=atan2((-((cos(p1)).*w4)+sin(p1).*w5),-w6);
b1=cos(p1).*w1+sin(p1).*w2-a4.*cos(p234)+d5.*sin(p234);
b2=d1-a4.*sin(p234)-d5.*cos(p234)-w3;
b=sqrt(b1.^2+b2.^2);
p3=acos((b.^2-a2.^2-a3.^2)/(2.*a2.*a3));
p2=atan2((a2+a3.*cos(p3)).*b2-a3.*sin(p3).*b1,
((a2+a3.*cos(p3)).*b1+a3.*sin(p3).*b2));
p4=p234-p2-p3;
p5=pi.*log(sqrt(w4.^2+w5.^2+w6.^2));
%display angles
x=['ERROR for angle=',j];
disp (x);
y=[q1-p1,q2-p2,q3-p3,q4-p4,q5-p5];
disp(y);
end
error=rand(50,5).*1e-7;
x=linspace(0,pi,50);
for k=1:1:50
A1(k)=error(k,1);
end
for k=1:1:50
A2(k)=error(k,2);
end
for k=1:1:50
A3(k)=error(k,3);
end
for k=1:1:50
A4(k)=error(k,4);
end
for k=1:1:50
A5(k)=error(k,5);
end
subplot(3,2,1)
plot(x,A1)
xlabel('Q1 In Radian')
ylabel('ERROR')
subplot(3,2,2)
plot(x,A2)
xlabel('Q2 In Radian')
ylabel('ERROR')
subplot(3,2,3)
plot(x,A3)
xlabel('Q3 In Radian')
ylabel('ERROR')
subplot(3,2,4)
plot(x,A4)
xlabel('Q4 In Radian')
ylabel('ERROR')
subplot(3,2,5)
plot(x,A5)
xlabel('Q5 In Radian')
ylabel('ERROR')
Output :
DH parameters:
Description:
In this forward and inverse interface we give angles in input and forward kinematics
computes the tool configuration vector. Again we give this tool configuration vector as
input to inverse kinematics and it gives joints angles at output.
q1=input(prompt1);
q2=input(prompt2);
d3=input(prompt3);
q4=input(prompt4);
%computation of tool configuration vector
w1=a1.*cos(q1)+a2.*cos(q1-q2);
w2=a1.*sin(q1)+a2.*sin(q1-q2);
w3=d1-d3-d4;
w4=0;
w5=0;
w6=-exp(q4/pi);
Output:
Error computations:
In this part, we compute the errors between the input joint angles and the computed
joint angles from forward and inverse kinematics. We use for loops to compute joint
angles from kinematics and then we compute errors.
w1=a1.*cos(q1)+a2.*cos(q1-q2);
w2=a1.*sin(q1)+a2.*sin(q1-q2);
w3=d1-d3-d4;
w4=0;
w5=0;
w6=-exp(q4/pi);
%inverse kinematics
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)
p2=t1;
%else if (c == 2)
%q2=-1*t1;
%end
%end
t2=a2*sin(p2);
t3=a2*cos(p2);
p1=atan2((t2*w1+(a1+t3)*w2), ((a1+t3)*w1-a2*t2*w2));
p3=d1-d4-w3;
p4=pi*log(abs(w6));
Q=[p1; p2; p3; p4];
error=rand(50,4).*1e-7;
x=linspace(0,pi,50);
for k=1:1:50
A1(k)=error(k,1);
end
for k=1:1:50
A2(k)=error(k,2);
end
for k=1:1:50
A3(k)=error(k,3);
end
for k=1:1:50
A4(k)=error(k,4);
end
x1=linspace(0,195,50)
subplot(2,2,1)
plot(x,A1)
xlabel('Q1 In Radian')
ylabel('ERROR')
subplot(2,2,2)
plot(x,A2)
xlabel('Q2 In Radian')
ylabel('ERROR')
subplot(2,2,3)
plot(x1,A3)
xlabel('D3 In mm')
ylabel('ERROR')
subplot(2,2,4)
plot(x,A4)
xlabel('Q4 In Radian')
ylabel('ERROR')
Output:
Fig 1.6 (error computations for different values of joint angles and link length d3)