Project

Simulation of Forward Kinematics of a 2R Robotic Arm

Objective:

To write a program to simulate the forward kinematics of a 2R Robotic Arm

Problem Statement:

A robotic arm is a type of mechanical arm, usually programmable. The arm may be the sum total of the mechanism or may be part of a more complex robot. The links of such a manipulator are connected by joints allowing either rotational motion or translational(linear) displacement. 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. An end effector is a device at the end of a robotic arm, designed to interact with the environment.

Kinematics is the analysis of motion without considering the forces acting on it. Here, we need only geometric properties such as length and degree of freedom of the manipulator bodies.

Forward kinematics refers to the use of the kinematics equation of a robot to compute the position of the end effector from specified values for the joint parameters. The kinematics equations for the series chain of a robot are obtained using a rigid transformation to characterize the relative movement allowed at each joint and separate rigid transformation to define the dimensions of each link.

In this project, we are considering a 2R Robotic Arm, which is a robotic arm with two rotations. It has two links that rotate or work over a two-dimensional plane with each of the links having a single degree of freedom. These links are restricted to a 90-degree rotation with respect to the axes.

These robots have the various complex industrial application:

  1. Welding in the automobile industry
  2. Material handling
  3. Assembly Operations
  4. Machine Loading and Unloading
  5. Spray painting of automobile bodies

Solution Procedure:

In this project we shall consider the robotic arm as shown in the diagram below:

It consists of a base, two arms or kinematic links, and two rotational joints. These links will have motion in them when they are programmed. The links being link 1 and link 2. L1 and L2 being the lengths of the two links respectively. Considering the link 1 to be fixed to the horizontal plane and making an angle U1 with the horizontal. Link 2 is connected to link 1 and the second joint making an angle U2.

Considering that start and end co-ordinated of link 1 to be (X0, Y0) and (X1, Y1) respectively and that of link 2 to be (X1, Y1) and (X2, Y2) respectively.

Where,

Xo=0 Yo=0

Using the trigonometric conditions for the given situation:

X1= L1 x cos (U1) Y1= L1 x sin (U1)

X2= X1+ L2 x cos (U2) Y2= Y1+ L2 x sin (U2)

Code:

# TO SIMULATE THE FORWARD KINEMATICS OF A 2R ROBOTIC ARM-  Challenge for week 1
#Submitted by M K Pragya
#-----------------------------------------------------------------------------------------------
#importing the required modules

import math
import matplotlib.pyplot as plt


#Defining constants

l1=3                              #length of the arms(links 1 and 2) in meters
l2=2
n_theta=19                        #no.of points to be considered
theta1=[]                         #creating empty arrays to store the values genrated between the given rage
theta2=[]
theta_start=0
theta_end=math.pi/2				  #range of the angles to be considred.
         

#Declaration of the base hinge point of Link 1            
x0=-1                             
y0=-1

ct=1                              #Defining a counter for printing the various plots

#Generating the values for theta 1 and theta 2

for i in range(0, n_theta): 
		temp=theta_start+i*(theta_end- theta_start)/ (n_theta-1) 
		theta1.append(temp)
		theta2.append(temp)	


#Using trigonometry to find coordinates of subsequent points

for t1 in theta1: 
	for t2 in theta2:
		#Link 1, Link 2 connector 

		x1=l1*math.cos(t1)          
		y1=l1*math.sin(t1)
		
		
		#coordinators of manipulators
		x2=x1+l2*math.cos(t2)
		y2=y1+l2*math.sin(t2)	
		
		#For generating plots
		filename=str(ct)+ '.png'    #saves the required plot by ordered name
		ct=ct+1
		plt.figure()
		
		#To create the required configuration of the Robotic Arm

		plt.plot([x0,x1],[y0,y1], color='blue', linewidth = 12, label="Link 1")                    #For Link 1
		plt.plot([x1,x2],[y1,y2], color='orange', linewidth = 12, label="Link 2")  				   #For Link 2
		plt.hlines(-1.25,-1.25,3,color='grey', linewidth=16)                                       #For Base
		
		#Formatting the plots

		plt.title('2R Robotic Arm',fontname="Times New Roman",fontsize=25,fontweight='bold')
		plt.xlim([-5,7])
		plt.ylim([-1.5,6])
		plt.legend() 

		plt.savefig(filename)       #saving the files by generated names
		

Result

The resulting plot for a particular configuration is as follows;

The resulting animation can be found over the following link

https://youtu.be/1QJX3DqRGRI

Discussion:

An end effector is a device at the end of a robotic arm, designed to interact with the environment. The exact nature of this device depends on the application of the robot. End effectors may consist of a gripper or a tool. When referring to robotic prehension there are four general categories of robot grippers.

  1. Impactive: jaws or claws which physically grasp by direct impact upon the object.
  2. Ingressive: pins, needles, or hackles which physically penetrate the surface of the object (used in textile, carbon, and glass fiber handling).
  3. Astrictive: attractive forces applied to the surface of the object (whether by vacuum, magneto- or electro adhesion).
  4. Contigutive: requiring direct contact for adhesion to take place (such as glue, surface tension, or freezing).

This makes the arm suitable for various applications depending upon the end effector used.

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.