class documentation

A Thing to manage a Sangaboard motor controller.

Internally, this uses the pysangaboard package from PyPi. This imports as sangaboard. As pysangaboard does not support some features added to the Sangaboard firmware v1 (LED flashing, aborting moves, etc) this functionality is accessed by directly querying the serial interface.

Method __enter__ Connect to the sangaboard when the Thing context manager is opened.
Method __exit__ Close the sangaboard connection when the Thing context manager is closed.
Method __init__ Initialise SangaboardThing.
Method check_firmware Error/warn if firmware doesn't meet requirements/recommendations.
Method set_led Flash the LED to identify the board.
Method set_zero_position Make the current position zero in all axes.
Instance Variable axis_inverted Used to convert coordinates between the program frame and the hardware frame.
Instance Variable moving Whether the stage is in motion.
Instance Variable sangaboard_kwargs Undocumented
Method _estimate_move_duration Calculate the expected duration of a move with the given displacement.
Method _hardware_move_absolute Make a absolute move in the coordinate system used by the sangaboard.
Method _hardware_move_relative Make a relative move in the coordinate system used by the sangaboard.
Method _hardware_start_move_relative Start a relative move.
Method _hardware_stop Stop any motion of the stage as soon as possible.
Method _hardware_update_position Read position from the stage and set internal attribute _hardware_position.
Method _poll_moving Determine if the stage is still moving.
Instance Variable _hardware_position Undocumented
Instance Variable _sangaboard Undocumented
Instance Variable _step_time Undocumented

Inherited from BaseStage:

Method get_xyz_position Return a tuple containing (x, y, z) position.
Method invert_axis_direction Invert the direction setting of the given axis.
Method jog Make a relative move that may be interrupted by a future jog.
Method move_absolute Make an absolute move. Keyword arguments should be axis names.
Method move_relative Make a relative move. Keyword arguments should be axis names.
Method move_to_xyz_position Move to the location specified by an (x, y, z) tuple.
Method update_position Update the position property from the stage.
Class Variable backlash_steps The number of steps to elimate backlash. The sign sets the direction.
Property axis_names The names of the stage's axes, in order.
Property position Current position of the stage.
Property thing_state Summary metadata describing the current state of the stage.
Method _apply_axis_direction Undocumented
Method _get_from_jog_queue Get the next JogCommand from the jog queue.
Method _jog_loop Execute jog commands in a background thread.
Method _move_with_backlash_correction Make a movement with backlash correction.
Method _send_jog_command Send a jog command to the background jog thread.
Class Variable _axis_names Undocumented
Instance Variable _backlash_state Undocumented
Instance Variable _hardware_lock Undocumented
Instance Variable _jog_lock Undocumented
Instance Variable _jog_queue Undocumented
Instance Variable _jog_thread Undocumented
def __enter__(self) -> Self: (source)

Connect to the sangaboard when the Thing context manager is opened.

def __exit__(self, _exc_type: type[BaseException], _exc_value: BaseException | None, _traceback: TracebackType | None): (source)

Close the sangaboard connection when the Thing context manager is closed.

def __init__(self, thing_server_interface: lt.ThingServerInterface, port: str | None = None, **kwargs: Any): (source)

Initialise SangaboardThing.

Initialise the "Thing", but do not initialise an underlying Sangaboard object from pysangaboard until the Thing context manager is started.

Parameters
thing_server_interface:lt.ThingServerInterfaceUndocumented
port:str | NoneThe serial port for the Sangaboard. Optional, this is used to stop the Sangaboard object querying available devices.
**kwargs:AnyAny other keyword arguments to be passed to the Sangaboard class
def check_firmware(self): (source)

Error/warn if firmware doesn't meet requirements/recommendations.

Raise a Runtime Error if the version is below REQUIRED_VERSION

Log a warning if the version is below RECOMMENDED_VERSION

def set_led(self, led_on: bool = True, led_channel: Literal['cc'] = 'cc'): (source)

Flash the LED to identify the board.

This is intended to be useful in situations where there are multiple Sangaboards in use, and it is necessary to identify which one is being addressed.

@lt.action
def set_zero_position(self): (source)

Make 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.

axis_inverted: dict[str, bool] = (source)

Used to convert coordinates between the program frame and the hardware frame.

moving: bool = (source)

Whether the stage is in motion.

sangaboard_kwargs = (source)

Undocumented

def _estimate_move_duration(self, displacement: Sequence[int]) -> float: (source)

Calculate the expected duration of a move with the given displacement.

def _hardware_move_absolute(self, block_cancellation: bool = False, **kwargs: int): (source)

Make a absolute move in the coordinate system used by the sangaboard.

def _hardware_move_relative(self, block_cancellation: bool = False, **kwargs: int): (source)

Make a relative move in the coordinate system used by the sangaboard.

def _hardware_start_move_relative(self, displacement: Sequence[int]): (source)

Start a relative move.

This starts the stage moving, but does not wait for the move to complete. It sets self.moving to True: resetting it is the responsibility of the calling code.

def _hardware_stop(self): (source)

Stop any motion of the stage as soon as possible.

def _hardware_update_position(self): (source)

Read position from the stage and set internal attribute _hardware_position.

_hardware_position should only be set in this function.

def _poll_moving(self) -> bool: (source)

Determine if the stage is still moving.

This also sets moving if the status has changed.

Returns
boolwhether the stage is still moving.
_sangaboard = (source)

Undocumented

_step_time = (source)

Undocumented