Added a little Python script to test the moves

This commit is contained in:
Richard Bowman 2021-07-13 11:32:24 +01:00
parent 83aa9c113a
commit 154ca114c2

View file

@ -0,0 +1,33 @@
import sangaboard
import time
def polling_move(sb, pos):
positions = []
sb.move_rel(pos)
while sb.query("moving?") == "true":
positions.append((time.time(), sb.position))
time.sleep(0.001)
return positions
def blocking_move(sb, pos):
positions = []
sb.move_rel(pos)
sb.query("notify_on_stop")
return positions
if __name__ == "__main__":
sb = sangaboard.Sangaboard()
durations = []
for i in range(10):
start = time.time()
m = polling_move(sb, [1000 * (-1)**i, 0, 0])
stop = time.time()
durations.append(stop-start)
durations = []
for i in range(10):
start = time.time()
m = blocking_move(sb, [1000 * (-1)**i, 0, 0])
stop = time.time()
durations.append(stop-start)