improve assertInPosition

- sometimes this is called while the lid is still moving
This commit is contained in:
2023-05-09 12:33:19 +02:00
parent 4d414860cd
commit 985226e9cd
2 changed files with 20 additions and 3 deletions
+7 -3
View File
@@ -117,14 +117,18 @@ class Hexiposi(DiscretePositionerBase):
#Retrying after end of move -> once in a while move raises a not in position exception.
def assertInPosition(self, pos):
retries = 3
poll_interval = 2.0
max_turn_time = 8.0 # s
retries = int(max_turn_time / poll_interval)
for i in range(retries):
#st = self.get_status()
#print "asserting hexiposi in position " + pos + " --- moving:" + str(st["moving"]) + " --- state:" + str(self.getState())
try:
super(Hexiposi, self).assertInPosition(pos)
return
except:
if i <(retries-1):
time.sleep(0.5)
if i < retries - 1:
time.sleep(poll_interval)
else:
raise
+13
View File
@@ -0,0 +1,13 @@
import random
import time
def hexiposi_tester(num_moves = 10, wait = 3.0):
release_safety()
for n in range(num_moves):
pos = random.choice("ABCDEF")
print str(n) + " of " + str(num_moves) + ") moving to " + pos
hexiposi.move(pos)
#print " sleep " + str(wait) + " s"
time.sleep(wait)
print " done "