Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions thorlabs_apt/_APTAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ def set_ctypes_argtypes(lib):
lib.MOT_GetHomeParams.argtypes = [c_long, c_long_p, c_long_p, c_float_p,
c_float_p]
lib.MOT_GetHomeParams.restype = c_long
lib.MOT_SetJogParams.argtypes = [c_long, c_long, c_long, c_float, c_float, c_float, c_float]
lib.MOT_SetJogParams.restypes = c_long
lib.MOT_GetJogParams.argtypes = [c_long, c_long_p, c_long_p, c_float_p, c_float_p, c_float_p, c_float_p]
lib.MOT_GetJogParams.restypes = c_long
lib.MOT_MoveJog.argtypes = [c_long, c_long, c_bool]
lib.MOT_MoveJog.restypes = c_long
lib.MOT_GetStatusBits.argtypes = [c_long, c_long_p]
lib.MOT_GetStatusBits.restype = c_long
lib.MOT_SetBLashDist.argtypes = [c_long, c_float]
Expand Down
66 changes: 66 additions & 0 deletions thorlabs_apt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,52 @@ def velocity_upper_limit(self):
"""
return self.get_velocity_parameter_limits()[1]

def get_jog_parameters(self):
"""
Returns jog parameters.

Returns
-------
out : tuple
(Mode, StopMode, StepSize, MinVel, Accn, MaxVel)
"""
Mode = ctypes.c_long()
StopMode = ctypes.c_long()
StepSize = ctypes.c_float()
MinVel = ctypes.c_float()
Accn = ctypes.c_float()
MaxVel = ctypes.c_float()
err_code = _lib.MOT_GetJogParams(self._serial_number,
ctypes.byref(Mode),
ctypes.byref(StopMode),
ctypes.byref(StepSize),
ctypes.byref(MinVel),
ctypes.byref(Accn),
ctypes.byref(MaxVel))
if (err_code != 0):
raise Exception("Getting jog parameters failed: %s" %
_get_error_text(err_code))
return (Mode.value, StopMode.value, StepSize.value,
MinVel.value, Accn.value, MaxVel.value)

def set_jog_parameters(self, Mode, StopMode, StepSize, MinVel, Accn, MaxVel):
"""
Sets jog parameters.

Parameters
----------
Mode : int
StopMode : int
StepSize : float
MinVel : float
Accn : float
MaxVel : float
"""
err_code = _lib.MOT_SetJogParams(self._serial_number, Mode,
StopMode, StepSize, MinVel, Accn, MaxVel)
if (err_code != 0):
raise Exception("Setting jog parameters failed: %s" %
_get_error_text(err_code))

def get_move_home_parameters(self):
"""
Expand Down Expand Up @@ -796,6 +842,26 @@ def move_by(self, value, blocking = False):
raise Exception("Setting relative position failed: %s" %
_get_error_text(err_code))

def move_jog(self, direction, blocking = False):
"""
Move jog.

Parameters
----------
direction : int
direction of movement
MOVE_FWD = 1 : move in forward direction.
MOVE_REV = 2 : move in reverse direction.
blocking : bool
wait until moving is finished
Default: False
"""
err_code = _lib.MOT_MoveJog(self._serial_number, direction,
blocking)
if (err_code != 0):
raise Exception("Jog movement failed: %s" %
_get_error_text(err_code))

@property
def position(self):
"""
Expand Down