Week 2- 2R Robotic Arm Challenge
Poject:
Stimulate the forwad kinematics of a 2R robotic arm using matlab program.
Basically it is a Robtic arm having two links and two rotating joints .

In this program, we are going to use the basic arms of the robot to do that we are dealing with the linkage known as Forward kinematics of a 2R Robotic arm i.e 2 links and 2 rotating joints . We are taking two links as a representative of the Robotic arm in which Link-1 is Hinged at 01 point (X0, Y0) and making an angle `theta1, while Link-2 is hinged at the end of the Link-1 and making angle `theta`2 .
Steps taken to program :
1. We are taking two links L1 and L2 ,their lenghts 1.5m and 1m respectively.
2. Two rotaing joints theta1 with respect to base and theta2 is the rotational joint of link1 and link2 , withrespect to the joints we have 3 coodinates .
3. Coodinates are
1. X0=0 ,Y=0
2. X1=L*cos(theta1),Y1=L*sin(theta2)
3. X2=x1+l*cos(theta2),Y2=y1+L*cos(theta2)
Here is the final program;
clear all
close all
clc
% Forwad kinematics for robotic arm
clear all
close all
clc
%intputs
%length
l1 = 1.5;
l2 = 1.0;
% Angel of the roboric arm
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,30);
ct = 1;
for i = 1:length(theta1)
THETA1 = theta1(i);
for j = 1:length(theta2)
THETA2 = theta2(j);
%coordinates
x0 = 0;
y0 = 0;
x1 = l1*cosd(THETA1);
y1 = l1*sind(THETA1);
x2 = x1 + l2*cosd(THETA2);
y2 = y1 + l2*sind(THETA2);
%Ploting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
axis([-0.1 2.5 0 2.5])
pause(0.02)
M(ct) = getframe(gcf);
ct = ct+1;
end
end
movie(M)
videofile = VideoWriter("Forward_kinematics_avi.fig",'Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
Error facing while programming:

>>There is a small typing error (linespace) ,further rectify to linspace.

>>rectify to j=1:length(theta2)
Conclusion:
Hence, We are able to Program the 2R robotic Arm, with the help of this program.
Here is the youtube link of the animation;