2r robotic arm

2R ROBOTIC ARM

ABOUT:

It is a type of mechanical arm,usually it’s perform a similar function like a human arm.in the 2r robotics arm,the two links and manipulator were connected by the joints and the joints allow to perform either rotational motion or linear displacement.the links of the manipulator can be consider to form a kinematic chain


To create a animation using matlab:

  • First of all,we should understand the concept of forward kinematics 2r robotics arm like how it’s works?,what are the material has been used?,how many linkages and joints has been used?
  • Then,we should do analyse mathematically,

¨     Calculate length and position of link1..

¨     Calculate length and position of link2..


  • For plotting purpose;we pick some co-ordinates,which refers to forward kinematics robotics arm.
  • Starting orgin
  • x0=0;y0=0
  • At link 1: x1=l1cos⍬;y1=l1sin⍬
  • At link 2:x2=x1+l2cos⍬;y2=y2+l2sin⍬
  • [x0 y0][x1 y1][x2 y2]

write a code to create animation link 2r robotic arm:

clear all
close all
clc
%2r_robotic_arm
%input
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);
       %co-ordinates
       x0=0;
       y0=0;
       x1=l1*cosd(THETA1);
       y1=l1*sind(THETA1);
       x2=x1+l2*cosd(THETA2);
       y2=y1+l2*sind(THETA2);
      
       %plotting the co-ordinates
       plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'LineWidth',2,'color','r')
       xlim([-0.2,1.5])
       ylim([0,1.5])
       xlabel('l1')
       ylabel('l2')
       pause(0.05)
       %to create a movie
       M(ct)=getframe(gcf);
      ct=ct+1;
   end

end 
%to generate animation
movie(M)
videofile = VideoWriter('robotic_arm.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)

output:

o/p

ANIMATED VIDEO ON YOUTUBE:


GOOGLE DRIVE LINK:

https://drive.google.com/file/d/182NP_8fYoXdrltAocpznUOFk64GxqOdL/view?usp=drivesdk

ERRORS OCCURRED WHILE PROGRAMMING:

1.

In this error invalid expression on line 41,i just saw the video again,that time only i saw that video writer profile should have semi colon,without semicolon it must not consider as a profile ..

2.

The output should come like this..i don't know what kind of mistake i have been done,once again i start read again.then i found it,i missed d in cos⍬.In matlab actually,it comes like cosd⍬ because it only represent mathematical cos⍬.otherwise,it consider as a radian.its a small mistake but huge impact in o/p...

 

3.

All the lines are appear in the animated video,then i saw the command & i think hold on command will hold the lines and figure.so,i erase it.then it works properly

 

Comments

Popular posts from this blog

simple pendulum using matlab

DRAG FORCE