devices.owis:SMS
OWIS SMS motor controller class for stepper motor control.
Usage
devices.owis:SMS(
interface,
steps_per_revolution=200,
gear_ratio=1400,
angle_ratio=540,
limits=None,
**kwargs,
)Interface to the SM INT controller with two SMK 02-Z stepper motor drivers. By default it is configured for a rotary stepper motor with 200 steps per revolution and a 1400:1 gear ratio, converting steps to degrees. Up to 4 axes (X, Y, Z, R) are supported with absolute and relative movement commands.
Parameters
interface: str-
VISA address, e.g. ASRL/dev/ttyUSB0::INSTR.
steps_per_revolution: int = 200-
Number of steps per motor revolution, default is 200.
gear_ratio: float = 1400-
The gear ratio of the motor, default is 1400.
angle_ratio: float = 540-
The angle ratio for conversion, default is 540 (1.5 revolutions).
limits: dict = None-
Position limits per axis, formatted as {axis_number: {“lo”: lower_limit, “hi”: upper_limit}}.
**kwargs- Additional parameters passed to VisaDevice: write_termination (default “), read_termination (default”), cmdpers (default 50), timeout (default 80000), baud_rate (default 2400).
Notes
To use a different unit system (e.g. linear positioning in mm instead of degrees), adjust steps_per_revolution, gear_ratio and angle_ratio to match your mechanical setup.
Methods
| Name | Description |
|---|---|
| configure_drive() | Configure the drive settings for an axis. |
| get_moving() | Check if the specified axis is currently moving. |
| get_pos() | Get the current position of an axis. |
| id() | Get the device identification string. |
| initialize() | Initialize the axis and drive the stage to position 0. |
| move_abs() | Move to absolute position and block until position is reached. |
| move_abs_nonblocking() | Move to absolute position without blocking. |
| move_rel() | Move relative to current position and block until complete. |
| move_rel_nonblocking() | Move relative to current position without blocking. |
| stop() | Stop the motion of an axis immediately. |
configure_drive()
Configure the drive settings for an axis.
Usage
configure_drive(
stepfreq,
ramp,
startfreq,
ax=0,
)Configures the parameters used by move_abs and move_rel. If drive/axis settings are not configured, device internal defaults are used.
Parameters
stepfreq: int-
Step frequency in Hz. Maximum frequency is 15 kHz.
ramp: int-
Ramp time in ms.
startfreq: int-
Start frequency in Hz at the beginning of the ramp.
ax: int = 0- Axis to be configured (0-3), default is 0.
Notes
(stepfreq-startfreq)/ramp must be >= 100 Hz/s (watch units). For more details, refer to the device manual.
get_moving()
Check if the specified axis is currently moving.
Usage
get_moving(ax=0)Parameters
ax: int = 0- Axis to check (0-3), default is 0.
Returns
bool- True if the axis is moving, False otherwise.
get_pos()
Get the current position of an axis.
Usage
get_pos(ax=0)Parameters
ax: int = 0- Axis to query (0-3), default is 0.
Returns
float- Current position in units defined by _steps_per_deg.
id()
Get the device identification string.
Usage
id()Returns
str- The device ID string.
initialize()
Initialize the axis and drive the stage to position 0.
Usage
initialize(ax=0)MOTION STARTS IMMEDIATELY if the axis is not at zero position!
Parameters
ax: int = 0- Axis to be initialized (0-3), default is 0.
move_abs()
Move to absolute position and block until position is reached.
Usage
move_abs(
pos,
ax=0,
)Adjust the timeout for very long strides to ensure the function waits until the target position is reached.
Parameters
pos: float-
Desired absolute position in units defined by _steps_per_deg.
ax: int = 0- Axis to move (0-3), default is 0.
Returns
None- Function returns silently if the position is outside the configured limits or if the motor is already moving.
move_abs_nonblocking()
Move to absolute position without blocking.
Usage
move_abs_nonblocking(
pos,
ax=0,
)Initiates a movement to the specified position and returns immediately, without waiting for the motion to complete.
Parameters
pos: float-
Desired absolute position in units defined by _steps_per_deg.
ax: int = 0- Axis to move (0-3), default is 0.
Returns
None- Function returns silently if the position is outside the configured limits or if the motor is already moving.
move_rel()
Move relative to current position and block until complete.
Usage
move_rel(
pos,
ax=0,
)Adjust the timeout for very long strides to ensure the function waits until the target position is reached.
Parameters
pos: float-
Desired relative position in units defined by _steps_per_deg.
ax: int = 0- Axis to move (0-3), default is 0.
Returns
None- Function returns silently if the movement would exceed limits or if the motor is already moving.
move_rel_nonblocking()
Move relative to current position without blocking.
Usage
move_rel_nonblocking(
pos,
ax=0,
)Initiates a relative movement and returns immediately, without waiting for the motion to complete.
Parameters
pos: float-
Desired relative position in units defined by _steps_per_deg.
ax: int = 0- Axis to move (0-3), default is 0.
Returns
None- Function returns silently if the movement would exceed limits or if the motor is already moving.
stop()
Stop the motion of an axis immediately.
Usage
stop(ax=0)Parameters
ax: int = 0- Axis to stop (0-3), default is 0.