qmi.instruments.newport.single_axis_motion_controller

Instrument driver for a Newport single axis motion controller. This is a base class for other controllers, but can be used without extending.

Classes

HomeSearchTypes(value)

The types of HOME search used with the OR command.

Newport_SingleAxisMotionController(context, ...)

Instrument driver for a Newport single-axis motion controller.

class qmi.instruments.newport.single_axis_motion_controller.HomeSearchTypes(value)

The types of HOME search used with the OR command.

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class qmi.instruments.newport.single_axis_motion_controller.Newport_SingleAxisMotionController(context: QMI_Context, name: str, transport: str, serial: str, actuators: Dict[int | None, LinearActuator], baudrate: int)

Instrument driver for a Newport single-axis motion controller. This device is the controller for an actuator and is controlled via serial.

property controller_address: int | None

Address of the controller that needs to be controlled.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

reset(controller_address: int | None = None) None

Reset the instrument. Equivalent to a power-up.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_idn(controller_address: int | None = None) QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

QMI_InstrumentIdentification with the information of the instrument.

get_stage_identifier(controller_address: int | None = None) str

Read stage identifier.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

The stage identifier.

get_positioner_error_and_state(controller_address: int | None = None) Tuple[List[str], str]

Get the positioner error and the current state of the controller.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Execute the home search. This is needed before any motion commands can be executed. It finds an origin position for the actuator. Can be done only in NOT REFERENCED state.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_home_search_timeout(timeout: float | None = None, controller_address: int | None = None) None

Set the timeout for the home search.

Parameters:
  • timeout – Optional timeout in seconds. If not set, it defaults DEFAULT_HOME_SEARCH_TIMEOUT

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_home_search_timeout(controller_address: int | None = None) float

Get the timeout for the home search.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

The timeout in seconds.

move_absolute(position: float, controller_address: int | None = None) None

Perform an absolute move. This command can take several seconds to finish. However, it is not blocking. Use other methods such as get_positioner_error_and_state to query the state of the controller.

Parameters:
  • position – New position to move to, in encoder units. Must be within actuator’s travel range.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_setpoint(controller_address: int | None = None) float

Get the set-point position of the actuator according to the encoder value.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Set-point position in encoder units.

get_position(controller_address: int | None = None) float

Get the actual position of the actuator according to the encoder value.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Current position in encoder units.

move_relative(displacement: float, controller_address: int | None = None) None

Perform a relative move from the current position.

Parameters:
  • displacement – Displacement from current position.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_motion_time(displacement: float, controller_address: int | None = None) float

Get the motion time for a relative move.

Parameters:
  • displacement – Displacement from current position (relative move size).

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Motion time for a relative move in seconds.

is_in_configuration_state(controller_address: int | None = None) bool

Get the CONFIGURATION state of the controller.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Boolean indicating if the controller is in CONFIGURATION state (True) or not (False).

Return type:

state

set_configuration_state(state: bool, controller_address: int | None = None) None

Set the NOT REFERENCED or CONFIGURATION state of the controller. If the controller is not in the either state, then an exception is raised in the _check_error. NOTE: In this state the parameters are stored in the flash memory of the controller.

Parameters:
  • state – False for setting the configuration state from CONFIGURATION to NOT REFERENECED or True for setting the configuration state from NOT REFERENECED to CONFIGURATION.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

is_in_disable_state(controller_address: int | None = None) bool

Get the DISABLE or READY state of the controller.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Boolean to indicate state is DISABLE (True) or READY (False)

Return type:

state

set_disable_state(state: bool, controller_address: int | None = None) None

Set the DISABLE or READY state of the controller from the READY or DISABLE state, respectively. If the controller is not in the either state, then an exception is raised in the _check_error. NOTE: In this state the parameters are stored in the flash memory of the controller.

Parameters:
  • state – True for setting state from READY to DISABLE, False for vice versa.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_acceleration(controller_address: int | None = None) float

Get the acceleration of the actuator in preset unit/s^2, so if the encoder unit is mm, then the returned value is in mm/s^2.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Encoder increment value.

set_acceleration(acceleration: float, persist: bool = False, controller_address: int | None = None) None

Set the acceleration at which the actuator moves. Can be set only in CONFIGURATION, READY and DISABLE states.

Parameters:
  • acceleration – Acceleration in preset unit/s^2. The unit depends on the encoder resolution, which is usually set to 1mm.

  • persist – Flag to indicate if the acceleration should be persisted to the controller’s memory, so it is still available after powering down the controller. When not persisted, the maximum allowable acceleration that can be set is the one stored in the controller’s memory.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_velocity(controller_address: int | None = None) float

Get the velocity of the actuator in unit/s, so if the encoder unit is mm, then the returned value is in mm/s.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_velocity(velocity: float, persist: bool = False, controller_address: int | None = None) None

Set the velocity at which the actuator moves.

Parameters:
  • velocity – Velocity in unit/s. The unit depends on the encoder resolution, which is usually set to 1mm.

  • persist – Flag to indicate if the velocity should be persisted to the controller’s memory, so it is still available after powering down the controller. When not persisted, the maximum allowable velocity that can be set is the one stored in the controller’s memory.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_jerk_time(controller_address: int | None = None) float

Get the jerk time of the actuator.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Jerk time in seconds.

Return type:

jerk_time

set_jerk_time(jerk_time: float, persist: bool = False, controller_address: int | None = None) None

Set the jerk time at which the actuator accelerates.

Parameters:
  • jerk_time – Jerk time in seconds.

  • persist – Flag to indicate if the jerk time should be persisted to the controller’s memory, so it is still available after powering down the controller. When not persisted, the maximum allowable jerk time that can be set is the one stored in the controller’s memory.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_error(controller_address: int | None = None) Tuple[str, str]

Get the currently memorised error.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

A tuple containing the error code and the human-readable error message.

stop_motion(controller_address: int | None = None) None

Stop the motion of the actuator by decelerating it. Works on DISABLE, READY and MOTION states.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_backlash_compensation(controller_address: int | None = None) float

Get the backlash value in encoder units.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_backlash_compensation(backlash_comp: float, controller_address: int | None = None) None

Set the backlash compensation of a controller.

Parameters:
  • backlash_comp – backlash compensation in encoder units.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_hysteresis_compensation(controller_address: int | None = None) float

Get the hysteresis value in encoder units.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_hysteresis_compensation(hysteresis_comp: float, controller_address: int | None = None) None

Set the hysteresis compensation of a controller.

Parameters:
  • hysteresis_comp – hysteresis compensation in encoder units.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_home_search_type(controller_address: int | None = None) int

Get the type of HOME search used with the OR command.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_home_search_type(home_search_type: int, controller_address: int | None = None) None

Set the type of HOME search used with the OR command.

Parameters:
  • home_search_type – New type of HOME search used with the OR command.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_peak_current_limit(controller_address: int | None = None) float

Get the controller’s maximum or peak output current limit to the motor.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_peak_current_limit(current_limit: float, controller_address: int | None = None) None

Set the controller’s maximum or peak output current limit to the motor.

Parameters:
  • current_limit – Controller’s maximum or peak output current limit to the motor in [A].

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_rms_current_limit(controller_address: int | None = None) float

Get the controller’s rms output current limit to the motor.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_rms_current_limit(current_limit: float, controller_address: int | None = None) None

Set the controller’s maximum or rms output current limit to the motor.

Parameters:
  • current_limit – Controller’s maximum or rms output current limit to the motor in [A].

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_rms_current_averaging_time(controller_address: int | None = None) float

Get the controller’s averaging period for rms current calculation.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

set_rms_current_averaging_time(averaging_time: float, controller_address: int | None = None) None

Set the controller’s averaging period for rms current calculation.

Parameters:
  • averaging_time – Controller’s averaging period for rms current calculation in [s].

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_analog_input_value(controller_address: int | None = None) float

Get the analog input value.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Analog input value in Volts.

get_ttl_input_value(controller_address: int | None = None) int

Get the TTL input value. The returned decimal number represents the binary word made of all 4 inputs, where bit 0 is input 1, bit 1 is input 2, bit 2 is input 3, and bit 3 is input 4.

The TTL input value is 1 when the corresponding voltage on the pin is larger than 2.4 volts, and it is 0 when the corresponding voltage is below 0.8 volt. When the voltage is between these two values, the result is unreliable and can be 1 or 0.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

TTL input value in bits. E.g. ‘5’ means input 0 and 2 are high, all others are low.

get_ttl_output_value(controller_address: int | None = None) int

Get the TTL output value. The returned decimal number represents the binary word made of all 4 outputs, where bit 0 is output 1, bit 1 is output 2, bit 2 is output 3, and bit 3 is output 4.

A 1 represents closed collector output transistor of the output. A 0 represents open collector output transistor of the output.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

TTL output value in bits. E.g. ‘3’ means TTL outputs 1 & 2 are closed and outputs 3 & 4 open.

set_ttl_output_value(ttl_output_value: int, controller_address: int | None = None) None

Get the TTL output value. The value is a binary word made of all 4 outputs, where bit 0 is output 1, bit 1 is output 2, bit 2 is output 3, and bit 3 is output 4.

A 1 closes the open collector output transistor of the output. A 0 blocks the open collector output transistor of the output.

Parameters:
  • ttl_output_value – New TTL output value.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_controller_rs485_address() int

Get the controller’s RS-485 address. Controller address is always 1 for this command.

Returns:

Controller’s axis number for new RS485 address.

Return type:

rs485_address

set_controller_rs485_address(rs485_address: int) None

Set the controller’s RS-485 address. Controller address is always 1 for this command.

Parameters:

rs485_address – Controller’s axis number for new RS485 address.

get_negative_software_limit(controller_address: int | None = None) float

Get the negative software limit.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Controller’s negative software limit.

Return type:

neg_sw_limit

set_negative_software_limit(neg_sw_limit: float, persist: bool = False, controller_address: int | None = None) None

Set the negative software limit.

Parameters:
  • neg_sw_limit – Controller’s negative software limit.

  • persist – Flag to indicate if the software limit should be persisted to the controller’s memory, so it is still available after powering down the controller. When not persisted, the negative software limit is the one stored in the controller’s memory.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

get_positive_software_limit(controller_address: int | None = None) float

Get the positive software limit.

Parameters:

controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

Returns:

Controller’s positive software limit.

Return type:

pos_sw_limit

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

set_positive_software_limit(pos_sw_limit: float, persist: bool = False, controller_address: int | None = None) None

Set the positive software limit.

Parameters:
  • pos_sw_limit – Controller’s positive software limit.

  • persist – Flag to indicate if the software limit should be persisted to the controller’s memory, so it is still available after powering down the controller. When not persisted, the positive software limit is the one stored in the controller’s memory.

  • controller_address – Optional address of the controller that needs to be controlled. By default, it is set to the initialised value of the controller address.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.