st10_controller
frog.hardware.plugins.stepper_motor.st10_controller
¤
Code for interfacing with the ST10-Q-NN stepper motor controller.
Applied Motion 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 src/frog/hardware/plugins/stepper_motor/st10_controller.py
49 50 51 52 | |
ST10Controller(port, baudrate=9600, timeout=5.0, nadir_offset=0.0, hot_bb_angle=0.0, cold_bb_angle=0.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.
It is assumed that the optoswitch used for homing is connected to input 6 (rising edge). Limit switches, if present, will be disabled.
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
|
nadir_offset
|
float
|
Angle of nadir relative to homing switch (degrees) |
0.0
|
hot_bb_angle
|
float
|
Angle of hot black body relative to nadir (degrees) |
0.0
|
cold_bb_angle
|
float
|
Angle of cold black body relative to nadir (degrees) |
0.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 src/frog/hardware/plugins/stepper_motor/st10_controller.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 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 254 255 256 257 258 259 260 261 262 | |
Attributes¤
HOME_SWITCH_INPUT = 6
class-attribute
instance-attribute
¤
The input number for the home switch.
ST10_MODEL_ID = '024'
class-attribute
instance-attribute
¤
The model ID 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 src/frog/hardware/plugins/stepper_motor/st10_controller.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
stop_moving()
¤
Immediately stop moving the motor.
Source code in src/frog/hardware/plugins/stepper_motor/st10_controller.py
604 605 606 | |
ST10ControllerError
¤
Bases: DeviceError
Indicates that an error has occurred with the ST10 controller.