herosdevices.hardware.newport.picomotor

HEROS driver for newport picomotors.

Module Contents

class herosdevices.hardware.newport.picomotor.MotorType[source]

Bases: enum.IntEnum

Motor types supported by Picomotor controller 8742.

UNCONNECTED = 0
UNKNOWN = 1
TINY = 2
STANDARD = 3
class herosdevices.hardware.newport.picomotor.PicomotorController8742(host: str, port: int = 23, timeout: int = 5000)[source]

Bases: herosdevices.core.templates.SerialDeviceTemplate

HEROS driver for 4-channel picomotor controller 8742.

Parameters:
  • host – IP address of the controller, e.g. “192.168.1.42”.

  • port – listening port, typically 23.

MIN_AXIS = 1
MAX_AXIS = 4
identifier: str
send_command(command: str, axis: int | None = None, argument: int | str | None = None) None[source]

Send a command to the controller.

Parameters:
  • command – the command string.

  • axis – the axis the command is to be executed on. Not required for global commands.

  • argument – arguments to the command if required.

query_for_int(query: str, axis: int | None = None) int | None[source]

Query an integer from the controller.

Parameters:
  • query – the query command.

  • axis – the axis the command is to be executed on. Not required for global queries.

query_for_string(query: str, axis: int | None = None) str[source]

Query a string from the controller.

Parameters:
  • query – the query command.

  • axis – the axis the command is to be executed on. Not required for global queries.

query_error() tuple[int, str][source]

Query the latest error from the controller.

Upon reading, errors are cleared from the controller’s buffer and thus can only be read once.

Returns:

tuple (error code, error message). The first digit of the error code indicates the axis the error has occured on.

reset() None[source]

Soft reset the controller.

Note

Connection will be interrupted.

abort_motion() None[source]

Stop any motion immediately without deceleration.

address
connection
class herosdevices.hardware.newport.picomotor.Picomotor(controller: PicomotorController8742, axis: int)[source]

HEROS driver for a single Picomotor.

Parameters:
  • controller – RemoteHERO of the controller the motor is attached to.

  • axis – port of the controller. Available axes are 1,2,3,4.

MIN_VELOCITY = 1
MAX_VELOCITY = 2000
MIN_ACCELERATION = 1
MAX_ACCELERATION = 200000
MIN_STEP_COUNT = -2147483648
MAX_STEP_COUNT = 2147483647
controller
axis
property velocity: int

Query the velocity.

Returns:

velocity in steps/second.

property acceleration: int

Query the acceleration.

Returns:

acceleration in steps/second².

property home_position: int

Query the home position.

All absolute moves are relative to “home”.

Returns:

step count considered home.

property motion_done: bool

Check if a move is in progress.

Returns:

True when no movement is in progrogress.

move_indefinite(direction: int) None[source]

Start a movement.

The motor will move indefinitely until a stop_motion() command is issued.

Parameters:

direction – positive value for increasing step count, negative for decreasing.

move_absolute(target_position: int) None[source]

Move to the desired step count.

Parameters:

target_position – absolute position relative to “home” (see set_home_position()). Must be within [-2_147_483_648, 2_147_483_647]

move_relative(steps: int) None[source]

Move relative by the desired step count.

Parameters:

steps – amount of steps to move by. Must be within [-2_147_483_648, 2_147_483_647].

property target_position: int

Query the target position of the current move.

Returns:

target step count of the current move.

property actual_position: int

Query the position of the motor.

Returns:

current step count of the motor.

stop_motion() None[source]

Stop the movement.

property motor_type: MotorType

Query the type of Motor.

Returns:

motor type as specified in MotorType