Project

Forward Kinematics of 2 R ROBOTIC ARM

Before Writing the codes We should have a basic knowledge about the Robotic field. Robotics is an emerging field nowadays. It is a multidisciplinary science, encompasssing a number of fields like Computer technology, Mechanical design, control engineering, Sensing, Kinematics and dynamics of machinery and manufacturing process. If we talk about about the Robot in a layman language its a slave labourer who performs various complex tasks which a human possibly can not do, and once programmed it can do various complex tasks.

\"A basic definition for the robot is that its a programmable, multi-functional manipulator designed to move material, parts, tools, etc. through variable programmed motions for the performance of a variety of tasks\".

These robots have various complex industrial application

1) Welding in automobile industry.

2) Spray painting of automobile bodies.

3) Machine loading and unloading.

4) Material handling.

5) Assembly operations.

A Robot carries a large number of components, of which the main components are

Base, Manipulator Arm, Gripper, Drives, Controllers, Sensors, etc.

Forward kinematics of 2R ROBOTIC ARM-

A basic knowledge of Kinematics is needed for writing the codes for 2R ROBOTIC ARM. Basically 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.

Now the link one will make an angle θ1 with respect to base, simmilarly the link second will make an angle θ2

so we need to create a plot at various angular position upto which these Arms Can move for this we need to find the coordinates involved at the joints.

So at base cordinates will be (x0,y0) , at the end of first link and the starting of the second link coordinates will be (x1,y1), and at the manipulator coordinates will be (x2,y2).

at base, x0 = 0 ; y0 = 0

at Link1 and Link2 connector, x1 = L1*cos(θ1) ; y1 = L2*sin(θ1)

at Manipulator, x2 = x1 + L2*cos(θ2) ; y2 = y1 + L2*sin(θ2)

keeping these formulas in mind we can writes codes in Python.

# Forward kinematics of 2R robotic arm

import math
import matplotlib.pyplot as plt

# Inputs
l1 = 1 # length of first link
l2 = 0.5 # length of second link

# Base coordinates of the Robot
x0 = 0 
y0 = 0

# theta1 = l1*cos(theta1)
# theta2 = l2*sin(theta2)

# for total number of angles made by the links
n_theta = 10

theta_start = 0
theta_end = math.pi/2

theta1 = []
theta2 = []


# Creating a range of angles for both the links
for i in  range(0,n_theta):
	temp = theta_start+i*(theta_end-theta_start)/(n_theta-1)
	theta1.append(temp)
	theta2.append(temp)

ct = 1 # counter variable
for t1 in theta1: 
	for t2 in theta2:
	# Coordinates of link one and link two
	 x1 = l1*math.cos(t1)
	 y1 = l1*math.sin(t1)

	 # coordinates for the manipulator
	 x2 = x1+l2*math.cos(t2)
	 y2 = y1+l2*math.sin(t2)

	 filename = str(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)

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.