st10_controller
frog.hardware.plugins.stepper_motor.st10_controller
¤
Code for interfacing with the ST10-Q-NN stepper motor controller.
Applied Motions have their own bespoke programming language ("Q") for interfacing with their devices, of which we're only using a small portion here.
The specification is available online
https://appliedmotion.s3.amazonaws.com/Host-Command-Reference_920-0002W_0.pdf
Attributes¤
Classes¤
ST10AlarmCode
¤
Bases: IntFlag
The set of possible alarm codes for the ST10 motor controller.
These values are taken from the manual. Note that the alarm code is a bit mask, so several of these may be set at once (if you're especially unlucky!).
Functions¤
__str__()
¤
Convert the set alarm code bits to a string.
Source code in frog/hardware/plugins/stepper_motor/st10_controller.py
48 49 50 51 |
|
ST10Controller(port, baudrate=9600, timeout=5.0)
¤
Bases: SerialDevice
, StepperMotorBase
An interface for the ST10-Q-NN stepper motor controller.
This class allows for moving the mirror to arbitrary positions and retrieving its current position.
Create a new ST10Controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
port
|
str
|
Description of USB port (vendor ID + product ID) |
required |
baudrate
|
int
|
Baud rate of port |
9600
|
timeout
|
float
|
Connection timeout |
5.0
|
Raises:
Type | Description |
---|---|
SerialException
|
Error communicating with device |
SerialTimeoutException
|
Timed out waiting for response from device |
ST10ControllerError
|
Malformed message received from device |
Source code in frog/hardware/plugins/stepper_motor/st10_controller.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
Attributes¤
ST10_MODEL_ID = '107F024'
class-attribute
instance-attribute
¤
The model and revision number for the ST10 controller we are using.
STEPS_PER_ROTATION = 50800
class-attribute
instance-attribute
¤
The total number of steps in one full rotation of the mirror.
alarm_code
property
¤
Get the current alarm code for the controller, if any.
is_moving
property
¤
Whether the motor is moving.
This is done by checking whether the status code has the moving bit set.
status_code
property
¤
The status code of the device.
For a complete list of status codes and their meanings, consult the manual.
step
property
writable
¤
The current state of the device's step counter.
This makes use of the "IP" command, which estimates the immediate position of the motor. If the motor is moving, this is an estimated (calculated trajectory) position. If the motor is stationary, this is the actual position.
Raises:
Type | Description |
---|---|
SerialException
|
Error communicating with device |
SerialTimeoutException
|
Timed out waiting for response from device |
ST10ControllerError
|
Malformed message received from device |
steps_per_rotation
property
¤
Get the number of steps that correspond to a full rotation.
Functions¤
close()
¤
Close device and leave mirror facing downwards.
This prevents dust accumulating.
Source code in frog/hardware/plugins/stepper_motor/st10_controller.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
stop_moving()
¤
Immediately stop moving the motor.
Source code in frog/hardware/plugins/stepper_motor/st10_controller.py
557 558 559 |
|
ST10ControllerError
¤
Bases: SerialException
Indicates that an error has occurred with the ST10 controller.