Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Loading...

All Courses

All Courses

logo

Loading...
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. Bharath Gaddameedi /
  3. Week 2- 2R Robotic Arm Challenge

Week 2- 2R Robotic Arm Challenge

AIM: To simulate the forward kinematics of the 2R arm manipulator in MATLAB. PROBLEM STATEMENT:                                         L1 is the length of link1 and l2 is the length of link 2. θ1θ1is the angle…

  • MATLAB
  • Bharath Gaddameedi

    updated on 23 Feb 2022

AIM: To simulate the forward kinematics of the 2R arm manipulator in MATLAB.

PROBLEM STATEMENT: 

                                      

L1 is the length of link1 and l2 is the length of link 2.

θ1θ1is the angle between link 1 and horizontal and Î¸2θ2 is between link 2 and horizontal axis.

and x0, y0 are the coordinates at the base. x1,y1 is the position of the joint between links 1 and 2.

x2, y2 is the end position of link 2.

OBJECTIVE: 

  • To write a Matlab code to simulate the mechanism.
  • generate the animation of the plot of the positions at different angles.

CODE EXPLANATION:

  • First, define the geometry of the mechanism. like the length of links.
  • we are going to animate the mechanism at different angles, so the angles are defined as ranges between 0 and 90 with 10 degrees intervals.
  • To find and plot positions of links at different angles we have for loop is used.
  • the outer loop is for the angle between link 1 and horizontal and the inner loop is for link 2 and horizontal axis i.e., theta 2.
  • then the position of links are calculated using the formula
  •  x0 = 0; y0 = 0
    x1 = l1*cosd(THETA1), y1 = l1*sind(THETA1)
    x2 = x1 + l2*cosd(THETA2);
    y2 = y1 + l2*sind(THETA2);
  • These coordinates are then plotted. 
  • for creating an animation file counter variable ct is used to track each frame.
  • then the Movie command is used to write the animation in the named file.

Code

%forward kinematics of 2R robotic arm manipulator
clear 
close all
clc

%inputs to define the geometry of mechanism
l1 = 1; 
l2 = 0.5; % lengths of two arms of manipulator

theta1 = linspace(0,90,10);
theta2 = linspace(0,90,10); %angle between arms and horizontal axis

ct = 1; %counter for keeping track of frames
for i = 1:length(theta1)
    THETA1 = theta1(i);
    for j = 1:length(theta2)
        THETA2 = theta2(j);
        x0 = 0; y0 = 0; %base of the robotic arm
        x1 = l1*cosd(THETA1); y1 = l1*sind(THETA1); %positions of link 1
        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.5 0 1.5])
        M(ct) = getframe(gcf); %saving the frames
        ct = ct+1;
    end
end

movie(M)
videofile = VideoWriter('Forward.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)

ERRORS While programming: 

The most common error I have made during the programming is the mistakes with case-sensitive commands.

RESULTS:

The Matlab program is executed and the animation plot is hence obtained.

Link for the animation plot of 2R robotic arm manipulator: https://youtu.be/Sd87VtSnUdo.

 

 

 

 

 

 

Leave a comment

Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.

Please  login to add a comment

Other comments...

No comments yet!
Be the first to add a comment

Read more Projects by Bharath Gaddameedi (12)

Week 1- Mixing Tee

Objective:

                                                                                          â€¦

calendar

08 Jul 2023 06:07 PM IST

    Read more

    Week 3 Challenge : CFD meshing on Turbocharger

    Objective:

                                                                                               â€¦

    calendar

    22 Apr 2023 07:04 AM IST

    • CFD
    Read more

    Week 2 Challenge : Surface meshing on a Pressure valve

    Objective:

                                  Surface meshing on a Pressure valve Aim: Check the geometrical errors on the pressure valve and perform topology cleanup. Meshing it for three target lengths. Objectives: Mesh it for target lengths 1mm, 3mm, and 5mm.…

    calendar

    10 Apr 2023 03:12 AM IST

    • CFD
    Read more

    Week 7 - Simulation of a 1D Super-sonic nozzle flow simulation using Macormack Method

    Objective:

                                  Simulation of a 1D Super-sonic nozzle flow simulation using Macormack Method Aim: To simulate the isoentropic flow through a quasi 1D subsonic-supersonic nozzle using conservation and non-conservation forms of governing…

    calendar

    19 Dec 2022 08:52 AM IST

      Read more

      Schedule a counselling session

      Please enter your name
      Please enter a valid email
      Please enter a valid number

      Related Courses

      coursecard

      Simulation and Design of Power Converters for EV using MATLAB and Simulink

      4.9

      22 Hours of Content

      coursecard

      Introduction to Hybrid Electric Vehicle using MATLAB and Simulink

      4.8

      23 Hours of Content

      coursecardcoursetype

      Mechanical Engineering Essentials Program

      4.7

      21 Hours of Content

      coursecard

      Vehicle Dynamics using MATLAB

      4.8

      37 Hours of Content

      coursecard

      Introduction to CFD using MATLAB and OpenFOAM

      4.8

      13 Hours of Content

      Schedule a counselling session

      Please enter your name
      Please enter a valid email
      Please enter a valid number

                  Do You Want To Showcase Your Technical Skills?
                  Sign-Up for our projects.