2R-Robotic Arm
AIM:-
Create a MATLAB program for forward kinamatics of robotic arm whit the below mentioned dimensions.
length of the first arm(L1)=10 cm.
length of the second arm(L2)=7 cm.
First arm max angle can make 0-90 digrees.
Second arm angle can make 0-360 digrees.
MATHEMATICAL EQUATIONS:-
L1= Length of the first arm (cm) = 15 cm.
L2=Length of the second arm (cm) = 7 cm.
Theta1= angle of the first arm (varies from 0 deg to 90 deg) WRT X-axis.
Theta2=angle of the second arm (varies from 0 deg to 360 deg) WRT X-axis.
X0=The base position the robotic arm WRT X-axis.
X1=The end position the robotic arm first link WRT X-axis.
X2=The end position the robotic arm second link WRT X-axis.
Y0=The base position the robotic arm WRT Y-axis.
Y1=The end position the robotic arm first link WRT Y-axis.
Y2=The end position the robotic arm second link WRT Y-axis.
`X1=X0+(L1⋅cos(θ1))`
`Y1=Y0+(L1⋅sin(θ1))`
`Y2=Y1+(L2⋅sin(θ2))`
`X2=X1+(L2⋅cos(θ2))`
MATLAB code mentioned below:-
clc
clear all
close all
% program for kinamatic robotic arm
%Length of links
L1=15;
L2=7;
ct=1;
theta1=linspace(0,90,20);%first arm angle
theta2=linspace(0,360,36);% second arm angle
for i=1:length(theta1);
Theta1=theta1(i);
for j=1:length(theta2);
Theta2=theta2(j);
x0=0;
y0=0;
y1=L1* sind(Theta1);%position of the first arm end in Y axis
x1=L1* cosd(Theta1);%position of the first arm end in x axis
x2=x1+(L2*cosd(Theta2));%position of the second arm end in X axis
y2=y1+(L2*sind(Theta2));%position of the second arm end in Y axis
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',2)
axis([-10 30 -10 30]);
pause(0.0000001)
M(ct)=getframe(gcf);
ct=ct+1;
end
end
%Movie making code
movie(M);
videofile=VideoWriter('forward_kinamatics.avi','Uncompressed AVI');
open(videofile);
writeVideo(videofile,M);
close(videofile);
% plot(X1,Y1)
PLOTS:-
animation video link is https://youtu.be/3T7KqSohpFQ
CONCLUSION:-
from the plots or animation video we can see the workable space of the robotic arm.
ERRORS & CORRECTIONS:-
1. we have to use defined constants perfectly.('theta = 45' while we are calling this constant we have to use same as 'theta').
2.while programming make sure of the functions and its spellings.(possible mistakes are linspace-linespace, Movie-movie)