2R Robotic Arm Challenge Matlab
AIM :- Write a program in Matlab to simulate the forward kinematics of a 2R Robotic Arm,
DESCRIPTION :- Kinematics is the analysis of motion without considering the forces. Here, we need only geometric properties such as length and degree of freedom of the manipulator bodies.
Forward kinematics refers to use of kinematics equation of a robot to compute the position of end effector from specified values for the joint parameters.
If we know the geometry of the robot and all its joint points, we can do the math and figure out the position and orientation of any point on the robot. i.e, if we can able to figure out how the robot is going to move then we can figure out its workspace (workspace refers to possible location that the robot can reach).
GOVERNING EQUATIONS :- In 2R robotic Arm there are two main governing equation are derived with respect two arms and the equation of Arm will,
X=0,Y= 0(at base)
X1 = L_1*cos(θ_1 )
Y1 = L1*sin(θ_1 )
X2 = X1+L2*cos(θ_2 )
Y2 = Y1+L2*(sinθ_2)
Program:-
close all %to clear the command which is use in past
clear all %to close all the plot
clc %to clear previous data
%inputs of system
l1=1.2; %length of 1st arm
l2= 0.8; %length of 2nd arm
theta1= linspace(0,180,10); %to generate array of 40 elements
theta2= linspace(0,180,10);
ct=1;%(variable which is increase by one to collect the window)
%using 'for' loop for creating different values of theta
for i = 1:length(theta1); % to generate array
THETA1 = theta1(i); % to assign the variables
for j = 1:length(theta2);
THETA2 = theta2(j);
x0 = 0;% initial postion of system
y0 = 0;
%Equation of first link
x1 = l1*cosd(THETA1);
y1 = l1*sind(THETA1);
%Equation of second link
x2 = x1+l2*cosd(THETA2);
y2 = y1+l2*sind(THETA2);
%plotting the data of system
plot([x0,x1],[y0,y1],[x1,x2],[y1,y2],'linewidth',4)
axis([-2 1.5 0 1.5])
pause(0.05)
M(ct)=getframe(gcf);
ct = ct+1;
end
end
%video interface
movie(M)
videofile= VideoWriter('robotics_Arm.avi','uncompressed avi')
open(videofile)
writeVideo(videofile,M)
RESULT :- The simulation of given Program will be attach in files.