2-dof arm simulation
Intro:to show the movement of 2dof arm by stitching all the plots to make animation video
https://youtu.be/bHRlGrCj9pQ this is the link for my video
since i had some problem using magick app so i used a differnt tool for making it
main problem that i faced was, octave crashing when computing more than 25 plots
thats why ihave created the video file with only 25 png images
close all
clear all
clc
%kinetics of two arm robot
%inputs
theta1=linspace(0,90,5)
theta2=linspace(0,90,5)
l1=1
l2=3
ct=1;
%loops
for i=1:length(theta1);
THETA1=theta1(i);
for j=1:length(theta2);
THETA2=theta2(j);
x0=0;
y0=0;
x1=l1*cosd(THETA1);
y1=l1*sind(THETA1);
x2=x1+l2*cosd(THETA2);
y2=y1+l2*sind(THETA2);
%PLOTTING
figure(ct)
hold on
plot([x0,x1],[y0 y1],'linewidth',3,'color','b')
plot([x1 x2],[y1 y2],'linewidth',4,'color','r')
axis([-0.1 4 0 4])
pause(0.03)
file_plot=sprintf('movement%d.png',ct)
saveas (gca, file_plot);
ct=ct+1;
end
end
we create a 2 arm robotic motion with the help of the angles swept by them using nested loop by plotting different angular positions, plots are created then the plots are saveas using sprintf inbuilt function then with the help of a gif making tool made into video format