Week 2- 2R Robotic Arm Challenge
Objective : To simulate the forward kinmatics of 2R robotic arm
Theory : A obotic arm is a type of mechanical arm pogramable with similar function of human arm, the arm may be sum total of mechanism or may be more complex robot. The link of such a manipulator are connected by joints making them to move in different motion

Inputs
1. Length of the Links
Lenght of link l1 = 1
Length of link l2 = 0.5
2. Coordinates of the Links
(x0,y0) The base of the link
(x1,y1) End of first link and starting of second link
(x2, y2) Coordinate of manipulator
Code :
%robotic arm
Clear all
Close all
clc
%inputs
l1 = 1;
l2 = .5;
%Angle between the base and robortic arm
theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10);
%for end loop
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 = l2*sind(THETA1);
x2 = x1+l2*cosd(THETA2);
y2 = y1+l2*sind(THETA2);
plot ([x0 , x1] , [y0 , y1] , [x1 , x2] , [y1 , y2] , 'linewidth', 3);
grid on;
axis([-0.1 1.5 0 1.5])
pause(0.001)
M(ct) = getframe(gcf)
ct=ct+1
end
end
%onversion of plot into vedio
movie(M)
videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
Result :

Note : Vedio attached in PPT