Project

2R Robotic Arm Simulator Using python

2R Robotic arm simulator using python

Aim: in this the 2r robotic arm was simulated using the python coding. in this we will create the arm by making the calculations.

code :

import math
import matplotlib.pyplot as plt

#inputs
L1=1.5
L2=1

#defining the angles
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)
	theta1.append(tmp)
	theta2.append(tmp)

x0=0
y=0
ct=1
for t1 in theta1:
	for t2 in theta2:
		

		#link 1 and link 2 connectors
		x1=L1*math.cos(t1)
		y1=L1*math.sin(t1)

		#coordinates of 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)


by executing the following code we can obtain the images of 100 plots. Later this 100 pic are converted into gif and made a motion video using maggick software or any other software available on online.

link for the video file was

https://youtu.be/C_pZ04njACU

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.