Internship Report
Internship Report
SERIAL MANIPULATOR:
SIMULATION AND CONTROL
Submitted by:
Ravikant Narayan (14ME157)
B.Tech, Mechanical Engineering
Submitted to:
Dr Prasad Krishna
Department of Mechanical Engineering
National Institute of Technology Karnataka, Surathkal
The laser light splits into two beams. One travels directly into the
interferometer. The other beam travels out of the tracker, reflects off the
SMR and, on the return path, passes into the interferometer. Inside the
interferometer, the two beams of light interfere, resulting in a cyclic change
each time the SMR moves closer to or farther from the tracker by a distance
equal to one quarter of the light’s wavelength. Electronic circuitry counts the
cyclic changes to determine the distance travelled.
(x,y,z) = (r,θ,ϕ)
ϕ z
θ R
3. Measurement of coordinates:
As proceeding to goals, First work is measurement of coordinates of a
circular profile taken by using Faro laser tracker. To complete the
measurement CAM2 Measure 10 software is used.
3.1. CAM2 Measure 10:
FARO CAM2 Measure 10 is all-in-one metrology software for complete
solution for all tactile measurement and non-contact 3D scanning
applications. The software is ideal for CAD and non-CAD inspection and
Geometric Dimensioning and Tolerancing.CAM2 Measure 10 features
image-guided measurement, automatic nominal association to various
features, Quick Tools and an intuitive user interface. Moreover, the software
is delivered with a reliable CAD import tool which increases the ability to
load a large amount of CAD data.
As proceed to measurement, measurement taken out by putting retro-
reflector on different points of a circular profile and around 600 points’
coordinate measure for more accuracy.
1. Homogeneous Transformation Matrixes:
To obtain transformation from one frame to another frame in 3D,
Homogeneous transformation matrixes are used. Homogeneous
transformation matrixes have these three types of matrixes:
1. Rotation Matrix
2. Displacement Matrix
3. D-H parameters
1.1. Rotation Matrix:
A basic rotation is a rotation about one of the axes of a Coordinate system.
The following three basic rotation matrices rotate vectors by an angle
θ about the x, y, or z axis, in three dimensions, using the right handed rule —
which codifies their alternating signs. (The same matrices can also represent
a clockwise rotation of the axes.)
Link No. A θ d α
link1 0 θ1 0 Pi/2
link2 11.0 θ2 0 0
link3 6.5 θ3 0 0
link4 7.5 θ4 0 0
Fig.-5: Joint frames of Robot
T01 = [ ]
T12 = [ ]
T23 = [ ]
T34 = [ ]
X = cosθ1(a1*cosθ2+a2*cosθ23+a3*cosθ234) (1)
Y = sinθ1(a1*cosθ2+a2*cosθ23+a3*cosθ234) (2)
Z = a1*sinθ2+a2*sinθ23+a3*sinθ234 (3)
Here: θ234 = θ2+θ3+θ4
θ23 = θ2+θ3
And Orientation of final position can be calculated by converting Cartesian
coordinate to Spherical coordinate. So orientation ϕ (angle of vector from
positive Z-axis) will be:
ϕ= atan2 (sqrt(X*X)+(Y*Y),Z)
and also: ϕ= θ2+θ3+θ4 (4)
Let’s start Inverse Kinematics:
By dividing equation(2) by equation(1), θ1 can be found:
θ1= atan2 (Y,X) (5)
By equating ahead θ2 can be found:
θ2= atan2(c,sqrt(r*r-c*c)) – atan2(a,b) (6)
Where: a= a2*sinθ3, b = a1+a2*cosθ3
c= Z – a3*sinϕ , r = sqrt(a*a-b*b)
by taking distance between Frame1 to frame3, θ3 can be found:
θ3= acos((A*A+B*B+C*C-a1*a1-a2*a2)/2*a1*a2) (7)
Where: A= (X-a3*cosθ1cosϕ), B = (Y-a3*sinθ1cosϕ)
C = (Z-a3*sinϕ)
Now by equating eq(4),eq(7) and eq(6), θ4 can be found:
θ4 = ϕ-θ2-θ3 (8)
So finally equation(5), equation(6), equation(7), equation(8) will give value
of θ1,θ2,θ3 and θ4.
6. Simulation of Robot in Matlab:
Simulation is done by using inverse kinematics of robot in Matlab. In this
Simulation there will be three links and one point as an end-effector of robot.
Simulation is carried out for showing links and end-effector point and it is
shown in fig.-6:
Simulation is carried out for generating circular profile of radius 5 and the
generated profile is shown in fig.-8:
JUMPER WIRES
7805 IC 7805 IC
Power Supply
4R Articulated Robot
Faro laser Tracker
Electric Circuit
270
260
250
-15 -10 -5 0 5 10 15
-300
250 300
X
Y
-310 X
-320
11. Reference:
1. Robert J. Schilling, ―Fundamentals of Robotics: Analysis & Control‖,
Prentice Hall, Inc., 2011 edition.
2. John J. Craig, ―Introduction to Robotics: Mechanics & Control‖,
Pearson Publishing, 2008 edition.
3. ―Kinematic Modeling and Analysis of a 5 Axis Articulated Robot Arm
Model VRT-502‖, International Journal of Engineering Research &
Technology (IJERT), ISSN: 2278-0181, Vol. 4 Issue 07, July-2015
Appendix-A
Final matlab code to generate a square profile for 4r Articulated robot:
clc
clear all
global a;
a = arduino('com5');
a.servoAttach(8);
a.servoAttach(9);
a.servoAttach(10);
a.servoAttach(11);
a.servoWrite(8,0);
a.servoWrite(9,0);
a.servoWrite(10,0);
a.servoWrite(11,0);
a1 = 11;
a2 = 6.5;
a3 = 7.5;
for j = -5:0.5:5
x = 14;
z = 20;
y = j;
d = sqrt((x*x)+(y*y));
phai = atan2(d,z);
r = [1 0 0;0 cos(phai) -sin(phai); 0 sin(phai) cos(phai)];
t1 = atan2(y,x);
A = (x-(a3*cos(t1)*cos(phai)));
B = (y-(a3*sin(t1)*cos(phai)));
C = (z-(a3*sin(phai)));
v = sqrt((A*A)+(B*B)+(C*C));
f = (v^2)-(a1*a1)-(a2*a2);
t3 = acos(f/(2*a2*a1));
m = a2*sin(t3);
b = a1+a2*cos(t3);
c = z-a3*sin(phai);
e = sqrt((m*m)+(b*b));
g = sqrt((e*e)-(c*c));
t2 = atan2(c,g)-atan2(m,b);
t4 = phai-t2-t3;
if (t1<0 || t1>pi)
fprintf('try with another coordinates');
else
theta1 = (t1*180)/pi;
end
if (t2<0 || t2>pi/6)
fprintf('try with another coordinates');
else
theta2 = (t2*180)/pi;
end
if (t3<(pi/6) || t3>(pi-pi/6))
fprintf('try with another coordinates');
else
theta3 = (t3*180)/pi;
end
if (t4<pi/6 || t4>(pi-pi/6))
t44 = t4+(2*pi);
theta44 = (t4*180)/pi;
theta4 = (theta44*180)/360;
else
theta4 = (t4*180)/pi;
end
a.servoWrite(8,int64(theta1));
a.servoWrite(9,int64(theta2));
a.servoWrite(10,int64(theta3));
a.servoWrite(11,int64(theta4));
end
for j = 20:-0.5:10
x = 14;
z = j;
y = 5;
d = sqrt((x*x)+(y*y));
phai = atan2(d,z);
r = [1 0 0;0 cos(phai) -sin(phai); 0 sin(phai) cos(phai)];
t1 = atan2(y,x);
A = (x-(a3*cos(t1)*cos(phai)));
B = (y-(a3*sin(t1)*cos(phai)));
C = (z-(a3*sin(phai)));
v = sqrt((A*A)+(B*B)+(C*C));
f = (v^2)-(a1*a1)-(a2*a2);
t3 = acos(f/(2*a2*a1));
m = a2*sin(t3);
b = a1+a2*cos(t3);
c = z-a3*sin(phai);
e = sqrt((m*m)+(b*b));
g = sqrt((e*e)-(c*c));
t2 = atan2(c,g)-atan2(m,b);
t4 = phai-t2-t3;
if (t1<0 || t1>pi)
fprintf('try with another coordinates');
else
theta1 = (t1*180)/pi;
end
if (t2<0 || t2>pi/6)
fprintf('try with another coordinates');
else
theta2 = (t2*180)/pi;
end
if (t3<(pi/6) || t3>(pi-pi/6))
fprintf('try with another coordinates');
else
theta3 = (t3*180)/pi;
end
if (t4<pi/6 || t4>(pi-pi/6))
t44 = t4+(2*pi);
theta44 = (t4*180)/pi;
theta4 = (theta44*180)/360;
else
theta4 = (t4*180)/pi;
end
a.servoWrite(8,int64(theta1));
a.servoWrite(9,int64(theta2));
a.servoWrite(10,int64(theta3));
a.servoWrite(11,int64(theta4));
end
for j = 5:-0.5:-5
x = 14;
z = 10;
y = j;
d = sqrt((x*x)+(y*y));
phai = atan2(d,z);
r = [1 0 0;0 cos(phai) -sin(phai); 0 sin(phai) cos(phai)];
t1 = atan2(y,x);
A = (x-(a3*cos(t1)*cos(phai)));
B = (y-(a3*sin(t1)*cos(phai)));
C = (z-(a3*sin(phai)));
v = sqrt((A*A)+(B*B)+(C*C));
f = (v^2)-(a1*a1)-(a2*a2);
t3 = acos(f/(2*a2*a1));
m = a2*sin(t3);
b = a1+a2*cos(t3);
c = z-a3*sin(phai);
e = sqrt((m*m)+(b*b));
g = sqrt((e*e)-(c*c));
t2 = atan2(c,g)-atan2(m,b);
t4 = phai-t2-t3;
if (t1<0 || t1>pi)
fprintf('try with another coordinates');
else
theta1 = (t1*180)/pi;
end
if (t2<0 || t2>pi/6)
fprintf('try with another coordinates');
else
theta2 = (t2*180)/pi;
end
if (t3<(pi/6) || t3>(pi-pi/6))
fprintf('try with another coordinates');
else
theta3 = (t3*180)/pi;
end
if (t4<pi/6 || t4>(pi-pi/6))
t44 = t4+(2*pi);
theta44 = (t4*180)/pi;
theta4 = (theta44*180)/360;
else
theta4 = (t4*180)/pi;
end
a.servoWrite(8,int64(theta1));
a.servoWrite(9,int64(theta2));
a.servoWrite(10,int64(theta3));
a.servoWrite(11,int64(theta4));
end
for j = 10:0.5:20
x = 14;
z = j;
y = -5;
d = sqrt((x*x)+(y*y));
phai = atan2(d,z);
r = [1 0 0;0 cos(phai) -sin(phai); 0 sin(phai) cos(phai)];
t1 = atan2(y,x);
A = (x-(a3*cos(t1)*cos(phai)));
B = (y-(a3*sin(t1)*cos(phai)));
C = (z-(a3*sin(phai)));
v = sqrt((A*A)+(B*B)+(C*C));
f = (v^2)-(a1*a1)-(a2*a2);
t3 = acos(f/(2*a2*a1));
m = a2*sin(t3);
b = a1+a2*cos(t3);
c = z-a3*sin(phai);
e = sqrt((m*m)+(b*b));
g = sqrt((e*e)-(c*c));
t2 = atan2(c,g)-atan2(m,b);
t4 = phai-t2-t3;
if (t1<0 || t1>pi)
fprintf('try with another coordinates');
else
theta1 = (t1*180)/pi;
end
if (t2<0 || t2>pi/6)
fprintf('try with another coordinates');
else
theta2 = (t2*180)/pi;
end
if (t3<(pi/6) || t3>(pi-pi/6))
fprintf('try with another coordinates');
else
theta3 = (t3*180)/pi;
end
if (t4<pi/6 || t4>(pi-pi/6))
t44 = t4+(2*pi);
theta44 = (t4*180)/pi;
theta4 = (theta44*180)/360;
else
theta4 = (t4*180)/pi;
end
a.servoWrite(8,int64(theta1));
a.servoWrite(9,int64(theta2));
a.servoWrite(10,int64(theta3));
a.servoWrite(11,int64(theta4));
end
clc
clear all
global a;
a = arduino('com5');
a.servoAttach(8);
a.servoAttach(9);
a.servoAttach(10);
a.servoAttach(11);
a.servoWrite(8,0);
a.servoWrite(9,0);
a.servoWrite(10,0);
a.servoWrite(11,0);
a1 = 11;
a2 = 6.5;
a3 = 7.5;
for j = 0:3:360
R = 5;
x = 14;
z = R*sin(j);
y = R*cos(j);
d = sqrt((x*x)+(y*y));
phai = atan2(d,z);
r = [1 0 0;0 cos(phai) -sin(phai); 0 sin(phai) cos(phai)];
t1 = atan2(y,x);
A = (x-(a3*cos(t1)*cos(phai)));
B = (y-(a3*sin(t1)*cos(phai)));
C = (z-(a3*sin(phai)));
v = sqrt((A*A)+(B*B)+(C*C));
f = (v^2)-(a1*a1)-(a2*a2);
t3 = acos(f/(2*a2*a1));
m = a2*sin(t3);
b = a1+a2*cos(t3);
c = z-a3*sin(phai);
e = sqrt((m*m)+(b*b));
g = sqrt((e*e)-(c*c));
t2 = atan2(c,g)-atan2(m,b);
t4 = phai-t2-t3;
if (t1<0 || t1>pi)
fprintf('try with another coordinates');
else
theta1 = (t1*180)/pi;
end
if (t2<0 || t2>pi/6)
fprintf('try with another coordinates');
else
theta2 = (t2*180)/pi;
end
if (t3<(pi/6) || t3>(pi-pi/6))
fprintf('try with another coordinates');
else
theta3 = (t3*180)/pi;
end
if (t4<pi/6 || t4>(pi-pi/6))
t44 = t4+(2*pi);
theta44 = (t4*180)/pi;
theta4 = (theta44*180)/360;
else
theta4 = (t4*180)/pi;
end
a.servoWrite(8,int64(theta1));
a.servoWrite(9,int64(theta2));
a.servoWrite(10,int64(theta3));
a.servoWrite(11,int64(theta4));
end