source: ETALON/BPM/motor_control.py @ 771

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

modification des programmes afin de faire les graphiques

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