-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (25 loc) · 1009 Bytes
/
main.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
import gui
from measure import get_concentricity
from guider import get_torque_correction
from guider import get_normalized_deflect_vector_at_index, \
get_all_normalized_deflect_vectors
gui = gui.GUI()
def concentricity_provider(data):
concentricity, deflect_vector = get_concentricity(data)
return concentricity, deflect_vector
def guide_provider(deflect_vector):
'''
return: ['紧' or '松', ...], deflect_vector, all_deflect_vectors
'''
torque_correction, index = get_torque_correction(deflect_vector)
print(torque_correction)
guide = []
for torque in torque_correction:
if torque >= max(torque_correction):
guide.append('紧')
elif torque <= min(torque_correction):
guide.append('松')
return guide, \
get_normalized_deflect_vector_at_index(index), \
get_all_normalized_deflect_vectors()
gui.init(concentricity_provider=concentricity_provider, guide_provider=guide_provider)