Stage Control - derangedhk417/MicroscopeControl GitHub Wiki
Introduction
Control of the XY stage is handled by the StageControl.py file. The documentation used to write this code is in documentation/stage_Operations_and_Programming_Manual.pdf
. Documentation of the serial interface starts at page 25.
General Functionality
The StageController
class uses the serial interface provided by the controller box attached to the stage. It provides functionality for moving the stage, settings its maximum velocity, setting its acceleration and reading its current position. The class also has functions for setting the sensitivity of the joystick connected to the controller. The setLimits
function will set the range of motion of the stage in millimeters. At the time of this writing, the code was written to automatically set the limits so that the stage cannot run into the supports that hold up the microscope optics.
The setLimits
function automatically saves limit values to the controller. It will enforce those limits internally, even when power cycled and disconnected from the computer.
Operations that take more than 100 ms (such as moving the stage), have an optional callback parameter. When this parameter is specified, these operations will return immediately and will call the specified callback function when the operation completes.
Notes
- The listed "shortcuts" for certain commands that can be sent over a serial connection will randomly cause an "Unrecognized Command response". Sometimes they work and sometimes they don't. Avoid using them.
- The controller appears to queue commands sent to it. This means that you can send a movement command while another command is still in process and it appears to execute it when the first command ends.
- The class is implemented so that it will not return until movement operations are complete.
- Bit flags are listed in Little-Endian format in the documentation for the stage. For example, bit 0 of a flag register can be read with
flags & 0b00000001
. This is in contrast with the focus/zoom controller, which lists the bit order in Big-Endian format.