source: ETALON/BPM/motor_control.py @ 770

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

modification de motor controler pour afficher des graphiques (ne fonctionne pas)

File size: 1.5 KB
Line 
1import time
2import urllib
3import os
4from initialise_motors import *
5from scope_function import *
6import matplotlib.pyplot as plt
7
8# moteur 1 -> horizontal
9# moteur 2 -> verticale
10
11#motor_enable(1)
12
13#controller_hello()
14#move_motor_relative(1,1000,-1000)
15#time.sleep(1)
16#move_motor_relative(1,1000,1000)
17
18#urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png')
19
20#if not os.path.exists(repertoire):
21#os.makedirs('./test')    cree repertoir
22
23#position_test_horizontal()
24
25
26# creation graphique
27
28A = loadtxt('donnees.dat')
29X = []
30Y1 = []
31Y2 = []
32Y3 = []
33Y4 = []
34
35for i in range(A):
36    if (i%5) == 0:
37        X.append(A[i])
38    elif (i%5) == 1:
39        Y1.append(A[i])
40    elif (i%5) == 2:
41        Y2.append(A[i])
42    elif (i%5) == 3:
43        Y3.append(A[i])
44    else:
45        Y4.append(A[i])
46
47plt.plot(X,Y1)
48plt.show()
49
50
51"""
52turn_on()
53fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "w")
54horizontal_aquisition(0,400000,1000,fichier)
55fichier.close()
56turn_off()
57"""
58
59
60"""
61for i in range(3):
62        move_motor_absolute(1,5000,i*10000)
63        while motor_get(1, 'status') != 'READY':
64                time.sleep(1)
65        time.sleep(1)
66        urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/position_'+str(i*10000)+'.png')
67        time.sleep(1)
68
69
70move_motor_absolute(1,5000,0)
71while motor_get(1, 'status') != 'READY':
72        time.sleep(1)
73time.sleep(1)
74motor_disable(1)
75
76
77"""
78#motor_enable(2)
79
80#motor_disable(2) #commande dangeureuse
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Note: See TracBrowser for help on using the repository browser.