class BaseStage(lt.Thing): (source)
Known subclasses: openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThing
Constructor: BaseStage(thing_server_interface)
A base stage class for OpenFlexure translation stages.
This can't be used directly but should reduce boilerplate code when implementing new stages.
Note that the coordinate system used for the microscope may need to have different axis direction as those used by the underlying stage controller.
A minimal working stage must implement _hardware_move_relative and _hardware_move_absolute actions, which update the _hardware_position attribute on completion, and also should implement set_zero_position.
| Method | __init__ |
Initialise the stage. |
| Method | get |
Return a tuple containing (x, y, z) position. |
| Method | invert |
Invert the direction setting of the given axis. |
| Method | jog |
Make a relative move that may be interrupted by a future jog. |
| Method | move |
Make an absolute move. Keyword arguments should be axis names. |
| Method | move |
Make a relative move. Keyword arguments should be axis names. |
| Method | move |
Move to the location specified by an (x, y, z) tuple. |
| Method | set |
Make the current position zero in all axes. |
| Method | update |
Update the position property from the stage. |
| Class Variable | backlash |
The number of steps to elimate backlash. The sign sets the direction. |
| Class Variable | moving |
Whether the stage is in motion. |
| Instance Variable | axis |
Used to convert coordinates between the program frame and the hardware frame. |
| Property | axis |
The names of the stage's axes, in order. |
| Property | position |
Current position of the stage. |
| Property | thing |
Summary metadata describing the current state of the stage. |
| Method | _apply |
Undocumented |
| Method | _estimate |
Calculate the expected duration of a move with the given displacement. |
| Method | _get |
Get the next JogCommand from the jog queue. |
| Method | _hardware |
Make a absolute move in the coordinate system used by the physical hardware. |
| Method | _hardware |
Make a relative move in the coordinate system used by the physical hardware. |
| Method | _hardware |
Start a relative move. |
| Method | _hardware |
Undocumented |
| Method | _hardware |
Read position from the stage and set internal attribute _hardware_position. |
| Method | _jog |
Execute jog commands in a background thread. |
| Method | _move |
Make a movement with backlash correction. |
| Method | _poll |
Determine if the stage is still moving. |
| Method | _send |
Send a jog command to the background jog thread. |
| Class Variable | _axis |
Undocumented |
| Instance Variable | _backlash |
Undocumented |
| Instance Variable | _hardware |
Undocumented |
| Instance Variable | _hardware |
Undocumented |
| Instance Variable | _jog |
Undocumented |
| Instance Variable | _jog |
Undocumented |
| Instance Variable | _jog |
Undocumented |
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingInitialise the stage.
| Raises | |
RedefinedBaseMovementError | if move_relative and/or move_absolute are overridden. It is recommended to override _hardware_move_relative and/or _hardware_move_absolute instead so that all code in the child class uses the hardware reference frame. |
Return a tuple containing (x, y, z) position.
This method provides the interface expected by the camera_stage_mapping.
| Raises | |
KeyError | if this stage does not have axes named "x", "y", and "z". |
Invert the direction setting of the given axis.
| Parameters | |
axis:Literal[ | The axis name (x, y or z) to invert. |
Make a relative move that may be interrupted by a future jog.
This action makes a relative move. If another jog action is called while a jog is already in progress, the first will be stopped and the second will start immediately. This allows for responsive manual control of the stage, for example with a joystick.
| Parameters | |
stop:bool | if this is set to True the jog will be terminated. |
**kwargs:int | Keyword arguments should be axis names. |
bool = False, backlash_compensation: BacklashCompensation | None = None, **kwargs: int):
(source)
¶
Make an absolute move. Keyword arguments should be axis names.
bool = False, backlash_compensation: BacklashCompensation | None = None, **kwargs: int):
(source)
¶
Make a relative move. Keyword arguments should be axis names.
Move to the location specified by an (x, y, z) tuple.
This method provides the interface expected by the camera_stage_mapping.
| Parameters | |
xyztuple[ | The (x, y, z) position to move to. |
| Raises | |
KeyError | if this stage does not have axes named "x", "y", and "z". |
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingMake the current position zero in all axes.
This action does not move the stage, but resets the position to zero. It is intended for use after manually or automatically recentring the stage.
The number of steps to elimate backlash. The sign sets the direction.
A positive number sets the direction of the second move in a backlash correction. For example, consider z=200. If the previous move was more than +200 in z, no correction is needed. If the last movement was negative then a move of -200, followed by +200 will wipe out backlash.
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingWhether the stage is in motion.
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingUsed to convert coordinates between the program frame and the hardware frame.
list[ int] | tuple[ int]) -> list[ int]:Mapping[ str, int]) -> Mapping[ str, int]:Undocumented
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingCalculate the expected duration of a move with the given displacement.
Get the next JogCommand from the jog queue.
| Parameters | |
timeout:float | The estimtated time the move will take for the queue timeout. |
| Returns | |
JogCommand | None | The jog command or None if the stage stops before a command is received. |
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingMake a absolute move in the coordinate system used by the physical hardware.
Make sure to use and update self._hardware_position not self.position.
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingMake a relative move in the coordinate system used by the physical hardware.
Make sure to use and update self._hardware_position not self.position.
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingStart a relative move.
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingRead position from the stage and set internal attribute _hardware_position.
_hardware_position should only be set in this function.
Execute jog commands in a background thread.
This function is intended to be run in a background thread. It will look at self._jog_command when the self._jog_send event is set.
bool, relative: bool, backlash_compensation: BacklashCompensation, **kwargs: int):
(source)
¶
Make a movement with backlash correction.
| Parameters | |
blockbool | True to prevent the move being cancelled. |
relative:bool | True if the kwargs are relative moves. False if they are absolute. |
backlashBacklashCompensation | A BacklashCompensation which sets which axes to apply backalsh compensation to. |
**kwargs:int | A mapping of axis name to integer for the movement. |
openflexure_microscope_server.things.stage.dummy.DummyStage, openflexure_microscope_server.things.stage.sangaboard.SangaboardThingDetermine if the stage is still moving.
Send a jog command to the background jog thread.
This function will start the background thread if it is not running. This function acquires _jog_lock and uses the _jog_send event to signal the thread to read the next command. As commands interrupt each other, this function should never block for a long time.
| Parameters | |
command:JogCommand | the jog command to send. |