source: ETALON/BPM/motor_control.py @ 779

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

add fonction to print residu

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