pystages.smc100

class pystages.smc100.ErrorAndState

Information returned when querying positioner error and controller state.

error = 0
property is_disabled: bool
Returns:

True if state is one of DISABLE_x states.

property is_homing: bool
Returns:

True if state is one of HOMING_x states.

property is_jogging: bool
Returns:

True if state is one of JOGGING_x states.

property is_moving: bool
Returns:

True if state is MOVING.

property is_ready: bool
Returns:

True if state is one of READY_x states.

property is_referenced: bool
Returns:

True if state is not one of the NOT_REFERENCED_x states.

state = 10

Class to control Newport SMC100 controllers. This uses a serial device to communicate with multiple controllers which may be configured in daisy-chain configuration.

Current design allows multiple instance of SMC100 to share the same communication channel without being considered as the same stage. For example, we can have two XY stages using four SMC100 controllers connected in daisy-chain configuration.

As specified in SMC100 controllers documentation, the address of the first controller in the daisy chain is always zero.

__init__(dev: str | None = None)
Parameters:

dev – Serial device. For instance ‘/dev/ttyUSB0’. If not provided, a suitable device is searched according to according to vendor and product IDs

query(address: int | None, command: str, lazy_res: bool = False) str | None

Send a query.

Parameters:
  • address – Controller address. int.

  • command – Command string, without ‘?’.

  • lazy_res – If True, response is not fetched. The caller must ensure the response will be fetched later. This flag can be used for optimization to send a batch of queries and then fetch all the response.

Returns:

Received response, or None if lazy_res is True.

receive() str | None

Read input serial buffer to get a response. Blocks until a response is available.

Returns:

Received response string, CR-LF removed.

response(address: int | None, command: str) str

Get and return the response of a query. Parameters are required to check the header of the response.

Parameters:
  • address – Controller address. int.

  • command – Command string, without ‘?’.

send(address: int | None, command: str)

Send a command to a controller.

Parameters:
  • address – Controller address. If None, only the command is sent without prefix.

  • command – Command string. Don’t include address nor CR LF since they are added automatically by this method.

class pystages.smc100.SMC100(dev: str | Link | SMC100 | None, addresses: List[int])

Class to command Newport SMC100 controllers.

__init__(dev: str | Link | SMC100 | None, addresses: List[int])
Parameters:
  • dev – Serial device string (for instance ‘/dev/ttyUSB0’ or ‘COM0’), an instance of Link, or an instance of SMC100 sharing the same serial device. If not provided, a suitable device is searched according to according to vendor and product IDs

  • addresses – An iterable of int controller addresses.

controller_address(addr: int)

Get controller’s RS-485 address. int in [2, 31].

enter_configuration_state(addr: int)

Enter configuration state.

enter_leave_disable_state(addr: int | None, enter: bool = True)

Permits for a specified axis to enter or leave the DISABLE state. DISABLE state makes the motor not energized and opens the control loop.

Parameters:
  • addr – address of the axis to operate. If None is passed, it applies to all controllers

  • enter – True to enter, False to leave DISABLE state

get_error_and_state(addr: int)

Query current motion controller errors and state. Querying the error and state may clear error flags.

Parameters:

addr – Address of the axis.

Returns:

Current error and state, in a ErrorAndState instance.

home(wait=False)

Perform home search.

Parameters:

wait – Optionally waits for move operation to be done.

Perform home search. Home search is performed even if the axes are already referenced. It may be better to use home_search_if_required.

home_search_if_required()

Perform home search for all axes which are not referenced.

property is_disabled: bool

Indicates if the stage is currently in DISABLE state. :return: Disabled state of the stage

property is_moving: bool

Indicates if the stage is currently moving due to MOVE, HOME or JOG operation.

Returns:

Moving state of the stage

leave_configuration_state(addr)

Leave configuration state. If defined parameters are valid, the controller saves them in the flash memory.

move_relative(addr: int, offset: float)

Moves relatively an axis from a given offset

Parameters:
  • addr – addr of axis to move

  • offset – offset value

property position

Stage position, in micrometers.

Getter:

Query and return current stage position.

Setter:

Move stage.

reset(addr: int | None = None)

Resets the controller at specified address. For all controllers if not specified

Parameters:

addr – address of the controller to reset

set_controller_address(addr: int, value: int)

Set controller’s RS-485 address. int in [2, 31]. Changing the address is only possible when the controller is in configuration state.

set_position(addr: int, value: float, blocking=True)

Sets the position of a single axis

Parameters:
  • addr – address of the axis to set the position

  • value – stage position, in micrometers

  • blocking – if True, blocking mode: wait for the position to be reached before exit.

stop(addr: int | None = None)

Stops the motion on an axis. On all axis if addr not specified.

Parameters:

addr – Address of the axis to stop. If None, stop all the controllers

class pystages.smc100.State(value)

Possible controller states. The values in this enumeration corresponds to the values returned by the controller.

CONFIGURATION = 20
DISABLE_FROM_JOGGING = 62
DISABLE_FROM_MOVING = 61
DISABLE_FROM_READY = 60
HOMING_RS232 = 30
HOMING_SMCRC = 31
JOGGING_FROM_DISABLE = 71
JOGGING_FROM_READY = 70
MOVING = 40
NOT_REFERENCED_FROM_CONFIGURATION = 12
NOT_REFERENCED_FROM_DISABLE = 13
NOT_REFERENCED_FROM_HOMING = 11
NOT_REFERENCED_FROM_JOGGING = 17
NOT_REFERENCED_FROM_MOVING = 15
NOT_REFERENCED_FROM_READY = 14
NOT_REFERENCED_FROM_RESET = 10
NOT_REFERENCED_STAGE_ERROR = 16
READY_FROM_DISABLE = 52
READY_FROM_HOMING = 50
READY_FROM_JOGGING = 53
READY_FROM_MOVING = 51