Challenge

Week 2- 2R Robotic Arm Challenge

thoery & Explanation ;- we are going to use the basic arms of the robot to do that we are dealing with the linkage known as Forward kinematics of a 2R Robotic arm (where 2R means 2-rotating Link i.e 2 is a number of link and R is rotation). we are taking two links as a representative of the Robotic arm in which Link-1 is Hinged at (X0, Y0) and making an angle1, while Link-2 is hinged at the end of the Link-1 and making angle2 with respect to Datum.

To create a Program to doing the animation of 2R Robotic Arm : bY using a linspace Command for the theta values and using for loop for several process of link 1 & link 2

I will Explane step by step in programmimg by using the %

%forword kinematics with the animation of links
%input
l1=1;            %length of link 1
l2=0.5;          %lenght of link 2
theta1=linspace(0,90,10); % taking several angle b/w link 1 & fix point 
theta2=linspace(0,180,20); % taking several angle b/w link 2 & axis of link 1
ct=1;
 for i=1:length(theta1)    %loop for link 1 
     THETA1=theta1(i);
     for j=1:length(theta2)  %loop for link 2
         THETA2=theta2(j);
         x0=0;          % initial axis of link 1
         y0=0;
    %step1 for link 1
         x1=l1*cosd(THETA1);  %these are initial axis for link 2
         y1=l1*sind(THETA1);
    %step2 for link 2
         x2=x1+l2*cosd(THETA2); %this indicates for ending point of link 2
         y2=y1+l2*sind(THETA2);
    % plotting a both link1 and link2 in several frame
  
     pause(0.03); % pause command for speed of running Animation
     plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3);
     axis([-0.1 1.5 0 1.5])
     legend('link1','link2') % color description
     M(ct)=getframe(gcf);  % array get the several frame of animation
      ct=ct+1;   % increment counter for getting all the figure one by one
     end
 end
 movie(M)     % create a movie  of all frame 
 % save the animation and get the  access of file
 videofile=VideoWriter('forward_kinematics.avi','Uncompressed AVI');
 open(videofile)
 writeVideo(videofile,M)  
 close(videofile)

link of video that is uploaded in youtube in Avi - https://youtu.be/__12PqttvbQ

some error that i am faced in programming: missing a counter increment that gives that get the Frame of all figures.

MATLAB Command Window Page 6
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Error in matlab.graphics.internal.getframeWithDecorations>getJavaFrameWithDecorations 
(line 59)
 cdata = getFrameImage(c, withDecorations);
Error in matlab.graphics.internal.getframeWithDecorations (line 29)
 cdata = getJavaFrameWithDecorations(f, withDecorations);
Error in alternateGetframe
Error in getframe (line 71)
 x = alternateGetframe(parentFig, offsetRect, scaledOffsetRect, includeDecorations, 
true, h, offsetRectSpecified);
Error in forword_kinematics (line 26)
 M(ct)=getframe(gcf); % array get the several frame of animation

Again i am Face one more error that is very silly. like missing a upper case alphabet (Videowriter)

VedioWriter is prescribed keyword for the matlab i am write w whereas W is right.

because matlab is case sensitive

 videofile=VideoWriter('forward_kinematics.avi','Uncompressed AVI');
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.