Project

2 ARM ROBOT FORWARD KINEMATICS USING PYTHON

OBLECT

TO CRATE A MOVIE OF FILE OF FORWARD KINEMATICS OF 2D MANIPULATOR:

kinematics is a branch of mathematics, physics and classic mechanical engineering. There are 2 mostly used kinematics in robotic field,

they are : forward kinematics and inverse kinematics.

Forward kinematics is frequently used to calculate the position of end effector when we know angle of each link,

To calculate forward kinematic, we can use simple trigonometry

L1=longer link or base arm

L2=shorter linkj or effector arm

x1=L1cos(theta1)

y1=L1sin(theta1)

x2=x1+L2cos(theta2)

y2=y1+L2sin(theta2)

PROGRAM TO OBTAIN MOVIE FILE OF FORWARD KINEMATICS:

import math
import matplotlib.pyplot as plt
l1 =1
l2=0.5
n_theta=10
theta_end=math.pi/4
theta_start=0
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)
#base of robot
x0 =0
y0 =0
ct=1
for t1 in theta1:
	for t2 in theta2:
		
          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)
          

VIDEO FILE OF THE PROGRAM:

EXPLANATIOPN OF THE CODE:

1. first we give input values of link length of 1 or 2.

2. to assighn angle values , for loop is use.

3. use counter and file command to grab each frame f ormovie.

4. all 100 combination of images are use to create gif file.

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.