Updated is_at_target to accept calculated value from readback and not just an epics pv flag.

This commit is contained in:
2022-09-23 16:40:49 +02:00
parent 9161edcb82
commit 4ae527f451

View File

@ -198,9 +198,15 @@ class AttocubeAxis(Adjustable):
def is_moving(self):
return self.pvs.moving_status.value == 1
def is_at_target(self):
return self.pvs.target_reached.value == 1
def is_at_target(self,from_pv=False,tolerance = 0.3):
"""Check whether target was reached.
If from_pv is True TARGET_REACHED_RB is used, else it's calculated as diffrence between the readback and set value within tolerance.
Default is False, because otherwise tolerance can only be set and read out as an integer."""
if from_pv == True:
return self.pvs.target_reached.value == 1
else:
return abs( self.pvs.readback.get() - self.pvs.drive.get() ) < tolerance
def allow_move(self):
self.pvs.move.put(1, wait=True)