%step by step Explanation of Forward Kinematics Of a 2R Robotic Arm Manipulator
% Inputs
Link 1 = (l1)
Link 2 = (l2)
theta1 = Rotating Direction B/W the Link 1
theta2 = Rotating Direction B/W the Link 2
% Co ordinates
(x0,yo) = starting points of the 2R-Robotic Arm
(x1,y1) = positions of link 1
L1*cosd(theta1),L1*sind(theta 1= End points of the link 1
(x2,y2) = positions of link 2
x1+L2*cosd(theta2),y1+L2*sind(theta2) = End points of the link 2
Linspace = It is used to determine the INB/W values
Eg = (0,90,10)
= (0 10 20 30 40 50 60 70 80 90)
In this the for loop is used for calculating the values of THETA1 & THETA2
THETA1 = (i)
THETA2 = (j)
From given values (i),(j) the THETA values can be determined
From this function the animation videos of plotting can be identified
movie(M)
videofile = videowriter('forward_kinematics.avi','uncompressed AVI');
open(videofile)
writevideo(videofile,m)
close(videofile)
% Forward Kinematics Of a 2R Robotic Arm Manipulator
% Inputs
l1 = 1;
l2 = 0.5;
theta1 = 45;
theta2 = 90;
% Co ordinates
x0 = 0;
y0 = 0;
x1 = l1*cosd(theta1);
y1 = l1*sind(theta1);
x2 = x1+2*cosd(theta2);
y2 = y1+l2*sind(theta2);
%plotting
line([x0 x1],[y0 y1],'linewidth',3,'color','b');
line([x1 x2],[y1 y2],'linewidth',3,'color','r');
%inputs
L1 = 1;
L2 = 0.5;
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
ct=1;
for i=1:length(theta1)
THETA1 = theta1(i);
for j=1:length(theta2)
THETA2 = theta2(j);
x0 = 0;
y0 = 0;
x1 = L1*cosd(THETA1);
y1 = L1*sind(THETA1);
x2 = x1+L2*cosd(THETA2);
y2 = y1+L2*sind(THETA2);
%plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3);
axis([-0.1 1.5 0 1.5])
pause(0.3)
M(ct) = getframe(gcf);
ct=ct+1;
end
end
movie(M)
videofile = videowriter('forward_kinematics.avi','uncompressed AVI');
open(videofile)
writevideo(videofile,m)
close(videofile)