msl.equipment.resources.thorlabs.kinesis.kcube_dc_servo module

This module provides all the functionality required to control a KCube DC Servo (KDC101).

class msl.equipment.resources.thorlabs.kinesis.kcube_dc_servo.KCubeDCServo(record)[source]

Bases: MotionControl

A wrapper around Thorlabs.MotionControl.KCube.DCServo.dll.

The properties for a KCubeDCServo connection supports the following key-value pairs in the Connections Database:

'device_name': str, the device name found in ThorlabsDefaultSettings.xml [default: None]

Do not instantiate this class directly. Use the connect() method to connect to the equipment.

Parameters:

record (EquipmentRecord) – A record from an Equipment-Register Database.

can_device_lock_front_panel()[source]

Determine if the device front panel can be locked.

Returns:

boolTrue if the front panel of the device can be locked, False if not.

can_home()[source]

Can the device perform a home()?

Returns:

bool – Whether the device can be homed.

can_move_without_homing_first()[source]

Does the device need to be home()’d before a move can be performed?

Returns:

bool – Whether the device needs to be homed.

check_connection()[source]

Check connection.

Returns:

bool – Whether the USB is listed by the FTDI controller.

clear_message_queue()[source]

Clears the device message queue.

close()[source]

Disconnect and close the device.

disable_channel()[source]

Disable the channel so that motor can be moved by hand.

When disabled, power is removed from the motor and it can be freely moved.

Raises:

ThorlabsError – If not successful.

enable_channel()[source]

Enable channel for computer control.

When enabled, power is applied to the motor so it is fixed in position.

Raises:

ThorlabsError – If not successful.

enable_last_msg_timer(enable, last_msg_timeout)[source]

Enables the last message monitoring timer.

This can be used to determine whether communications with the device is still good.

Parameters:
  • enable (bool) – True to enable monitoring otherwise False to disable.

  • last_msg_timeout (int) – The last message error timeout in ms. Set to 0 to disable.

get_backlash()[source]

Get the backlash distance setting (used to control hysteresis).

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The backlash distance in DeviceUnits (see manual).

get_dcpid_params()[source]

Get the DC PID parameters for DC motors used in an algorithm involving calculus.

Returns:

structs.MOT_DC_PIDParameters – The DC PID parameters.

Raises:

ThorlabsError – If not successful.

get_device_unit_from_real_value(real_value, unit_type)[source]

Converts a real-world value to a device value.

Either load_settings(), load_named_settings() or set_motor_params_ext() must be called before calling this function, otherwise the returned value will always be 0.

Parameters:
  • real_value (float) – The real-world value.

  • unit_type (enums.UnitType) – The unit of the real-world value.

Returns:

int – The device value.

Raises:

ThorlabsError – If not successful.

get_digital_outputs()[source]

Gets the digital output bits.

Returns:

bytes – Bit mask of states of the 4 digital output pins.

get_encoder_counter()[source]

Get the encoder counter.

For devices that have an encoder, the current encoder position can be read.

Returns:

int – The encoder count in encoder units.

get_front_panel_locked()[source]

Query if the device front panel locked.

Returns:

boolTrue if the device front panel is locked, False if not.

get_hardware_info()[source]

Gets the hardware information from the device.

Returns:

structs.TLI_HardwareInformation – The hardware information.

Raises:

ThorlabsError – If not successful.

get_hardware_info_block()[source]

Gets the hardware information in a block.

Returns:

structs.TLI_HardwareInformation – The hardware information.

Raises:

ThorlabsError – If not successful.

get_homing_params_block()[source]

Get the homing parameters.

Returns:

structs.MOT_HomingParameters – The homing parameters.

Raises:

ThorlabsError – If not successful.

get_homing_velocity()[source]

Gets the homing velocity.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The homing velocity in DeviceUnits (see manual).

get_hub_bay()[source]

Gets the hub bay number this device is fitted to.

Returns:

bytes – The number, 0x00 if unknown or 0xff if not on a hub.

get_jog_mode()[source]

Gets the jog mode.

Returns:

Raises:

ThorlabsError – If not successful.

get_jog_params_block()[source]

Get the jog parameters.

Returns:

structs.MOT_JogParameters – The jog parameters.

Raises:

ThorlabsError – If not successful.

get_jog_step_size()[source]

Gets the distance to move when jogging.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The step size in DeviceUnits (see manual).

get_jog_vel_params()[source]

Gets the jog velocity parameters.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

  • int – The maximum velocity in DeviceUnits (see manual).

  • int – The acceleration in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

get_led_switches()[source]

Get the LED indicator bits on cube.

Returns:

int – Sum of: 8 to indicate moving 2 to indicate end of track and 1 to flash on identify command.

get_limit_switch_params()[source]

Gets the limit switch parameters.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

Raises:

ThorlabsError – If not successful.

get_limit_switch_params_block()[source]

Get the limit switch parameters.

Returns:

structs.MOT_LimitSwitchParameters – The limit switch parameters.

Raises:

ThorlabsError – If not successful.

get_mmi_params()[source]

Get the MMI Parameters for the KCube Display Interface.

Deprecated calls by get_mmi_params_ext()

get_mmi_params_block()[source]

Gets the MMI parameters for the device.

Returns:

structs.KMOT_MMIParams – The MMI parameters for the device.

get_mmi_params_ext()[source]

Get the MMI Parameters for the KCube Display Interface.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

  • enums.KMOT_WheelMode – The device joystick mode.

  • int – The joystick maximum velocity in DeviceUnits.

  • int – The joystick acceleration in DeviceUnits.

  • enums.KMOT_WheelDirectionSense – The joystick direction sense.

  • int – The first preset position in DeviceUnits.

  • int – The second preset position in DeviceUnits.

  • int – The display intensity, range 0 to 100%.

  • int – The display timeout, range 0 to 480 in minutes (0 is off, otherwise the inactivity period before dimming the display).

  • int – The display dimmed intensity, range 0 to 10 (after the timeout period the device display will dim).

Raises:

ThorlabsError – If not successful.

get_motor_params()[source]

Gets the motor stage parameters.

Deprecated: calls get_motor_params_ext()

These parameters, when combined define the stage motion in terms of RealWorldUnits [millimeters or degrees]. The real-world unit is defined from steps_per_rev * gear_box_ratio / pitch.

Returns:

  • float – The steps per revolution.

  • float – The gear box ratio.

  • float – The pitch.

Raises:

ThorlabsError – If not successful.

get_motor_params_ext()[source]

Gets the motor stage parameters.

These parameters, when combined define the stage motion in terms of RealWorldUnits [millimeters or degrees]. The real-world unit is defined from steps_per_rev * gear_box_ratio / pitch.

Returns:

  • float – The steps per revolution.

  • float – The gear box ratio.

  • float – The pitch.

Raises:

ThorlabsError – If not successful.

get_motor_travel_limits()[source]

Gets the motor stage min and max position.

Returns:

  • float – The minimum position in RealWorldUnits [millimeters or degrees].

  • float – The maximum position in RealWorldUnits [millimeters or degrees].

Raises:

ThorlabsError – If not successful.

get_motor_travel_mode()[source]

Get the motor travel mode.

Returns:

enums.MOT_TravelModes – The travel mode.

get_motor_velocity_limits()[source]

Gets the motor stage maximum velocity and acceleration.

Returns:

  • float – The maximum velocity in RealWorldUnits [millimeters or degrees].

  • float – The maximum acceleration in RealWorldUnits [millimeters or degrees].

Raises:

ThorlabsError – If not successful.

get_move_absolute_position()[source]

Gets the move absolute position.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The move absolute position in DeviceUnits (see manual).

get_move_relative_distance()[source]

Gets the move relative distance.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The move relative position in DeviceUnits (see manual).

get_next_message()[source]

Get the next Message Queue item. See messages.

Returns:

  • int – The message type.

  • int – The message ID.

  • int – The message data.

Raises:

ThorlabsError – If not successful.

get_number_positions()[source]

Get the number of positions.

This function will get the maximum position reachable by the device. The motor may need to be set to its home() position before this parameter can be used.

Returns:

int – The number of positions.

get_position()[source]

Get the current position.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

index (int) – The position in DeviceUnits (see manual).

get_position_counter()[source]

Get the position counter.

The position counter is identical to the position parameter. The position counter is set to zero when homing is complete.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The position counter in DeviceUnits (see manual).

get_real_value_from_device_unit(device_value, unit_type)[source]

Converts a device value to a real-world value.

Either load_settings(), load_named_settings() or set_motor_params_ext() must be called before calling this function, otherwise the returned value will always be 0.

Parameters:
  • device_value (int) – The device value.

  • unit_type (enums.UnitType) – The unit of the device value.

Returns:

float – The real-world value.

Raises:

ThorlabsError – If not successful.

get_soft_limit_mode()[source]

Gets the software limits mode.

Returns:

enums.MOT_LimitsSoftwareApproachPolicy – The software limits mode.

get_software_version()[source]

Gets version number of the device software.

Returns:

str – The device software version.

get_stage_axis_max_pos()[source]

Gets the Stepper Motor maximum stage position.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The maximum position in DeviceUnits (see manual).

get_stage_axis_min_pos()[source]

Gets the Stepper Motor minimum stage position.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

int – The minimum position in DeviceUnits (see manual).

get_status_bits()[source]

Get the current status bits.

This returns the latest status bits received from the device. To get new status bits, use request_status_bits() or use the polling functions, start_polling().

Returns:

int – The status bits from the device.

get_trigger_config_params()[source]

Get the Trigger Configuration Parameters.

Returns:

Raises:

ThorlabsError – If not successful.

get_trigger_config_params_block()[source]

Gets the trigger configuration parameters block.

Returns:

structs.KMOT_TriggerConfig – Options for controlling the trigger configuration.

Raises:

ThorlabsError – If not successful.

get_trigger_params_params()[source]

Get the Trigger Parameters parameters.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

  • int – The trigger start position, forward, in DeviceUnits (see manual).

  • int – The trigger interval, forward, in DeviceUnits (see manual).

  • int – Number of trigger pulses, forward.

  • int – The trigger start position, reverse, in DeviceUnits (see manual).

  • int – The trigger interval, reverse, in DeviceUnits (see manual).

  • int – Number of trigger pulses, reverse.

  • int – Width of the trigger pulse in milliseconds, range 10 (10us) to 650000 (650ms).

  • int – Number of cycles to perform triggering.

Raises:

ThorlabsError – If not successful.

get_trigger_params_params_block()[source]

Gets the trigger parameters block.

Returns:

structs.KMOT_TriggerParams – Options for controlling the trigger.

Raises:

ThorlabsError – If not successful.

get_vel_params()[source]

Gets the move velocity parameters.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Returns:

  • max_velocity (int) – The maximum velocity in DeviceUnits (see manual).

  • acceleration (int) – The acceleration in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

get_vel_params_block()[source]

Get the move velocity parameters.

Returns:

structs.MOT_VelocityParameters – The velocity parameters.

Raises:

ThorlabsError – If not successful.

has_last_msg_timer_overrun()[source]

Queries if the time since the last message has exceeded the lastMsgTimeout set by enable_last_msg_timer().

This can be used to determine whether communications with the device is still good.

Returns:

boolTrue if last message timer has elapsed or False if monitoring is not enabled or if time of last message received is less than lastMsgTimeout.

home()[source]

Home the device.

Homing the device will set the device to a known state and determine the home position.

Raises:

ThorlabsError – If not successful.

identify()[source]

Sends a command to the device to make it identify itself.

load_settings()[source]

Update device with stored settings.

The settings are read from ThorlabsDefaultSettings.xml, which gets created when the Kinesis software is installed.

Raises:

ThorlabsError – If not successful.

load_named_settings(settings_name)[source]

Update device with named settings.

Parameters:

settings_name (str) – The name of the device to load the settings for. Examples for the value of setting_name can be found in ThorlabsDefaultSettings.xml`, which gets created when the Kinesis software is installed.

Raises:

ThorlabsError – If not successful.

message_queue_size()[source]

Gets the size of the message queue.

Returns:

int – The number of messages in the queue.

move_absolute()[source]

Moves the device to the position defined in set_move_absolute_position().

Raises:

ThorlabsError – If not successful.

move_at_velocity(direction)[source]

Start moving at the current velocity in the specified direction.

Parameters:

direction (enums.MOT_TravelDirection) – The required direction of travel as a enums.MOT_TravelDirection enum value or member name.

Raises:

ThorlabsError – If not successful.

move_jog(jog_direction)[source]

Perform a jog.

Parameters:

jog_direction (enums.MOT_TravelDirection) – The jog direction as a enums.MOT_TravelDirection enum value or member name.

Raises:

ThorlabsError – If not successful.

move_relative(displacement)[source]

Move the motor by a relative amount.

See get_device_unit_from_real_value()get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

displacement (int) – Signed displacement in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

move_relative_distance()[source]

Moves the device by a relative distance defined by set_move_relative_distance().

Raises:

ThorlabsError – If not successful.

move_to_position(index)[source]

Move the device to the specified position (index).

The motor may need to be set to its home() position before a position can be set.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

index (int) – The position in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

needs_homing()[source]

Does the device need to be home()’d before a move can be performed?

Deprecated: calls can_move_without_homing_first() instead.

Returns:

bool – Whether the device needs to be homed.

open()[source]

Open the device for communication.

Raises:

ThorlabsError – If not successful.

persist_settings()[source]

Persist the devices current settings.

Raises:

ThorlabsError – If not successful.

polling_duration()[source]

Gets the polling loop duration.

Returns:

int – The time between polls in milliseconds or 0 if polling is not active.

register_message_callback(callback)[source]

Registers a callback on the message queue.

Parameters:

callback (MotionControlCallback) – A function to be called whenever messages are received.

request_backlash()[source]

Requests the backlash.

Raises:

ThorlabsError – If not successful.

request_dcpid_params()[source]

Request the PID parameters for DC motors used in an algorithm involving calculus.

Raises:

ThorlabsError – If not successful.

request_digital_outputs()[source]

Requests the digital output bits.

Raises:

ThorlabsError – If not successful.

request_encoder_counter()[source]

Requests the encoder counter.

Raises:

ThorlabsError – If not successful.

request_front_panel_locked()[source]

Ask the device if its front panel is locked.

Raises:

ThorlabsError – If not successful.

request_homing_params()[source]

Requests the homing parameters.

Raises:

ThorlabsError – If not successful.

request_jog_params()[source]

Requests the jog parameters.

Raises:

ThorlabsError – If not successful.

request_led_switches()[source]

Requests the LED indicator bits on the cube.

Raises:

ThorlabsError – If not successful.

request_limit_switch_params()[source]

Requests the limit switch parameters.

Raises:

ThorlabsError – If not successful.

request_mmi_params()[source]

Requests the MMI Parameters for the KCube Display Interface.

Raises:

ThorlabsError – If not successful.

request_move_absolute_position()[source]

Requests the position of next absolute move.

Raises:

ThorlabsError – If not successful.

request_move_relative_distance()[source]

Requests the relative move distance.

Raises:

ThorlabsError – If not successful.

request_pos_trigger_params()[source]

Requests the position trigger parameters.

Raises:

ThorlabsError – If not successful.

request_position()[source]

Requests the current position.

This needs to be called to get the device to send it’s current position. Note, this is called automatically if Polling is enabled for the device using start_polling().

Raises:

ThorlabsError – If not successful.

request_settings()[source]

Requests that all settings are downloaded from the device.

This function requests that the device upload all it’s settings to the DLL.

Raises:

ThorlabsError – If not successful.

request_status_bits()[source]

Request the status bits which identify the current motor state.

This needs to be called to get the device to send it’s current status bits. Note, this is called automatically if Polling is enabled for the device using start_polling().

Raises:

ThorlabsError – If not successful.

request_trigger_config_params()[source]

Requests the Trigger Configuration Parameters.

Raises:

ThorlabsError – If not successful.

request_vel_params()[source]

Requests the velocity parameters.

Raises:

ThorlabsError – If not successful.

reset_rotation_modes()[source]

Reset the rotation modes for a rotational device.

Raises:

ThorlabsError – If not successful.

reset_stage_to_defaults()[source]

Reset the stage settings to defaults.

Raises:

ThorlabsError – If not successful.

resume_move_messages()[source]

Resume suspended move messages.

Raises:

ThorlabsError – If not successful.

set_backlash(distance)[source]

Sets the backlash distance (used to control hysteresis).

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

distance (int) – The backlash distance in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_dcpid_params(params)[source]

Set the PID parameters for DC motors used in an algorithm involving calculus.

Parameters:

params (structs.MOT_DC_PIDParameters) – The DC PID parameters.

Raises:
set_digital_outputs(outputs_bits)[source]

Sets the digital output bits.

Parameters:

outputs_bits (int) – Bit mask to set the states of the 4 digital output pins.

Raises:

ThorlabsError – If not successful.

set_direction(reverse)[source]

Sets the motor direction sense.

This function is used because some actuators have directions of motion reversed. This parameter will tell the system to reverse the direction sense when moving, jogging etc.

Parameters:

reverse (bool) – If True then directions will be swapped on these moves.

Raises:

ThorlabsError – If not successful.

set_encoder_counter(count)[source]

Set the Encoder Counter values.

Setting the encoder counter to zero, effectively defines a home position on the encoder strip. Note, setting this value does not move the device.

Parameters:

count (int) – The encoder count in encoder units.

Raises:

ThorlabsError – If not successful.

set_front_panel_lock(locked)[source]

Sets the device front panel lock state.

Parameters:

locked (bool) – True to lock the device, False to unlock

Raises:

ThorlabsError – If not successful.

set_homing_params_block(direction, limit, velocity, offset)[source]

Set the homing parameters.

Parameters:
Raises:

ThorlabsError – If not successful.

set_homing_velocity(velocity)[source]

Sets the homing velocity.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

velocity (int) – The homing velocity in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_jog_mode(mode, stop_mode)[source]

Sets the jog mode.

Parameters:
Raises:

ThorlabsError – If not successful.

set_jog_params_block(jog_params)[source]

Set the jog parameters.

Parameters:

jog_params (structs.MOT_JogParameters) – The jog parameters.

Raises:
set_jog_step_size(step_size)[source]

Sets the distance to move on jogging.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

step_size (int) – The step size in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_jog_vel_params(max_velocity, acceleration)[source]

Sets jog velocity parameters.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:
  • max_velocity (int) – The maximum velocity in DeviceUnits (see manual).

  • acceleration (int) – The acceleration in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_led_switches(led_switches)[source]

Set the LED indicator bits on the cube.

Parameters:

led_switches (int) – Sum of: 8 to indicate moving 2 to indicate end of track and 1 to flash on identify command.

Raises:

ThorlabsError – If not successful.

set_limit_switch_params(cw_lim, ccw_lim, cw_pos, ccw_pos, soft_limit_mode)[source]

Sets the limit switch parameters.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:
Raises:

ThorlabsError – If not successful.

set_limit_switch_params_block(params)[source]

Set the limit switch parameters.

Parameters:

params (structs.MOT_LimitSwitchParameters) – The limit switch parameters.

Raises:

ThorlabsError – If not successful.

set_limits_software_approach_policy(policy)[source]

Sets the software limits mode.

Parameters:

policy (enums.MOT_LimitsSoftwareApproachPolicy) – The soft limit mode as a enums.MOT_LimitsSoftwareApproachPolicy enum value or member name.

set_mmi_params(joystick_mode, joystick_max_velocity, joystick_acceleration, direction_sense, preset_position1, preset_position2, display_intensity)[source]

Set the MMI Parameters for the KCube Display Interface.

Deprecated calls set_mmi_params_ext() setting the display_timeout to 1 minute and the display_dim_intensity to 8.

Raises:

ThorlabsError – If not successful.

set_mmi_params_block(mmi_params)[source]

Sets the MMI parameters for the device.

Parameters:

mmi_params (structs.KMOT_MMIParams) – Options for controlling the mmi.

Raises:

ThorlabsError – If not successful.

set_mmi_params_ext(joystick_mode, joystick_max_velocity, joystick_acceleration, direction_sense, preset_position1, preset_position2, display_intensity, display_timeout, display_dim_intensity)[source]

Set the MMI Parameters for the KCube Display Interface.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Parameters:
  • joystick_mode (enums.KMOT_WheelMode) – The device joystick mode as a enums.KMOT_WheelMode enum value or member name.

  • joystick_max_velocity (int) – The joystick maximum velocity in DeviceUnits.

  • joystick_acceleration (int) – The joystick acceleration in DeviceUnits.

  • direction_sense (enums.KMOT_WheelDirectionSense) – The joystick direction sense as a enums.KMOT_WheelDirectionSense enum value or member name.

  • preset_position1 (int) – The first preset position in DeviceUnits.

  • preset_position2 (int) – The second preset position in DeviceUnits.

  • display_intensity (int) – The display intensity, range 0 to 100%.

  • display_timeout (int) – The display timeout, range 0 to 480 in minutes (0 is off, otherwise the inactivity period before dimming the display).

  • display_dim_intensity (int) – The display dimmed intensity, range 0 to 10 (after the timeout period the device display will dim).

Raises:

ThorlabsError – If not successful.

set_motor_params(steps_per_rev, gear_box_ratio, pitch)[source]

Sets the motor stage parameters.

Deprecated: calls set_motor_params_ext()

These parameters, when combined, define the stage motion in terms of RealWorldUnits [millimeters or degrees]. The real-world unit is defined from steps_per_rev * gear_box_ratio / pitch.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Parameters:
  • steps_per_rev (float) – The steps per revolution.

  • gear_box_ratio (float) – The gear box ratio.

  • pitch (float) – The pitch.

Raises:

ThorlabsError – If not successful.

set_motor_params_ext(steps_per_rev, gear_box_ratio, pitch)[source]

Sets the motor stage parameters.

These parameters, when combined, define the stage motion in terms of RealWorldUnits [millimeters or degrees]. The real-world unit is defined from steps_per_rev * gear_box_ratio / pitch.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Parameters:
  • steps_per_rev (float) – The steps per revolution.

  • gear_box_ratio (float) – The gear box ratio.

  • pitch (float) – The pitch.

Raises:

ThorlabsError – If not successful.

set_motor_travel_limits(min_position, max_position)[source]

Sets the motor stage min and max position.

These define the range of travel for the stage.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Parameters:
  • min_position (float) – The minimum position in RealWorldUnits [millimeters or degrees].

  • max_position (float) – The maximum position in RealWorldUnits [millimeters or degrees].

Raises:

ThorlabsError – If not successful.

set_motor_travel_mode(travel_mode)[source]

Set the motor travel mode.

Parameters:

travel_mode (enums.MOT_TravelModes) – The travel mode as a enums.MOT_TravelModes enum value or member name.

Raises:

ThorlabsError – If not successful.

set_motor_velocity_limits(max_velocity, max_acceleration)[source]

Sets the motor stage maximum velocity and acceleration.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Parameters:
  • max_velocity (float) – The maximum velocity in RealWorldUnits [millimeters or degrees].

  • max_acceleration (float) – The maximum acceleration in RealWorldUnits [millimeters or degrees].

Raises:

ThorlabsError – If not successful.

set_move_absolute_position(position)[source]

Sets the move absolute position.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

position (int) – The absolute position in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_move_relative_distance(distance)[source]

Sets the move relative distance.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

distance (int) – The relative position in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_position_counter(count)[source]

Set the position counter.

Setting the position counter will locate the current position. Setting the position counter will effectively define the home position of a motor.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:

count (int) – The position counter in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_rotation_modes(mode, direction)[source]

Set the rotation modes for a rotational device.

Parameters:
Raises:

ThorlabsError – If not successful.

set_stage_axis_limits(min_position, max_position)[source]

Sets the stage axis position limits.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:
  • min_position (int) – The minimum position in DeviceUnits (see manual).

  • max_position (int) – The maximum position in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_trigger_config_params(mode1, polarity1, mode2, polarity2)[source]

Set the trigger configuration parameters.

Parameters:
Raises:

ThorlabsError – If not successful.

set_trigger_config_params_block(trigger_config_params)[source]

Sets the trigger configuration parameters block.

Parameters:

trigger_config_params (structs.KMOT_TriggerConfig) – Options for controlling the trigger configuration.

Raises:
set_trigger_params_params(trigger_start_position_fwd, trigger_interval_fwd, trigger_pulse_count_fwd, trigger_start_position_rev, trigger_interval_rev, trigger_pulse_count_rev, trigger_pulse_width, cycle_count)[source]

Set the Trigger Parameters parameters.

See get_real_value_from_device_unit() for converting from a DeviceUnit to a RealValue.

Parameters:
  • trigger_start_position_fwd (int) – The trigger start position, forward, in DeviceUnits (see manual).

  • trigger_interval_fwd (int) – The trigger interval, forward, in DeviceUnits (see manual).

  • trigger_pulse_count_fwd (int) – Number of trigger pulses, forward.

  • trigger_start_position_rev (int) – The trigger start position, reverse, in DeviceUnits (see manual).

  • trigger_interval_rev (int) – The trigger interval, reverse, in DeviceUnits (see manual).

  • trigger_pulse_count_rev (int) – Number of trigger pulses., reverse.

  • trigger_pulse_width (int) – Width of the trigger pulse in milliseconds, range 10 (10us) to 650000 (650ms).

  • cycle_count (int) – Number of cycles to perform triggering.

Raises:

ThorlabsError – If not successful.

set_trigger_params_params_block(trigger_params_params)[source]

Set the Trigger Parameters parameters.

Parameters:

trigger_params_params (structs.KMOT_TriggerParams) – Options for controlling the trigger.

Raises:
set_vel_params(max_velocity, acceleration)[source]

Sets the move velocity parameters.

See get_device_unit_from_real_value() for converting from a RealValue to a DeviceUnit.

Parameters:
  • max_velocity (int) – The maximum velocity in DeviceUnits (see manual).

  • acceleration (int) – The acceleration in DeviceUnits (see manual).

Raises:

ThorlabsError – If not successful.

set_vel_params_block(min_velocity, max_velocity, acceleration)[source]

Set the move velocity parameters.

Parameters:
  • min_velocity (int) – The minimum velocity.

  • max_velocity (int) – The maximum velocity.

  • acceleration (int) – The acceleration.

Raises:

ThorlabsError – If not successful.

start_polling(milliseconds)[source]

Starts the internal polling loop.

This function continuously requests position and status messages.

Parameters:

milliseconds (int) – The polling rate, in milliseconds.

Raises:

ThorlabsError – If not successful.

stop_immediate()[source]

Stop the current move immediately (with the risk of losing track of the position).

Raises:

ThorlabsError – If not successful.

stop_polling()[source]

Stops the internal polling loop.

stop_profiled()[source]

Stop the current move using the current velocity profile.

Raises:

ThorlabsError – If not successful.

suspend_move_messages()[source]

Suspend automatic messages at ends of moves.

Useful to speed up part of real-time system with lots of short moves.

Raises:

ThorlabsError – If not successful.

time_since_last_msg_received()[source]

Gets the time, in milliseconds, since the last message was received.

This can be used to determine whether communications with the device is still good.

Returns:

  • int – The time, in milliseconds, since the last message was received.

  • boolTrue if monitoring is enabled otherwise False.

wait_for_message()[source]

Wait for next Message Queue item. See messages.

Returns:

  • int – The message type.

  • int – The message ID.

  • int – The message data.

Raises:

ThorlabsError – If not successful.