Week 2- 2R Robotic Arm Challenge
PROGRAM
%forword kinamatic program
clear all
close all
clc
%inputs
l1=2;
l2=4;
theta1=linspase(0,90,10
theta2=linespase(0,85,10);
ct=1;
for i=lenth(theta1)
THETA1=theta1(i);
for j=lenth(theta2)
THETA2=theta2(j);
x0=0;
yo=0;
x1=l1*cosd(THETA1);
y1=y1l*sind(THETA1);
x2=x1+cosd(THETA2);
y2=y1+cosd(THETA2);
%plotting
plot([xo x1],[y0 y1],[x1 x2][,y1 y2],'linewidth'3)
axies([-0.1 3.5 0 3.5])
puse(0.1)
M(ct)=getframe(gcf);
ct=ct+1;
end
end
%To create animation of forword kinamatics
movie(M)
videofile=videowriter('forword kinamatic avi','Ucompressed AVI');
open( videofile)
writevideo(videofile,M);
close(videofile)
PRESENTATION
1.linspace - used for angle set (0,90)
2.theta-use to show the angle function
3.cosd&sind- use to the trigonamatric function
4.for&end-show for b the for loop
5.plot-use to plot the command.
6.axies-to menshion the axies on the graph
7.puse-puse the function
8.movie -to create a movie
9.videowriter-write the text on video
10.open-to open the video
11.close-to close the video
12.writevideo-to show the video