-
Notifications
You must be signed in to change notification settings - Fork 0
/
comparison.py
127 lines (109 loc) · 3.95 KB
/
comparison.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import pickle
import matplotlib.pyplot as plt
import numpy as np
real_dict = pickle.load(open('results/abb/real/6640.pickle','rb'))
sim_dict = pickle.load(open('results/abb/sim/6640.pickle','rb'))
###surface plots of accleration limits, x as q2, y as q3
x_sim=[]
y_sim=[]
q1_acc_sim=[]
q2_acc_p_sim=[]
q3_acc_p_sim=[]
q2_acc_n_sim=[]
q3_acc_n_sim=[]
for key, value in sim_dict.items():
x_sim.append(key[0])
y_sim.append(key[1])
q1_acc_sim.append(value[0])
q2_acc_n_sim.append(value[2])
q2_acc_p_sim.append(value[3])
q3_acc_n_sim.append(value[4])
q3_acc_p_sim.append(value[5])
###surface plots of accleration limits, x as q2, y as q3
x_real=[]
y_real=[]
q1_acc_real=[]
q2_acc_p_real=[]
q3_acc_p_real=[]
q2_acc_n_real=[]
q3_acc_n_real=[]
for key, value in real_dict.items():
x_real.append(key[0])
y_real.append(key[1])
q1_acc_real.append(value[0])
q2_acc_n_real.append(value[2])
q2_acc_p_real.append(value[3])
q3_acc_n_real.append(value[4])
q3_acc_p_real.append(value[5])
#####################################################################surface plots##########################################################
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q1_acc_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q1_acc_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d
ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q1 acc (rad/s^2)')
plt.title('Joint1 Acceleration Limit')
plt.legend()
plt.show()
plt.show()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q2_acc_n_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q2_acc_n_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d
ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q2 acc (rad/s^2)')
plt.title('Joint2 Acceleration Limit-')
plt.legend()
plt.show()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q2_acc_p_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q2_acc_p_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d
ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q2 acc (rad/s^2)')
plt.title('Joint2 Acceleration Limit+')
plt.legend()
plt.show()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q3_acc_n_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q3_acc_p_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d
ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q3 acc (rad/s^2)')
plt.title('Joint3 Acceleration Limit-')
plt.legend()
plt.show()
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf1 = ax.plot_trisurf(x_sim, y_sim, q3_acc_p_sim, linewidth=0, antialiased=False,label='sim')
surf2 = ax.plot_trisurf(x_real, y_real, q3_acc_n_real, linewidth=0, antialiased=False,label='real')
surf1._edgecolors2d = surf1._edgecolor3d
surf1._facecolors2d = surf1._facecolor3d
surf2._edgecolors2d = surf2._edgecolor3d
surf2._facecolors2d = surf2._facecolor3d
ax.set_xlabel('q2 (rad)')
ax.set_ylabel('q3 (rad)')
ax.set_zlabel('q3 acc (rad/s^2)')
plt.title('Joint3 Acceleration Limit+')
plt.legend()
plt.show()