-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoves_reverse.py
executable file
·66 lines (46 loc) · 1.47 KB
/
moves_reverse.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
import sys
import time
from epics import caput, caget
from motor_lib import motor_lib
from motor_globals import motor_globals
def main():
pv = str(sys.argv[1])
print "Test reversing a move in progress on motor " + pv
lib = motor_lib()
g = motor_globals()
moves = range(0,1000)
ntm = pv + ".NTM"
caput(ntm, 1, wait=True)
for move in moves:
print "Test " + str(move)
position = 100
print "Moving to " + str(position)
caput(pv, position, wait=False)
time.sleep(15)
#Check we are still moving
pos1 = caget(pv + ".RBV")
time.sleep(2)
pos2 = caget(pv + ".RBV")
if (pos1 == pos2):
print "ERROR: RBV is not changing!"
print "pos1: " + str(pos1)
print "pos2: " + str(pos2)
sys.exit(lib.testComplete(g.FAIL))
position = -100
print "Moving to " + str(position)
caput(pv, position, wait=False)
time.sleep(15)
#Check we are still moving
pos1 = caget(pv + ".RBV")
time.sleep(2)
pos2 = caget(pv + ".RBV")
if (pos1 == pos2):
print "ERROR: RBV is not changing!"
print "pos1: " + str(pos1)
print "pos2: " + str(pos2)
sys.exit(lib.testComplete(g.FAIL))
caput(ntm, 0, wait=True)
sys.exit(lib.testComplete(g.SUCCESS))
if __name__ == "__main__":
main()