2-D Robotic Arm Manipulator Animation
% Forward Kinematic of a 2-D Robotic Arm Manipulator
clear all
close all
clc
l1= 2; %langth of base arm
l2=1; %length of hand/grabber
t1=linspace(0,90,20); %range of angles, i.e., the space for the movements
t2=linspace(0,90,20);
c=1;
for i=1:length(t1)
T1=t1(i);
for j=1:length(t2)
T2= t2(j);
x0=0;
y0=0;
x1= l1*cosd(T1);
y1= l1*sind(T1);
x2= x1+ l2*cosd(T2);
y2= y1+ l2*sind(T2);
plot([x0 x1], [y0 y1],[x1 x2],[y1 y2] ,\'linewidth\',3)
axis([-2 3 -2 3])
pause (0.05) %speed of frames
%frames
M(c)=getframe(gcf);
c=c+1;
end
end
%creating animation from the frames
movie(M)
vf = VideoWriter(\'2-D_Robotic_Arm.avi\');
open(vf)
writeVideo(vf,M)
close(vf)
VideoLink: https://www.youtube.com/watch?v=x44HNxXI1Zk