Week 3.2 - 2R Robotic Arm Challenge
AIM: To plot the movement of thr robotic arm.
THEORY: In this intially two links are considered in which the link one is for greater length than the link two.then both the links increases their angles gradually and this difference is plotted in the graph using animation so thet we could easily plot the movement of the links.
close all
clear all
clc
l1=1;
l2=0.5;
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);
x0 = 0;
y0 = 0;
x1 = l1*cosd(THETA1);
y1 = l1*sind(THETA1);
x2=x1+l1*cosd(THETA2);
y2=y1+l2*sind(THETA2);
%plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',4)
axis([0.1 1.5 0 1.5])
pause(0.03)
M(ct) = getframe(gcf)
ct=ct+1;
end
end
movie(M)
videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
in tis the basic statements close all,clearall,clc are used so that the worspace is empty and we could start fresh without any of the codes running at the back.this programme is done so that we could craete a animation of set of graphs joined together to form a animated video.in this programme we are considering two links l1 andl2 in which l1 is larger and l2 is smallerand the principle behind this robotic arm is that the from the base the link 1 moves and then link 2 is used to fo the further movement of the link inorder to perform the tasks asigned to it.
in this we are assigning l1=1and l2=0.5 and then the links gets eleveted from the base at a angle and the link 2 also makes an angle apart from link so we name them theta1 and theta2 and we give a command linspace(0,90,10)this command gives out a clear cut message that angle should vary from 0 to 90 with 10 equal intervals.and then we use a for loop command so that this loop act as a trap so that no
https://drive.google.com/file/d/1by0IxY2SQdaqmVgocV23thCs9vxTqIfG/view?usp=sharing