Newport

NewportESP301 Motor Controller

class instruments.newport.NewportESP301(filelike)[source]

Handles communication with the Newport ESP-301 multiple-axis motor controller using the protocol documented in the user’s guide.

Due to the complexity of this piece of equipment, and relative lack of documentation and following of normal SCPI guidelines, this class more than likely contains bugs and non-complete behaviour.

define_program(program_id)[source]

Erases any existing programs with a given program ID and instructs the device to record the commands within this with block to be saved as a program with that ID.

For instance:

>>> controller = NewportESP301.open_serial("COM3")
>>> with controller.define_program(15):
...     controller.axis[0].move(0.001, absolute=False)
...
>>> controller.run_program(15)
Parameters:program_id (int) – An integer label for the new program. Must be in range(1, 101).
execute_bulk_command(errcheck=True)[source]

Context manager to execute multiple commands in a single communication with device

Example:

with self.execute_bulk_command():
    execute commands as normal...
Parameters:errcheck (bool) – Boolean to check for errors after each command that is sent to the instrument.
reset()[source]

Causes the device to perform a hardware reset. Note that this method is only effective if the watchdog timer is enabled by the physical jumpers on the ESP-301. Please see the user’s guide for more information.

run_program(program_id)[source]

Runs a previously defined user program with a given program ID.

Parameters:program_id (int) – ID number for previously saved user program
search_for_home(axis=1, search_mode=0, errcheck=True)[source]

Searches the specified axis for home using the method specified by search_mode.

Parameters:
  • axis (int) – Axis ID for which home should be searched for. This value is 1-based indexing.
  • search_mode (NewportESP301HomeSearchMode) – Method to detect when Home has been found.
  • errcheck (bool) – Boolean to check for errors after each command that is sent to the instrument.
axis

Gets the axes of the motor controller as a sequence. For instance, to move along a given axis:

>>> controller = NewportESP301.open_serial("COM3")
>>> controller.axis[0].move(-0.001, absolute=False)

Note that the axes are numbered starting from zero, so that Python idioms can be used more easily. This is not the same convention used in the Newport ESP-301 user’s manual, and so care must be taken when converting examples.

Type:NewportESP301Axis
class instruments.newport.NewportESP301Axis(controller, axis_id)[source]

Encapsulates communication concerning a single axis of an ESP-301 controller. This class should not be instantiated by the user directly, but is returned by NewportESP301.axis.

abort_motion()[source]

Abort motion

disable()[source]

Turns motor axis off.

enable()[source]

Turns motor axis on.

get_status()[source]
Returns Dictionary containing values:
‘units’ ‘position’ ‘desired_position’ ‘desired_velocity’ ‘is_motion_done’
Return type:dict
move(position, absolute=True, wait=False, block=False)[source]
Parameters:
  • position (float or Quantity) – Position to set move to along this axis.
  • absolute (bool) – If True, the position pos is interpreted as relative to the zero-point of the encoder. If False, pos is interpreted as relative to the current position of this axis.
  • wait (bool) – If True, will tell axis to not execute other commands until movement is finished
  • block (bool) – If True, will block code until movement is finished
move_indefinitely()[source]

Move until told to stop

move_to_hardware_limit()[source]

move to hardware travel limit

read_setup()[source]
Returns dictionary containing:
‘units’ ‘motor_type’ ‘feedback_configuration’ ‘full_step_resolution’ ‘position_display_resolution’ ‘current’ ‘max_velocity’ ‘encoder_resolution’ ‘acceleration’ ‘deceleration’ ‘velocity’ ‘max_acceleration’ ‘homing_velocity’ ‘jog_high_velocity’ ‘jog_low_velocity’ ‘estop_deceleration’ ‘jerk’ ‘proportional_gain’ ‘derivative_gain’ ‘integral_gain’ ‘integral_saturation_gain’ ‘home’ ‘microstep_factor’ ‘acceleration_feed_forward’ ‘trajectory’ ‘hardware_limit_configuration’
Return type:dict of quantities.Quantity, float and int
search_for_home(search_mode=0)[source]

Searches this axis only for home using the method specified by search_mode.

Parameters:search_mode (NewportESP301HomeSearchMode) – Method to detect when Home has been found.
setup_axis(**kwargs)[source]

Setup a non-newport DC servo motor stage. Necessary parameters are.

  • ‘motor_type’ = type of motor see ‘QM’ in Newport documentation
  • ‘current’ = motor maximum current (A)
  • ‘voltage’ = motor voltage (V)
  • ‘units’ = set units (see NewportESP301Units)(U)
  • ‘encoder_resolution’ = value of encoder step in terms of (U)
  • ‘max_velocity’ = maximum velocity (U/s)
  • ‘max_base_velocity’ = maximum working velocity (U/s)
  • ‘homing_velocity’ = homing speed (U/s)
  • ‘jog_high_velocity’ = jog high speed (U/s)
  • ‘jog_low_velocity’ = jog low speed (U/s)
  • ‘max_acceleration’ = maximum acceleration (U/s^2)
  • ‘acceleration’ = acceleration (U/s^2)
  • ‘deceleration’ = set deceleration (U/s^2)
  • ‘error_threshold’ = set error threshold (U)
  • ‘proportional_gain’ = PID proportional gain (optional)
  • ‘derivative_gain’ = PID derivative gain (optional)
  • ‘interal_gain’ = PID internal gain (optional)
  • ‘integral_saturation_gain’ = PID integral saturation (optional)
  • ‘trajectory’ = trajectory mode (optional)
  • ‘position_display_resolution’ (U per step)
  • ‘feedback_configuration’
  • ‘full_step_resolution’ = (U per step)
  • ‘home’ = (U)
  • ‘acceleration_feed_forward’ = bewtween 0 to 2e9
  • ‘reduce_motor_torque’ = (time(ms),percentage)
stop_motion()[source]

Stop all motion on axis. With programmed deceleration rate

wait_for_motion(poll_interval=0.01, max_wait=None)[source]

Blocks until all movement along this axis is complete, as reported by is_motion_done.

Parameters:
  • poll_interval (float) – How long (in seconds) to sleep between checking if the motion is complete.
  • max_wait (float) – Maximum amount of time to wait before raising a IOError. If None, this method will wait indefinitely.
wait_for_position(position)[source]

Wait for axis to reach position before executing next command

Parameters:position (float or Quantity) – Position to wait for on axis
wait_for_stop()[source]

Waits for axis motion to stop before next command is executed

acceleration

Gets/sets the axis acceleration

Units:As specified (if a Quantity) or assumed to be of current newport unit
Type:Quantity or float
acceleration_feed_forward

Gets/sets the axis acceleration_feed_forward setting

Type:int
axis_id

Get axis number of Newport Controller

Type:int
current

Gets/sets the axis current (amps)

Units:As specified (if a Quantity) or assumed to be of current newport \(\text{A}\)
Type:Quantity or float
deceleration

Gets/sets the axis deceleration

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s^2}\)
Type:Quantity or float
derivative_gain

Gets/sets the axis derivative_gain

Type:float
desired_position

Gets desired position on axis in units

Units:As specified (if a Quantity) or assumed to be of current newport unit
Type:Quantity or float
desired_velocity

Gets the axis desired velocity in unit/s

Units:As specified (if a Quantity) or assumed to be of current newport unit/s
Type:Quantity or float
encoder_position

Gets the encoder position

Type:
encoder_resolution

Gets/sets the resolution of the encode. The minimum number of units per step. Encoder functionality must be enabled.

Units:The number of units per encoder step
Type:Quantity or float
error_threshold

Gets/sets the axis error threshold

Units:units
Type:Quantity or float
estop_deceleration

Gets/sets the axis estop deceleration

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s^2}\)
Type:Quantity or float
feedback_configuration

Gets/sets the axis Feedback configuration

Type:int
full_step_resolution

Gets/sets the axis resolution of the encode. The minimum number of units per step. Encoder functionality must be enabled.

Units:The number of units per encoder step
Type:Quantity or float
hardware_limit_configuration

Gets/sets the axis hardware_limit_configuration

Type:int
home

Gets/sets the axis home position. Default should be 0 as that sets current position as home

Units:As specified (if a Quantity) or assumed to be of current newport unit
Type:Quantity or float
homing_velocity

Gets/sets the axis homing velocity

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s}\)
Type:Quantity or float
integral_gain

Gets/sets the axis integral_gain

Type:float
integral_saturation_gain

Gets/sets the axis integral_saturation_gain

Type:float
is_motion_done

True if and only if all motion commands have completed. This method can be used to wait for a motion command to complete before sending the next command.

Type:bool
jerk

Gets/sets the jerk rate for the controller

Units:As specified (if a Quantity) or assumed to be of current newport unit
Type:Quantity or float
jog_high_velocity

Gets/sets the axis jog high velocity

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s}\)
Type:Quantity or float
jog_low_velocity

Gets/sets the axis jog low velocity

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s}\)
Type:Quantity or float
left_limit

Gets/sets the axis left travel limit

Units:The limit in units
Type:Quantity or float
max_acceleration

Gets/sets the axis max acceleration

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s^2}\)
Type:Quantity or float
max_base_velocity

Gets/sets the maximum base velocity for stepper motors

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s}\)
Type:Quantity or float
max_deceleration

Gets/sets the axis max decceleration. Max deaceleration is always the same as acceleration.

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s^2}\)
Type:Quantity or float
max_velocity

Gets/sets the axis maximum velocity

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s}\)
Type:Quantity or float
micro_inch = UnitQuantity('micro-inch', 1e-06 * in, 'uin')
microstep_factor

Gets/sets the axis microstep_factor

Type:int
motor_type

Gets/sets the axis motor type * 0 = undefined * 1 = DC Servo * 2 = Stepper motor * 3 = commutated stepper motor * 4 = commutated brushless servo motor

Type:int
Return type:NewportESP301MotorType
position

Gets real position on axis in units

Units:As specified (if a Quantity) or assumed to be of current newport unit
Type:Quantity or float
position_display_resolution

Gets/sets the position display resolution

Type:int
proportional_gain

Gets/sets the axis proportional_gain

Type:float
right_limit

Gets/sets the axis right travel limit

Units:units
Type:Quantity or float
trajectory

Gets/sets the axis trajectory

Type:int
units

Get the units that all commands are in reference to.

Type:Quantity with units corresponding to units of axis connected or int which corresponds to Newport unit number
velocity

Gets/sets the axis velocity

Units:As specified (if a Quantity) or assumed to be of current newport \(\frac{unit}{s}\)
Type:Quantity or float
voltage

Gets/sets the axis voltage

Units:As specified (if a Quantity) or assumed to be of current newport \(\text{V}\)
Type:Quantity or float
class instruments.newport.NewportESP301HomeSearchMode[source]

Enum containing different search modes code

home_index_signals = 1

Search for combined Home and Index signals.

home_signal_only = 2

Search only for the Home signal.

neg_index_signals = 6

Search for the negative limit and Index signals.

neg_limit_signal = 4

Search for the negative limit signal.

pos_index_signals = 5

Search for the positive limit and Index signals.

pos_limit_signal = 3

Search for the positive limit signal.

zero_position_count = 0

Search along specified axes for the +0 position.

NewportError

class instruments.newport.NewportError(errcode=None, timestamp=None)[source]

Raised in response to an error with a Newport-brand instrument.

static get_message(code)[source]

Returns the error string for a given error code

Parameters:code (str) – Error code as returned by instrument
Returns:Full error code string
Return type:str
axis

Gets the axis with which this error is concerned, or None if the error was not associated with any particlar axis.

Type:int
errcode

Gets the error code reported by the device.

Type:int
messageDict = {'0': 'NO ERROR DETECTED', '1': 'PCI COMMUNICATION TIME-OUT', '10': 'Reserved for future use', '11': 'Reserved for future use', '12': 'Reserved for future use', '13': 'GROUP NUMBER MISSING', '14': 'GROUP NUMBER OUT OF RANGE', '15': 'GROUP NUMBER NOT ASSIGNED', '16': 'GROUP NUMBER ALREADY ASSIGNED', '17': 'GROUP AXIS OUT OF RANGE', '18': 'GROUP AXIS ALREADY ASSIGNED', '19': 'GROUP AXIS DUPLICATED', '2': 'Reserved for future use', '20': 'DATA ACQUISITION IS BUSY', '21': 'DATA ACQUISITION SETUP ERROR', '22': 'DATA ACQUISITION NOT ENABLED', '23': 'SERVO CYCLE (400 µS) TICK FAILURE', '24': 'Reserved for future use', '25': 'DOWNLOAD IN PROGRESS', '26': 'STORED PROGRAM NOT STARTEDL', '27': 'COMMAND NOT ALLOWEDL', '28': 'STORED PROGRAM FLASH AREA FULL', '29': 'GROUP PARAMETER MISSING', '3': 'Reserved for future use', '30': 'GROUP PARAMETER OUT OF RANGE', '31': 'GROUP MAXIMUM VELOCITY EXCEEDED', '32': 'GROUP MAXIMUM ACCELERATION EXCEEDED', '33': 'GROUP MAXIMUM DECELERATION EXCEEDED', '34': ' GROUP MOVE NOT ALLOWED DURING MOTION', '35': 'PROGRAM NOT FOUND', '36': 'Reserved for future use', '37': 'AXIS NUMBER MISSING', '38': 'COMMAND PARAMETER MISSING', '39': 'PROGRAM LABEL NOT FOUND', '4': 'EMERGENCY SOP ACTIVATED', '40': 'LAST COMMAND CANNOT BE REPEATED', '41': 'MAX NUMBER OF LABELS PER PROGRAM EXCEEDED', '5': 'Reserved for future use', '6': 'COMMAND DOES NOT EXIST', '7': 'PARAMETER OUT OF RANGE', '8': 'CABLE INTERLOCK ERROR', '9': 'AXIS NUMBER OUT OF RANGE', 'x00': 'MOTOR TYPE NOT DEFINED', 'x01': 'PARAMETER OUT OF RANGE', 'x02': 'AMPLIFIER FAULT DETECTED', 'x03': 'FOLLOWING ERROR THRESHOLD EXCEEDED', 'x04': 'POSITIVE HARDWARE LIMIT DETECTED', 'x05': 'NEGATIVE HARDWARE LIMIT DETECTED', 'x06': 'POSITIVE SOFTWARE LIMIT DETECTED', 'x07': 'NEGATIVE SOFTWARE LIMIT DETECTED', 'x08': 'MOTOR / STAGE NOT CONNECTED', 'x09': 'FEEDBACK SIGNAL FAULT DETECTED', 'x10': 'MAXIMUM VELOCITY EXCEEDED', 'x11': 'MAXIMUM ACCELERATION EXCEEDED', 'x12': 'Reserved for future use', 'x13': 'MOTOR NOT ENABLED', 'x14': 'Reserved for future use', 'x15': 'MAXIMUM JERK EXCEEDED', 'x16': 'MAXIMUM DAC OFFSET EXCEEDED', 'x17': 'ESP CRITICAL SETTINGS ARE PROTECTED', 'x18': 'ESP STAGE DEVICE ERROR', 'x19': 'ESP STAGE DATA INVALID', 'x20': 'HOMING ABORTED', 'x21': 'MOTOR CURRENT NOT DEFINED', 'x22': 'UNIDRIVE COMMUNICATIONS ERROR', 'x23': 'UNIDRIVE NOT DETECTED', 'x24': 'SPEED OUT OF RANGE', 'x25': 'INVALID TRAJECTORY MASTER AXIS', 'x26': 'PARAMETER CHARGE NOT ALLOWED', 'x27': 'INVALID TRAJECTORY MODE FOR HOMING', 'x28': 'INVALID ENCODER STEP RATIO', 'x29': 'DIGITAL I/O INTERLOCK DETECTED', 'x30': 'COMMAND NOT ALLOWED DURING HOMING', 'x31': 'COMMAND NOT ALLOWED DUE TO GROUP', 'x32': 'INVALID TRAJECTORY MODE FOR MOVING'}
start_time = datetime.datetime(2020, 11, 20, 2, 48, 24, 908384)
timestamp

Geturns the timestamp reported by the device as the time at which this error occured.

Type:datetime