diff --git a/attocube.py b/attocube.py index 3b6bae5..c54b16a 100644 --- a/attocube.py +++ b/attocube.py @@ -247,21 +247,22 @@ class AttocubeAxis(Adjustable): # 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) arguments: ========== - val value to move to (float) [Must be provided] - relative move relative to current position (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] - confirm_move try to confirm that move has begun (T/F) [F] - timeout max time for move to complete (in seconds) [300] - pos_check_delay delay before checkig motor in position (in seconds) [0.1] - 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] + val value to move to (float) [Must be provided] + relative move relative to current position (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] + confirm_move try to confirm that move has begun (T/F) [F] + timeout max time for move to complete (in seconds) [300] + 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_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: ============== @@ -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. time.sleep(pos_check_delay) - + 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 self.is_at_target( tolerance = 2): @@ -348,7 +349,7 @@ class AttocubeAxis(Adjustable): if verbose: print(f'move attempt: {attempt+1}') self.pvs.move.put(1, wait=True) - time.sleep(2) + time.sleep(move_attempt_sleep) if self.is_at_target(tolerance=tolerance): if verbose: print(f'Move finished. Had to poke the cube {attempt+1} times to get there though.')