Week 3.2 - 2R Robotic Arm Challenge
clear all
close all
clc
%inputs
%length of robatic amrs
l1=2;
l2=1;
%angle for the movement of robotic arms
theta1=linspace(0,90,10);
theta2=linspace(0,90,10);
ct=1;
for i=1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2= theta2(j);
%starting point of first arm
x0=0
y0=0
%end point of first arm/starting point of 2nd arm
x1=l1*cosd(THETA1);
Y1=l2*sind(THETA1);
%end point of 2nd arm
x2=x1+cosd(THETA2);
y2=Y1+sind(THETA2);
%plotting
%coordinates of arms over set of theta1 and theta2
plot([x0 x1],[y0 Y1],[x1 x2],[Y1 y2],'linewidth',3);
axis([-0.1 4 0 4])
% % pause(0.1)
M(ct)=getframe(gcf);
ct = ct+1;
end
end
%conversion of plot into video
movie(M)
videofile=VideoWriter('forward_kinematics.avi');
open(videofile)
writeVideo(videofile,M)
close(videofile)
https://drive.google.com/file/d/1_xkuNxlLIqN_J0dW48gHb87dsva4zbcE/view?usp=sharing