Challenge

Week 2- 2R Robotic Arm Challenge

Youtube Link for animation

https://youtu.be/36vEpdLh0R8

REPORT--

STEPS

  1. Initializing the arm length and inclination angles.
    l1=1; % length of arm 1
    l2=0.5; % length of arm 2
    theta1=linspace(0,90,10); % inlcnation values of arm1
    theta2=linspace(0,90,10);
  2. CT- Used for image reconstruction.
  3. using for loop end coordinates are calculated for every angle.
    for i =1:length(theta1) %{loop for plotting of arm 1 and 2
    a=theta1(i); %{ for every change in arm1 and arm2 inclination
    for j=1:length(theta2)
    b=theta2(j); % a= angle of inclination of arm1 and b=angle of inclination of arm2
    x=0; % fixed end coordinates
    y=0;
    x1=l1*cosd(a); %end x coordinates of arm1
    y1=l1*sind(a); %end y coordintes of arm1
    x2=l1+l2*cosd(b); %end x coordinates of arm2
    y2=l1+l2*sind(b); %end y coordintes of arm2
  4. plotting is done using plot instead of line command.
    plot([x x1],[y,y1],[x1 x2],[y1 y2],LineWidth=1.5)
    axis([0 2 0 2])
    xlabel('horizontal reach---------->')
    ylabel('verticl reach----------->')
  5. animation is created by using CT and Pause.
    
    
    close all
    clear all
    clc
    
    l1=1;                                  % length of arm 1
    l2=0.5;                                % length of arm 2
    theta1=linspace(0,90,10);              % inlcnation values of arm1
    theta2=linspace(0,90,10);              %inlcnation values of arm2
    tic
    ct=1
    for i =1:length(theta1)       %{loop for plotting of arm 1 and 2
        a=theta1(i);              %{ for every change in arm1 and arm2 inclination
        for j=1:length(theta2)
            b=theta2(j);          % a= angle of inclination of arm1 and b=angle of inclination of arm2  
    
            x=0;              % fixed end coordinates
            y=0;
    
            x1=l1*cosd(a);    %end x coordinates of arm1
            y1=l1*sind(a);    %end y coordintes of arm1
    
            x2=l1+l2*cosd(b); %end x coordinates of arm2
            y2=l1+l2*sind(b); %end y coordintes of arm2
    
            %plotting...........
            plot([x x1],[y,y1],[x1 x2],[y1 y2],LineWidth=1.5)
            axis([0 2 0 2])
            xlabel('horizontal reach---------->')
            ylabel('verticl reach----------->')
            
    
            %providing the pause for plotting
            pause(0.1)
            M(ct)=getframe(gcf)
            ct = ct+1
        end
    end
    duration=toc
    movie(M) 
    videofile=VideoWriter('forwrd kinematic robotic arm')  %creating a video file
    open(videofile)
    writeVideo(videofile,M)
    close(videofile)
    
  6. Video file is created.

ERRORS--

  1. Error occurred due to dot operator.
  2. Error due to the wrong syntax in pause.
  3. Unable to create animation using the lines.

Steps were taken to solve the error--

  1. Dot operator is removed.
  2. Syntax error in the pause is solved using parenthesis.
  3. Animation is created by using a plot instead of a line.
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.