Added sleep time for move attempt

This commit is contained in:
2022-09-27 11:28:03 +02:00
parent 0894be1f8f
commit 60639923cb

View File

@ -247,21 +247,22 @@ class AttocubeAxis(Adjustable):
# 2. Soft epics limits # 2. Soft epics limits
def move(self, val, relative=False, wait=True, ignore_limits=True, confirm_move=True, timeout=300.0, pos_check_delay=0.15, target_gnd=None, move_attempts = 5, verbose = False, tolerance=0.3): def move(self, val, relative=False, wait=True, ignore_limits=True, confirm_move=True, timeout=300.0, pos_check_delay=0.15, target_gnd=None, move_attempts = 5, move_attempt_sleep=4, verbose = False, tolerance=0.3):
""" """
moves Attocube drive to position (emulating pyepics Motor class) moves Attocube drive to position (emulating pyepics Motor class)
arguments: arguments:
========== ==========
val value to move to (float) [Must be provided] val value to move to (float) [Must be provided]
relative move relative to current position (T/F) [F] relative move relative to current position (T/F) [F]
wait whether to wait for move to complete (T/F) [F] wait whether to wait for move to complete (T/F) [F]
ignore_limits try move without regard to limits (no epics limits implemented yet) (T/F) [T] ignore_limits try move without regard to limits (no epics limits implemented yet) (T/F) [T]
confirm_move try to confirm that move has begun (T/F) [F] confirm_move try to confirm that move has begun (T/F) [F]
timeout max time for move to complete (in seconds) [300] timeout max time for move to complete (in seconds) [300]
pos_check_delay delay before checkig motor in position (in seconds) [0.1] pos_check_delay delay before checkig motor in position (in seconds) [0.15]
move_attempts how many times should the move be attempted if not in limits (attocube often needs to be poked a few times for the last 1um) [5] move_attempts how many times should the move be attempted if not in limits (attocube often needs to be poked a few times for the last 1um) [5]
tolerance when to consider target destination reached (in microns) [0.3] move_attempt_sleep how long to wait before another move poke attept is done (in seconds) [4]
tolerance when to consider target destination reached (in microns) [0.3]
return values: return values:
============== ==============
@ -340,7 +341,7 @@ class AttocubeAxis(Adjustable):
# Wait before checking if target value reached. It's necessary as sometimes this PV takes a while to set for the new target value. # Wait before checking if target value reached. It's necessary as sometimes this PV takes a while to set for the new target value.
time.sleep(pos_check_delay) time.sleep(pos_check_delay)
while self.is_at_target(tolerance=tolerance) == False and time.time() <= tout: while self.is_at_target(tolerance=tolerance) == False and time.time() <= tout:
# If the value is near the last 2um. Move the cube to setpoint a few more times to get to the right position. # If the value is near the last 2um. Move the cube to setpoint a few more times to get to the right position.
if self.is_at_target( tolerance = 2): if self.is_at_target( tolerance = 2):
@ -348,7 +349,7 @@ class AttocubeAxis(Adjustable):
if verbose: if verbose:
print(f'move attempt: {attempt+1}') print(f'move attempt: {attempt+1}')
self.pvs.move.put(1, wait=True) self.pvs.move.put(1, wait=True)
time.sleep(2) time.sleep(move_attempt_sleep)
if self.is_at_target(tolerance=tolerance): if self.is_at_target(tolerance=tolerance):
if verbose: if verbose:
print(f'Move finished. Had to poke the cube {attempt+1} times to get there though.') print(f'Move finished. Had to poke the cube {attempt+1} times to get there though.')