File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,26 @@ def test_rotations(self):
19
19
rotated = (pos2 - pos1 ) / 360
20
20
self .assertLess (abs (rotated - 2 ), 0.5 )
21
21
22
+ def test_nonblocking (self ):
23
+ """Test motor nonblocking mode"""
24
+ m = Motor ('A' )
25
+ last = 0
26
+ for delay in [1 , 0 ]:
27
+ for _ in range (3 ):
28
+ m .run_to_position (90 , blocking = False )
29
+ time .sleep (delay )
30
+ m .run_to_position (90 , blocking = False )
31
+ time .sleep (delay )
32
+ m .run_to_position (90 , blocking = False )
33
+ time .sleep (delay )
34
+ m .run_to_position (last , blocking = False )
35
+ time .sleep (delay )
36
+ # Wait for a bit, before reading last position
37
+ time .sleep (7 )
38
+ pos1 = m .get_aposition ()
39
+ diff = abs ((last - pos1 + 180 ) % 360 - 180 )
40
+ self .assertLess (diff , 10 )
41
+
22
42
def test_position (self ):
23
43
"""Test motor goes to desired position"""
24
44
m = Motor ('A' )
You can’t perform that action at this time.
0 commit comments