Project

To simulate forward kinematics of a 2R Robotic Arm using PYTHON

Aim : To simulate the forward kinematics of a 2R Robotic arm.

Theory:

The robotic arm is used for multiple industrial applications, from welding, material handling, and thermal spraying, to painting and drilling. The robotic technology also provides human-like dexterity in a variety of environments.

The links in a robotic arm form a kinematic chain which allow rotational motion (here) or linear motion. The arm can be programmed to move according to action that it needs to perform.

Here, we attemp to simulate a basic Robotic arm manipulator performing rotational movement using PYTHON. Also create an animation of the simulation and save it.

Python Code :

import matplotlib.pyplot as plt 
import math
import numpy as np
import scipy



# Length of robotic arms
l1 = 1
l2 = 1


# Start and End angle for the arms
theta_start = 0
theta_end = math.pi/2

#Creating arrays for angles
theta1 = np.linspace(0,math.pi/2,10)
theta2 = theta1

#Co-ordinates
x0 = 0
y0 = 0

ct = 1
for t1 in theta1:
	for t2 in theta2:


		#Co-ordinates	
		x1 = l1*math.cos(t1)
		y1 = l1*math.sin(t1)

		x2 = x1 + l2*math.cos(t2)
		y2 = y1 + l2*math.sin(t2)


		#Creating a variable for file names
		filename = str(ct) + '.png'
		ct = ct+1

		#Plotting
		plt.figure()
		plt.plot([x0,x1],[y0,y1],linewidth = 4)
		plt.plot([x1,x2],[y1,y2],linewidth = 4)


		#Axes limits
		plt.xlim([0,3])
		plt.ylim([0,3])
		plt.savefig(filename)

Animation :

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.