Week 2- 2R Robotic Arm Challenge
Below mention the code and video link of robotic arm differant positions at differant angle. Considering the two arm robotic arm.
%Forward kinematics of 2R robotic arm manipulator
close all
clear all
clc
%Inputs(use multiple positions of arms(in diff. angle) with linspace)
theta1=linspace(0,90,10) %angle of 1st arm with respect to base in degree
l1=2; %lenght of arm at base
theta2=linspace(0,90,10) %angle of 2nd link with respect to base in degree
l2=1.5; %length of 2nd arm
%use for loop here to getting multiple outputs for multiple values of
%theta1 and theta2
ct=1;
for i=1:length(theta1)
THETA1=theta1(i);
for j=1:length(theta2)
THETA2=theta2(j)
%Co-ordinates
x0=0
y0=0
x1=l1*cosd(THETA1);
y1=l1*sind(THETA1);
x2=x1+l2*cosd(THETA2);
y2=y1+l2*sind(THETA2);
%plotting graphs
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
axis([-0.2 4 -0.2 4])
pause(0.01)
M(ct) = getframe(gcf); %creat aarray of Frame M of counter ct
ct=ct+1;
end
end
movie(M);
videofile=VideoWriter('Robotics_Arm.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)
below share the youtube link of videofile of robotic arm plot