Week 3.2 - 2R Robotic Arm Challenge
REPORT
- code
clear
close
clc
- step : 1
- defenition of length of link l1 &l2
l1 = 1;
l2 = 0.5;
- step :2
- definition of angles
theta1 = linspace (0, 60, 10);
theta2 = linspace (0, 90, 10);
ct = 1;
- assuming fixed angles
%theta1 = 60;
%theta2 = 30;
- naming i & j
for i = 1:length(theta1)
Theta1 = theta1(i);
for j = 1:length(theta2)
Theta2 = theta2(j);
- step 3
- calculation of position
x0 = 0;
y0 = 0;
x1 = l1*cosd(Theta1);
y1 = l1*sind(Theta1);
x2 = x1 + l1*cosd(Theta2);
y2 = y1 + l1*sind(Theta2);
figure(1)
plot([x0 x1],[y0 y1], [x1 x2], [y1 y2]);
axis([ 0 2 0 2]);
M(ct) = getframe(gcf);
ct = ct+1;
end
end
movie(M)
videofile = VideoWriter('roboticarm.avi','Uncompressed AVI');
open (videofile)
writeVideo (videofile,M)
close(videofile)
2. Errors faced
unrecognised error at naming 'M'
3. Step taken
added M(ct) = getframe(gcf);
