-
Notifications
You must be signed in to change notification settings - Fork 54
Description
I am facing an issue with pyLabLib giving unexpected behavior when trying to control a Thorlabs DRV014 50mm stepper motor stage connected to BSC203 controller. After homing, I move the stage to desired absolute positions. For example, from 0mm to 3mm, then 3mm to 7mm, then 7mm to 3mm. On the 3rd absolute movement (i.e. 7mm to 3mm), the stage starts moving in the forward direction without stopping instead of going backwards and stopping at 3mm. Below is my code to replicate the issue.
I also notice the Enable light is not ON, I have to physically press the ON button to enable the channel. However, the pyLabLib is able to properly connect and interact with the stage even when the enable is OFF. If I launch the Kinesis software, it automatically enables the channel to ON.
Python 3.11.9
pylablib 1.4.2
>>> from pylablib.devices import Thorlabs
>>> my_serial = "70877XXX" # Real serial number is not shown
>>> stage = Thorlabs.KinesisMotor(my_serial, is_rack_system=True, scale=409600, default_channel=1)
>>> stage.get_device_info()
TDeviceInfo(serial_no=70000000, model_no='BSC203', fw_ver='2.3.4', hw_type=32, hw_ver=2, mod_state=0, nchannels=3, notes='APT Stepper Motor Controller')
>>> stage.get_full_info(-10)
{'velocity_parameters': TVelocityParams(min_velocity=0.0, acceleration=19.99985352990614, max_velocity=20.002642021804558), 'jog_parameters': TJogParams(mode='step', step_size=0.5, min_velocity=4.548074236214605e-06, acceleration=0.4999907901918369, max_velocity=1.000132121556562, stop_mode='profiled'), 'homing_parameters': THomeParams(home_direction='reverse', limit_switch='reverse', velocity=1.000132121556562, offset_distance=0.1), 'gen_move_parameters': TGenMoveParams(backlash_distance=0.15645751953125), 'limit_switch_parameters': TLimitSwitchParams(hw_kind_cw='break', hw_kind_ccw='break', hw_swapped=False, sw_position_cw=0.0, sw_position_ccw=0.0, sw_kind='ignore'), 'position': 0.0, 'status': ['tracking', 'digio1', 'enabled'], 'cls': 'KinesisMotor', 'conn': {'port': '70877XXX', 'baudrate': 115200, 'bytesize': 8, 'parity': 'N', 'stopbits': 1, 'xonxoff': 0, 'rtscts': True}, 'device_info': TDeviceInfo(serial_no=70000000, model_no='BSC203', fw_ver='2.3.4', hw_type=32, hw_ver=2, mod_state=0, nchannels=3, notes='APT Stepper Motor Controller'), 'channel': [1], 'scale_units': 'user_step', 'scale': (409600, 21987328.0, 4506.08300032), 'stage': None}
>>> stage.home()
>>> stage.get_position()
0.0
>>> stage.move_to(3.0)
>>> stage.get_position()
3.0
>>> stage.move_to(7.0)
>>> stage.get_position()
7.0
>>> stage.move_to(3.0)
>>> stage.stop()
>>> stage.get_position()
67.78671875