2R Robotic Arm motion - Mallikarjun Patil
Program for the 2R Robotic arm:-
from math import*
import matplotlib.pyplot as plt
l1=1.5
l2=.7
n_theta=10
theta_start=pi/2
theta_end=pi/4
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)
print(theta1)
print(theta2)
ct=1
x0=0
y0=0
for t1 in theta1:
for t2 in theta2:
#link1,link2 co-ordinator
x1=l1*cos(t1)
y1=l1*sin(t1)
#co-ordinate of the manipulator
x2=x1+l2*cos(t2)
y2=y1+l2*sin(t2)
file_name=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.show()
Output:-
[1.5707963267948966, 1.4835298641951802, 1.3962634015954636, 1.3089969389957472, 1.2217304763960306, 1.1344640137963142, 1.0471975511965979, 0.9599310885968813, 0.8726646259971648, 0.7853981633974483]
[1.5707963267948966, 1.4835298641951802, 1.3962634015954636, 1.3089969389957472, 1.2217304763960306, 1.1344640137963142, 1.0471975511965979, 0.9599310885968813, 0.8726646259971648, 0.7853981633974483]
By compiling the above program I obtained the Theta1 & Theta2 Values in array.And after that program generates the graph in loops.by doing that I obtained 10 graphs and saved it saperatly and converted them into Video/Gif file. The following video link is as below.
Spacification:-
Arm length1=1.5
Arm length2=.7
theta start= pi/4
theta end=pi/2
Program:-
Program output:-
Youtube link:
Gif file of the program:-
Note:-
1. Software used Pycharm