Challenge

Week 3.2 - 2R Robotic Arm Challenge

Aim of the project :- To write a program in Matlab to simulate the forward kinematics of 2R Robotic Arm.

Objective :-

  • Write a program to simulate forward kinematics of a 2R Robotic Arm
  • To create a Movie /Animation from the plots obtained from the program

Theory :-

A robotic arm is a type of a mechanical arm , usually programmable , with similar functions to human arm;the arm may be the sum of the total mechanism or may be the part of more complex robot. The links of such manipulator are connected by joints allowing either rotational motion (such as in an articulated robot) or transational (linear) dispalcement. The links of the manipulator can be considered to form a kinematic chain. The terminus of the kinematic chain of the manipulator is called the end effector and it is analogous to human hand.

In this project, we consider a 2R robotic arm . A 2R robotic arm represents a robotic arm with two rotations. i.e. it has two links which rotate or work over a two-dimensional plane with each of links having a single degree of freedom.

Also, both the links are restricted to 90 degree rotation w.r.t. the axes. Fig below shows the 2R robotic arm having many parts as described.

  • Let , L1& L2 be the lenghts of the link-1 & link-2 respectively
  • Let,`theta1' be the angle formed by link 1 with horizontal
  • Let,`theta2' be the angle formed by link 2 with horizontal
  • Let, the starting and end co-ordinates of link-1 to be (x0,y0) & (x1,y1)
  • Let, the starting and end co-ordinates of link-2 to be (x1,y1) & (x2,y2)
    % Progrma for 2R Robotic arm
    clear all
    close all
    clc
    
    %Inputs
    l1=1;
    l2=0.5;
    theta1=linspace(0,90,12);
    theta2=linspace(0,90,12);
    ct=1;
    
    for i=1:length(theta1);
        THETA1=theta1(i);
    
    for j=1:length(theta2);
        THETA2=theta2(j);
    
        x0=0;
        y0=0;
        x1=l1*cosd(THETA1);
        y1=l1*sind(THETA1);
    
        x2= x1+l2*cosd(THETA2);
        y2= y1+l2*sind(THETA2);
    
        %Plotting
        plot([x0,x1],[y0,y1],[x1,x2],[y1,y2],'LineWidth',3)
        axis([-0.1 2 0 1.5])
        pause(0.03)
        M(ct)=getframe(gcf);
        ct=ct+1
    end
    
    end
    
    movie(M)
    Videofile=VideoWriter('forwardkinematic.avi','Uncompressed AVI')
    open(Videofile)
    writeVideo(Videofile,M)
    close(Videofile)

https://youtu.be/4592LQpRk4k

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.