added proper waiting for the start of the move

This commit is contained in:
2020-12-03 20:04:38 +01:00
parent d111c191de
commit 175539ec7c
+12 -2
View File
@@ -68,12 +68,22 @@ class SmarActAxis(Adjustable):
stopper = lambda: self.pvs.stop.put(1)
return self._as_task(change, stopper=stopper, hold=hold)
def _move(self, value, checktime=0.1):
def _move(self, value, checktime=0.1, timeout=60):
timeout += time.time()
self.pvs.drive.put(value)
time.sleep(checktime)
while not self.is_moving():
time.sleep(checktime)
if time.time() >= timeout:
tname = typename(self)
raise SmarActError(f"starting to move {tname} \"{self.name}\" to {value} {self.units} timed out")
while self.is_moving():
time.sleep(checktime)
def is_moving(self):
"""
0 : Stopped