KST101/KST201¤
Communicate with a KST101 or KST201 motion controller from Thorlabs.
KST
(ThorlabsMotion)
¤
KST(equipment: Equipment)
flowchart LR
msl.equipment_resources.thorlabs.kst.KST[KST]
msl.equipment_resources.thorlabs.motion.ThorlabsMotion[ThorlabsMotion]
msl.equipment.schema.Interface[Interface]
msl.equipment_resources.thorlabs.motion.ThorlabsMotion --> msl.equipment_resources.thorlabs.kst.KST
msl.equipment.schema.Interface --> msl.equipment_resources.thorlabs.motion.ThorlabsMotion
click msl.equipment_resources.thorlabs.kst.KST href "" "msl.equipment_resources.thorlabs.kst.KST"
click msl.equipment_resources.thorlabs.motion.ThorlabsMotion href "" "msl.equipment_resources.thorlabs.motion.ThorlabsMotion"
click msl.equipment.schema.Interface href "" "msl.equipment.schema.Interface"
Communicate with a KST101 or KST201 motion controller from Thorlabs.
The ZFS and ZST series of actuators are supported.
Regular-expression patterns that are used to select this Resource when connect() is called.
manufacturer=r"Thorlabs"
model=r"KST"
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment
|
Equipment
|
An Equipment instance. |
required |
A Connection instance supports the following
properties for a KST motion controller, as well as the properties defined in
ThorlabsMotion.
Connection Properties:
| Name | Type | Description |
|---|---|---|
actuator |
str | None
|
The actuator that is attached to the motion controller.
If not specified, the value is looked up in a file that is managed by
Thorlabs software. If the Thorlabs file cannot be found, an exception is
raised. Default: |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/kst.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
disable
¤
disable(channel: int = 1) -> None
Disable a channel.
When disabled, power is removed from the motor and it can be freely moved by hand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to disable. |
1
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
171 172 173 174 175 176 177 178 179 | |
disconnect
¤
disconnect() -> None
Disconnect from the Thorlabs motion controller.
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
181 182 183 184 185 186 187 188 189 190 191 192 | |
enable
¤
enable(channel: int = 1) -> None
Enable a channel.
When enabled, power is applied to the motor so it is fixed in position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to enable. |
1
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
194 195 196 197 198 199 200 201 202 | |
encoder
¤
Get the position of the actuator or stage in encoder counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the encoder counts of. |
1
|
Returns:
| Type | Description |
|---|---|
int
|
Encoder counts (number of pulses). |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
204 205 206 207 208 209 210 211 212 213 214 215 216 | |
get_backlash
¤
Get the backlash value (to control hysteresis).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the backlash of. |
1
|
Returns:
| Type | Description |
|---|---|
float
|
The backlash value (in millimetres or degrees). |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
223 224 225 226 227 228 229 230 231 232 233 234 | |
get_home_parameters
¤
get_home_parameters(channel: int = 1) -> ThorlabsHomeParameters
Get the parameters that are used to home the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the home parameters of. |
1
|
Returns:
| Type | Description |
|---|---|
ThorlabsHomeParameters
|
The homing parameters. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
get_limit_parameters
¤
get_limit_parameters(channel: int = 1) -> ThorlabsLimitParameters
Get the limit-switch parameters that are used for the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the limit-switch parameters of. |
1
|
Returns:
| Type | Description |
|---|---|
ThorlabsLimitParameters
|
The limit-switch parameters. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
get_move_parameters
¤
get_move_parameters(channel: int = 1) -> ThorlabsMoveParameters
Get the parameters that are used to move the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the move parameters of. |
1
|
Returns:
| Type | Description |
|---|---|
ThorlabsMoveParameters
|
The move parameters. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
hardware_info
¤
hardware_info() -> ThorlabsHardwareInfo
Get the hardware information about the motion controller.
Returns:
| Type | Description |
|---|---|
ThorlabsHardwareInfo
|
The hardware information. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
home
¤
Move the actuator or stage to the home position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to home. |
1
|
wait
|
bool
|
Whether to wait for homing to complete before returning to the calling program. |
True
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
318 319 320 321 322 323 324 325 326 327 | |
identify
¤
identify(channel: int = 1) -> None
Instruct the motion controller to identify itself by flashing its front panel LEDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to identify. |
1
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
329 330 331 332 333 334 335 336 | |
is_enabled
¤
Check if a motor is enabled.
If enabled, power is applied to the motor so it is fixed in position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to check. |
1
|
Returns:
| Type | Description |
|---|---|
bool
|
Whether the motor for the channel is enabled or disabled. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
338 339 340 341 342 343 344 345 346 347 348 349 350 | |
is_homed
¤
Check if the actuator or stage has been homed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to check. |
1
|
Returns:
| Type | Description |
|---|---|
bool
|
Whether the actuator or stage has been homed. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
352 353 354 355 356 357 358 359 360 361 | |
is_moving
¤
Check if the actuator or stage is moving.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to check. |
1
|
Returns:
| Type | Description |
|---|---|
bool
|
Whether the actuator or stage is moving. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
363 364 365 366 367 368 369 370 371 372 | |
move_by
¤
Move the actuator or stage by a relative distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
float
|
The distance to move by. Can be a negative or a positive value. The unit of the
value depends on the whether |
required |
channel
|
int
|
The channel to move. |
1
|
convert
|
bool
|
Whether to convert |
True
|
wait
|
bool
|
Whether to wait for the move to complete before returning to the calling program. |
True
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
move_to
¤
Move the actuator or stage to an absolute position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
float
|
The position to move to. The unit of the value depends on the whether |
required |
channel
|
int
|
The channel to move. |
1
|
convert
|
bool
|
Whether to convert |
True
|
wait
|
bool
|
Whether to wait for the move to complete before returning to the calling program. |
True
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
position
¤
Get the position of the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the position of. |
1
|
Returns:
| Type | Description |
|---|---|
float
|
The position (in millimetres or degrees). |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
408 409 410 411 412 413 414 415 416 417 | |
query
¤
query(
message_id: int,
*,
param1: int = 0,
param2: int = 0,
data: bytes | None = None,
dest: int | None = None,
delay: float = 0
) -> bytes
Query data from the motion controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message_id
|
int
|
The message ID of the request. |
required |
param1
|
int
|
First parameter required for the query. |
0
|
param2
|
int
|
Second parameter required for the query. |
0
|
data
|
bytes | None
|
The optional data to include with the message. If specified, |
None
|
dest
|
int | None
|
Destination module that the query is for, e.g., |
None
|
delay
|
float
|
0
|
Returns:
| Type | Description |
|---|---|
bytes
|
The data of the response. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
read
¤
read() -> ThorlabsResponse
Read a response from the motion controller.
Returns:
| Type | Description |
|---|---|
ThorlabsResponse
|
A response instance. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
463 464 465 466 467 468 469 470 471 | |
set_backlash
¤
Set the backlash value (to control hysteresis) of the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backlash
|
float
|
The backlash value. The unit of the value depends on the whether |
required |
channel
|
int
|
The channel to set the backlash of. |
1
|
convert
|
bool
|
Whether to convert |
True
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
473 474 475 476 477 478 479 480 481 482 483 484 | |
set_callback
¤
Set a callback function to receive position, encoder counts and status information.
The callback function is called while waiting for an actuator or a stage to stop moving.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
Callable[[float, int, int], None] | None
|
A callback function. Set to The callback function receives three arguments:
|
required |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
set_home_parameters
¤
set_home_parameters(parameters: ThorlabsHomeParameters) -> None
Set the parameters that are used to home the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
ThorlabsHomeParameters
|
Homing parameters. It is recommended to call get_home_parameters first and then update the appropriate attributes. |
required |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
set_limit_parameters
¤
set_limit_parameters(parameters: ThorlabsLimitParameters) -> None
Set the limit-switch parameters for the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
ThorlabsLimitParameters
|
Limit-switch parameters. It is recommended to call get_limit_parameters first and then update the appropriate attributes. |
required |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
set_move_parameters
¤
set_move_parameters(parameters: ThorlabsMoveParameters) -> None
Set the parameters that are used to move the actuator or stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
ThorlabsMoveParameters
|
Move parameters. It is recommended to call get_move_parameters first and then update the appropriate attributes. |
required |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
541 542 543 544 545 546 547 548 549 550 551 552 553 | |
start_auto_updates
¤
start_auto_updates() -> None
Start automatic updates from the motion controller.
Update messages contain information about the position and status of the controller. The messages will be sent by the controller approximately every 100 milliseconds until stop_auto_updates is called.
If you want to receive position, encoder counts and status updates from the controller, call set_callback with a function to handle the updates.
Automatic updates are temporarily enabled while waiting for an actuator or a stage to stop moving.
You must periodically call read to handle the automatic updates if you explicitly call this method, otherwise the read buffer may overflow.
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
status
¤
Get the status of the motion controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to get the status of. |
1
|
Returns:
| Type | Description |
|---|---|
int
|
The status. A 32-bit value that represents the current status of the motion controller. Each of the 32 bits acts as a flag (0 or 1), simultaneously indicating 32 distinct operating conditions of the motion controller. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
stop
¤
Stop the actuator or stage from moving.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel of the motion controller to stop. |
1
|
immediate
|
bool
|
Whether to stop immediately ( |
False
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
589 590 591 592 593 594 595 596 597 598 599 | |
stop_auto_updates
¤
stop_auto_updates() -> None
Stop automatic updates from the motion controller.
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
601 602 603 604 | |
wait_until_moved
¤
wait_until_moved(channel: int = 1) -> None
Wait until the motion controller indicates that a move is complete.
This method will block forever if the actuator or stage is not moving.
Warning
Some motion controllers indicate that a move is complete but upon reading the position of the actuator (or stage) the returned value indicates that it is still a few encoder counts away from the target position. It has been observed that it could take up to 600 ms for the indicated position to settle at the target position. However, the change in position due to this settling is typically outside of the accuracy and repeatability specifications of the actuator (or stage).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
The channel to wait for. |
1
|
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
write
¤
write(
message_id: int,
*,
param1: int = 0,
param2: int = 0,
data: bytes | None = None,
dest: int | None = None
) -> int
Write a message to the motion controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message_id
|
int
|
Message ID. |
required |
param1
|
int
|
First parameter required for the message. |
0
|
param2
|
int
|
Second parameter required for the message. |
0
|
data
|
bytes | None
|
The optional data to include with the message. If specified, |
None
|
dest
|
int | None
|
Destination module that the message is for, e.g., |
None
|
Returns:
| Type | Description |
|---|---|
int
|
The number of bytes written. |
Source code in packages/resources/src/msl/equipment_resources/thorlabs/motion.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | |