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

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

All Courses

All Courses

logo

CHOOSE A CATEGORY

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

Top Job Leading Courses

Automotive

CFD

FEA

Design

MBD

Med Tech

Courses by Software

Design

Solver

Automation

Vehicle Dynamics

CFD Solver

Preprocessor

Courses by Semester

First Year

Second Year

Third Year

Fourth Year

Courses by Domain

Automotive

CFD

Design

FEA

Tool-focused Courses

Design

Solver

Automation

Preprocessor

CFD Solver

Vehicle Dynamics

Machine learning

Machine Learning and AI

POPULAR COURSES

coursePost Graduate Program in Hybrid Electric Vehicle Design and Analysis
coursePost Graduate Program in Computational Fluid Dynamics
coursePost Graduate Program in CAD
coursePost Graduate Program in CAE
coursePost Graduate Program in Manufacturing Design
coursePost Graduate Program in Computational Design and Pre-processing
coursePost Graduate Program in Complete Passenger Car Design & Product Development
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. selva balaji/
  3. FORWARD KINEMATICS OF 2R ROBOTIC ARM USING PYTHON

FORWARD KINEMATICS OF 2R ROBOTIC ARM USING PYTHON

AIM        To write a program to simulate the forward kinematics of the 2R robotic arm and create an animation file on the plot 2R ROBOTIC ARM                  It consists of two links. The first link is connected to the base in an angle of theta1. And the…

    • selva balaji

      updated on 25 May 2019

    AIM

           To write a program to simulate the forward kinematics of the 2R robotic arm and create an animation file on the plot

    2R ROBOTIC ARM

                     It consists of two links. The first link is connected to the base in an angle of theta1. And the second link is connected with the first link. The starting point of the second link is the ending point of the first link. The second link is at an angle of theta2 to the normal. The endpoint of the second link is used for the machining processes like welding or any process.

    PROGRAM TO SIMULATE THE ROBOTIC ARM

    import math
    import matplotlib.pyplot as plt 
    
    #inputs
    l1 = 1
    l2 = 0.5
    
    #thetas
    n_theta = 10
    theta_start = 0
    theta_end = math.pi/2
    theta_1 = []
    theta_2 = []
    
    for i in range(0,n_theta):
    	tmp = theta_start+i*(theta_end-theta_start)/(n_theta-1)
    	theta_1.append(tmp)
    	theta_2.append(tmp)
    	
    
    #initial coordinates
    x0 = 0
    y0 = 0
    
    #loop for creating 100 values 
    ct = 1
    for t1 in theta_1:
    	for t2 in theta_2:
    		x1 = l1*math.cos(t1)
    		y1 = l1*math.sin(t1)
    		x2 = x1+l2*math.cos(t2)
    		y2 = y1+l2*math.sin(t2)
    		filename = 'test%05d.png'%ct +'.png'
    		ct = ct + 1
    
    		
    		plt.figure()
    		plt.plot([x0,x1],[y0,y1])
    		plt.plot([x1,x2],[y1,y2])
    		plt.xlim([0,2])
    		plt.ylim([0,2])
    		plt.savefig(filename)
    		

    EXPLANATION

    • The lengths of the link1 and link2 are given as 1 m and 0.5 m respectively
    • Then no of theta values for which the simulation to be done is given as 10
    • The limits for the theta should be given (ie) the starting and ending value of theta. Between the starting and ending value of theta, there will be ten no. of values.
    • The starting value of theta is 0 and the ending value of theta is 90
    • For calculating the ten values between the starting and ending, 'for loop' is used
    • For both the thetas separate empty array is created and using 'append' command the values are stored in the respective arrays
    • The coordinates of the starting point of the first link are (0,0)
    • The coordinates of the ending point of the first link are calculated by means of angle theta. As there are different values of theta another 'for loop' is created to calculate the coordinates
    • Then using plot command the coordinates are plotted and there should be 100 plots 
    • To obtain those 100 plots, the counter variable is used
    • Then using magick command all the 100 plots are stitched and an animation file is created

    ANIMATION LINK

                        https://youtu.be/P5nyKoEfJG8

     

    RESULT 

              Thus the program was coded to simulate the 2R Robotic arm and an animation file was created on it.

    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 selva balaji (17)

    COMPARISON OF BENDING OF BEAMS

    Objective:

    AIM     To compare the performances of three types of beams under a bending load and to choose the best one among the three types CASE1: RECTANGULAR BEAM                                            …

    calendar

    18 Jun 2019 08:35 AM IST

      Read more

      SOLVING ODE FOR THE TRANSIENT BEHAVIOUR OF SIMPLE PENDULUM USING PYTHON

      Objective:

      AIM        To write a program to simulate the transient behavior of the simple pendulum and create an animation on its motion ODE                The above equation is a second-order equation. It cannot be solved as it is so it should be split into two first-order…

      calendar

      31 May 2019 05:36 AM IST

        Read more

        DATA ANALYSIS USING PYTHON

        Objective:

        AIM         To write a program to create a visualizer tool which will read the given data and required information is taken from the data file  PROGRAM : import matplotlib.pyplot as plt import math import numpy as np import sys #compatibility check try : file = open(\'engine_data.out\',\'r\')…

        calendar

        31 May 2019 04:06 AM IST

          Read more

          CURVE FITTING USING PYTHON

          Objective:

          AIM        To write a program to perform curve fitting. CURVE FIT            Curve fitting is a process of constructing a curve or a mathematical function that has been best fit to the series of data points. By curve fitting, we can obtain the relationship between the observed…

          calendar

          28 May 2019 01:11 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

            Design loads considered on bridges

            Recently launched

            10 Hours of Content

            coursecard

            Design of Steel Superstructure in Bridges

            Recently launched

            16 Hours of Content

            coursecard

            Design for Manufacturability (DFM)

            Recently launched

            11 Hours of Content

            coursecard

            CATIA for Medical Product Design

            Recently launched

            5 Hours of Content

            coursecardcoursetype

            Accelerated Career Program in Embedded Systems (On-Campus) Courseware Partner: IT-ITes SSC nasscom

            Recently launched

            0 Hours of Content

            Schedule a counselling session

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

            logo

            Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.

            https://d27yxarlh48w6q.cloudfront.net/web/v1/images/facebook.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/insta.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/twitter.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/youtube.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/linkedin.svg

            Our Company

            News & EventsBlogCareersGrievance RedressalSkill-Lync ReviewsTermsPrivacy PolicyBecome an Affiliate
            map
            EpowerX Learning Technologies Pvt Ltd.
            4th Floor, BLOCK-B, Velachery - Tambaram Main Rd, Ram Nagar South, Madipakkam, Chennai, Tamil Nadu 600042.
            mail
            info@skill-lync.com
            mail
            ITgrievance@skill-lync.com

            Top Individual Courses

            Computational Combustion Using Python and CanteraIntroduction to Physical Modeling using SimscapeIntroduction to Structural Analysis using ANSYS WorkbenchIntroduction to Structural Analysis using ANSYS Workbench

            Top PG Programs

            Post Graduate Program in Hybrid Electric Vehicle Design and AnalysisPost Graduate Program in Computational Fluid DynamicsPost Graduate Program in CADPost Graduate Program in Electric Vehicle Design & Development

            Skill-Lync Plus

            Executive Program in Electric Vehicle Embedded SoftwareExecutive Program in Electric Vehicle DesignExecutive Program in Cybersecurity

            Trending Blogs

            How to Learn CAD Design: Step-by-Step GuideGD&T Basics: How to Read and Apply GD&T Symbols SolidWorks vs Creo: Best CAD Software to Learn for Mechanical Engineers Engineering Edtech in India: Busting Myths & Building Careers How to Get a Core Mechanical Engineering Job After Graduation

            © 2025 Skill-Lync Inc. All Rights Reserved.

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