source: ETALON/BPM/motor_control.py @ 777

Last change on this file since 777 was 777, checked in by moutardier, 6 years ago

add program to initilase_motor.py to generat data_path and add exeception to acquisition's program to test position

File size: 2.5 KB
Line 
1import time
2import urllib
3import os
4from initialise_motors import *
5from scope_function import *
6import numpy as np
7import matplotlib.pyplot as plt
8
9# moteur 1 -> horizontal
10# moteur 2 -> verticale
11
12motor_enable(2)
13move_motor_absolute(2,5000,-50000)
14while motor_get(1, 'status') != 'READY':
15    time.sleep(1)
16time.sleep(5)
17"""
18move_motor_absolute(2,5000,0)
19while motor_get(1, 'status') != 'READY':
20    time.sleep(1)
21"""
22#controller_hello()
23#move_motor_relative(1,1000,-1000)
24#time.sleep(1)
25#move_motor_relative(1,1000,1000)
26#urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png')
27#if not os.path.exists(repertoire):
28#os.makedirs('./test')    cree repertoir
29
30#position_test_horizontal()
31
32
33#                                 creation graphique
34
35
36#turn_on()
37
38vertical_aquisition(-110000,90000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
39
40#vertical_aquisition(90000,-110000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
41
42#vertical_aquisition(0,-4000,2000,"test")
43#vertical_aquisition(4000,0,2000,"test2")
44
45#horizontal_aquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")   
46
47#turn_off()
48
49#fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "r")
50"""
51A = fichier.read()
52
53X = []
54Y1 = []
55Y2 = []
56Y3 = []
57Y4 = []
58a = ""
59l = 0
60
61
62for i in A:
63    if (i == "\n") :
64         if l == 0:
65             X.append(a)
66             
67             l += 1
68         elif l == 1:
69             Y1.append(a)
70             #print(a)
71             l += 1
72         elif l == 2:
73             Y2.append(a)
74             l += 1
75         elif l == 3:
76             Y3.append(a)
77             l += 1
78         else:
79             Y4.append(a)
80             l = 0
81         a = ""
82    else:
83        a += i
84
85def float_list(l):
86    L = []
87    for i in l:
88        L.append(float(i))
89    return(L)
90   
91X = float_list(X)
92Y1 = float_list(Y1)
93Y2 = float_list(Y2)
94Y3 = float_list(Y3)
95Y4 = float_list(Y4)
96
97plt.plot(X,Y1)
98plt.plot(X,Y2)
99plt.plot(X,Y3)
100plt.plot(X,Y4)
101plt.show()
102"""
103
104#fichier.close()
105
106
107
108"""
109for i in range(3):
110        move_motor_absolute(1,5000,i*10000)
111        while motor_get(1, 'status') != 'READY':
112                time.sleep(1)
113        time.sleep(1)
114        urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/position_'+str(i*10000)+'.png')
115        time.sleep(1)
116
117
118move_motor_absolute(1,5000,0)
119while motor_get(1, 'status') != 'READY':
120        time.sleep(1)
121time.sleep(1)
122motor_disable(1)
123
124
125"""
126#motor_enable(2)
127
128#motor_disable(2) #commande dangeureuse
Note: See TracBrowser for help on using the repository browser.