Project

2R robotic arm python

import matplotlib.pyplot as plt
import math

#inputs
l1= 1
l2= 2


n_thetha=10
thetha_start= 0
thetha_end= math.pi/2
thetha1=[]
thetha2=[]

for i in range(0,n_thetha):
	tmp=thetha_start+i*(thetha_end-thetha_start)/(n_thetha-1)
	thetha1.append(tmp)
	thetha2.append(tmp)

x0=0
y0=0
ct=1

for t1 in thetha1:
	for t2 in thetha2:
		x1=l1*math.cos(t1)
		y1=l1*math.sin(t1)

		
		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.