-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_move_delay.py
executable file
·47 lines (35 loc) · 1.32 KB
/
post_move_delay.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
#!/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():
pv1 = sys.argv[1]
print "Test post move delay handling."
lib = motor_lib()
g = motor_globals()
caput(pv1+":PostMoveDelay", 0, wait=True, timeout=g.TIMEOUT)
stat = lib.move(pv1, 0, g.TIMEOUT)
if (stat == g.FAIL):
sys.exit(lib.testComplete(g.FAIL))
delays = [0, 0.1, 0.2, 0.5, 1, 2, 5, 20]
positions = range(0,10)
for delay in delays:
caput(pv1+":PostMoveDelay", delay, wait=True, timeout=g.TIMEOUT)
for pos in positions:
print "Move to " + str(float(pos/10.0)) + " with post move delay " + str(delay)
stat = lib.move(pv1, float(pos/10.0), g.TIMEOUT)
if (stat == g.FAIL):
sys.exit(lib.testComplete(g.FAIL))
positions = range(0,20,2)
for delay in delays:
caput(pv1+":PostMoveDelay", delay, wait=True, timeout=g.TIMEOUT)
for pos in positions:
print "Move to " + str(pos) + " with post move delay " + str(delay)
stat = lib.move(pv1, pos, g.TIMEOUT)
if (stat == g.FAIL):
sys.exit(lib.testComplete(g.FAIL))
sys.exit(lib.testComplete(g.SUCCESS))
if __name__ == "__main__":
main()