Project

simulating the Forward kinematics of 2R robotic arm using python

OBJECTIVE

The main stipulation of the project is to simulate the forward kinematics of 2R robotics arm by programming with python.

EXPRESSION USED IN THE PROGRAM

For the first link end coordinates

`x_1= l_1*cos theta_1`

`y_1=l_1*sin theta_1`

For the manipulator coordinates

`x_2 = x_1+l_2*cos theta_2`

`y_2 = y_1 + l_2*sin theta_2`

import matplotlib.pyplot as plt
import math
#inputs of length
l1=1 #length of the link 1
l2=1  #length of the link 2
nod=10 #no of degree divisions
a,b=0,90 
x,y=0,0 #co-ordinates of the link1's fixed point
i=0 
for n in range(0,nod):
	th1=math.radians(a+ (n*(b-a)/(nod-1)))
	for c in range(0,nod):
		th2=math.radians(a+ (c*(b-a)/(nod-1)))
		x1=l1*math.cos(th1)#cos and sin is a trignometric function inisde the math lib
		y1=l1*math.sin(th1) 
		x2=x1+(l2*math.cos(th2))
		y2=y1+(l2*math.sin(th2))
		plt.figure() #figure command which helps open a new image file on every iteration
		plt.plot((x,x1),(y,y1))
		plt.plot((x1,x2),(y1,y2))
		plt.xlim(0,3)
		plt.ylim(0,3)
		plt.show()
		i=i+1
		plt.savefig(str(i)+'.png') #savefig is to save the each fig of the iteration

OUTPUT

PROCEDURE

  • Assuming the length of the links as 1 so that the inputs as given data and the no of degrees of freedom of both links are 10.
  • using the defined ideal gas laws and the thermodynamic equation declaring the program to compute.
  • As the for loop is used here to iterate the process in continues manner until the target fixed as given or specified.

Making the output png images as gif animated picture as by using magick software by converting these images into a gif

CONCLUSION

As the programming for simulating the forward Kinematic 2R robotic arm is achieved using python with the help of thermodynamic equations

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.