Project

Forward kinematics of a 2R robotic arm

PYTHON PROGRAM FOR A 2 ARM ROBOT

A robot manipulator consists of links connected by joints. The links of the manipulator can be considered to form a kinematic chain. The business end of the kinematic chain of the manipulator is called the end effector and it is analogous to the human hand. The end effector can be a gripper or can be designed to perform any desired task such as welding, painting, assembly, etc.

Here only 2 links were used to create the robotic arm.The links were free to move in a 2D plane.

A python program is written to simulate its mechanics.The program is as follows.

import math
import matplotlib.pyplot as plt

#inputs
l1=1
l2=0.5
x0=0
y0=0

n_theta=10
theta_start=0
theta_end=math.pi/2
theta1=[]
theta2=[]
for i in range(0,n_theta):
	tmp= theta_start + i*(theta_end- theta_start)/(n_theta-1)
	theta1.append(tmp)
	theta2.append(tmp)

ct=1
for t1 in theta1:
	for t2 in theta2:
		#Link1
		x1=l1*math.cos(t1)
		y1=l1*math.sin(t1)
		#link2
		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)

Where,theta1 is taken as the angle that link1 makes with the +x axis.

theta2 is the angle that link2 makes with the +x axis.

This program gives 100 images of name from 1-100,each for a specific value in set of {theta1,theta2}.

The arm links of the robot ccorresponds to the values at each plot.

The 100 image plots are then combined to form a file in gif format whose youtube link is given as follows.

https://youtu.be/CxHA4Ec26MA

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.