Generic controller

class mundo.api.controller.BaseController(
resource_manager: pyvisa.highlevel.ResourceManager,
path: str
)

Abstract base class for a general controller.

All controllers should inherit this class and implement all of the abstract methods. The purpose of this is to hide controller-specific implementation details from the automation process.

__init__(
resource_manager: pyvisa.highlevel.ResourceManager,
path: str
) None

Sets the required configuration parameters needed for communication with the controller. The instrument should be initialized to a state in which it is ready to move.

Parameters
  • resource_manager – Reference to a pyvisa resource manager

  • path – Serial path for the instrument

property name: Optional[str]

The name of the controller. This value is not persistent and will be reset upon application termination. For example, this might be used to keep track of what axis a controller is assigned to.

abstract property identifier: str

The unique identifier of the controller. This value should be read from the controller (if possible).

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract property position: float

Retrieves the current position of the instrument.

Returns

The current position of the instrument

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract property travel_range: float

The maximum physical distance that the motor can travel from the starting (0) point, specified in nanometers. This defines the upper limit of commands such as move_absolute().

Returns

The maximum travel range of the motor, specified in nanometers

abstract property tolerance: float

The tolerance when it comes to movement accuracy. This defines how much the position encoder and physical position are allowed to differ.

It is important that the tolerance is set correctly in order for the application to properly compare positions. For example, if we want to check if the current position is at 0, directly comparing it to something like 0.00001 would return False. However, if 0.00001 is smaller or equal to the tolerance, they can be considered the same (which they should be because of internal inaccuracies).

In other words, this is used to account for encoding and accuracy errors, which will be present in all motors.

Returns

The maximum amount that the position encoder and physical position are allowed to differ, while still being regarded as the same, specified in nanometers

abstract configure(
configuration: mundo.api.config.system.SystemConfig
) None

Configures the controller based on the parameters saved in the user profile. This ensures that all used controllers has the same parameters and unit size.

If the instrument must change state in order to change configuration parameters, the instrument should return to the ready state that allows the instrument to receive movement commands.

Parameters

profile – The user profile containing configuration parameters

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract move_relative(
distance: float
) None

Moves the instrument by distance, specified in nanometers. distance may be negative and indicates that the instrument should move towards the home (0) position.

Parameters

distance – The distance to move relative to the current position, specified in nanometers

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract move_absolute(
position: float
) None

Moves the instrument to the absolute position at position. position can not be negative.

Parameters

units – The absolute position to move to, specified in nanometers

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract stop() None

Stops any movement of the instrument. If no movement is in progress, this is a noop.

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract pause() None

Immediately pauses movement of the instrument. Movement may be resumed and thus the current position should be preserved.

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract resume() None

Resumes movement of an instrument that was previously paused using pause(). Calling this method without first pausing is a noop.

Raises

CommandExecutionError – Raised if the command execution resulted in an error

abstract reset() None

Resets the position of the instrument to the home (0) position.

Raises

CommandExecutionError – Raised if the command execution resulted in an error