Week 2- 2R Robotic Arm Challenge
Objective
To simulate the forward kinamatics of a 2R Robotic Arm.
SOLUTION
To simulkate the kinamatics of 2R robotic arm we need to find the positions of the 2 links,
link 1 and link 2.
length of the link 1 = l1 , lengthe of link 2 = l2
angle between the base and link1 (l1) is thete 1
angle between the link1 &2 is theta 2
`x=lcos theta`
`x1=l1 cos theta`
`y1= l1 sin theta`
`x2=x1+l2 cos theta`
`y2=y1+l2 sin theta`
program
FORWARD KINAMTICS OF 2R ROBOTIC ARM.
% forward kinamatics of 2r robotic arm
clear all
close all
clc
%inputs
l1= 1;
l2= 0.5;
theta1 = linspace(0,90,10);
theta2 = linspace(0,80,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.1)
M(ct)=getframe(gcf);
ct=ct+1;
end
end
%video output
movie(M)
videofile = VideoWriter('forward_kinamatic.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)
OUTPUT:
the YOU TUBE LINK FOR THE OUTPUT VIDEO
the picture shows the forward kinematics of 2R robotic arm.
plot for the program to represent the forward kinematics of 2r robotic arm.
ERROR
while running the program there are some issues or errors faced . most of them caused due to the syntax errors and mismatches. some of them are included in this report
1

2
3
4
