Project

Simulating the forward kinematics of a 2R Robotic arm

AIM:By using matlab simulate the forward kinematics of a 2R Robotic arm.

Theory: To study of moving bodies and parts is called kinematics,we use kinematics to facilitate the discussion of the parts of robots like sensors,arms,joints and manipulaters.

when we know joints,angles,links,link lengths of the robot arm,we use forward kinematics to caluclate the positions of the robotic arms. these robotic arms are used widely in industrial areas to lifting the loads and also perform certain tasks which at the human risk is more.

figure:

2R-Robotic arm

As we show in fig,the robotic arm has two links ,link1 and link2.the link1 is attached to the base and link2 is attached to the link1 respectively,which we called manipulater.let L1 be the length of link1 which makes angle `theta1`w.r.t to the base and L2 be the length of link2 which makes angle `theta2` w.r.t to the link1.

coordinates:

Link1 will be having coordinates(x0,y0)=(0 ,0)and ending coordinates(x1,y1)

Link2 will be having coordinates(x1,y1)and ending coordinates(x2,y2)

formulae used:

x1=L1.cos`theta1`

y1=L1.sin`theta1`

x2= x1+L2.cos`theta2`

y2=y1+ L2.sin`theta2`

PROGRAM:

%Program for forward kinematics of 2R Robotic arm(vedio)
clear all
close all
clc
 %inputs 
 l1=4
 l2=5
 
 theta1=linspace(0,90,8);
 
 theta2=linspace(0,90,8);
 ct=1;
 for i=1:length(theta1)
     T1=theta1(i);
     for  j=1:length(theta2)
         T2=theta2(j);
         
         x0=0;
         y0=0;
         
         x1=l1*cosd(T1);
         
         y1=l1*sind(T1);
         
         x2=x1+l2*cosd(T2);
         
         y2=y1+l2*sind(T2);
         
        
         %ploting
         
          
         plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
         axis([-1 12 -1 12])
         pause(0.02)
         M(ct)=getframe(gcf);
          ct=ct+1; 
     end
 end
 movie(M)
 videofile=VideoWriter('foward_kinematics.avi','uncompressed AVI');
 
 open(videofile);
 writeVideo(videofile,M);
 close(videofile)
 
 

Step wise explaination to perform program:

*Initially we take values of inputs that length of two links L1=4 and L2=3 respectively.

* we supposed to use the command linspace for `theta1`and `theta2` ranged between 0 to 90 with 10 equal parts.

*We got the values of all coordinates ,then start looping the diffirent values of `theta1`and `theta2`.

*Here we are using the 'count' because of to define certain repeated work in program with count ct=1;ct=ct+1 to collect the all frames .

*After ploting we should arrange our required axis w.r.t the L1 and L2 with command as shown in figure.

*We can pause the frame with required seconds using command ,ex:(0.3).

*We can do all the frames will be in animation by using required commands shown in above program.

Animation video:

RESULT:

Simulation of forward kinematics of a 2R Robotic arm is done by using the matlab and workspace is estimated.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.