mxcubecore.HardwareObjects.abstract.AbstractActuator#

Abstract Actuator.

Classes

AbstractActuator(name)

Abstract actuator defines methods common to all moving devices.

class mxcubecore.HardwareObjects.abstract.AbstractActuator.AbstractActuator(name: str)[source]#

Bases: HardwareObject

Abstract actuator defines methods common to all moving devices.

The _set_value method is the only abtract method that needs to be overloaded in each implementation.

_nominal_value#

Current actuator value.

Type:

float | None

default_value#

Value specified by XML property, otherwise None.

Type:

float | None

_nominal_limits#

Values specified by XML property, otherwise None.

Type:

tuple[float | None, float | None]

actuator_name#

Actuator name specified by XML property, otherwise None.

Type:

str | None

read_only#

Read-only flag specified by XML property, otherwise False.

Type:

bool

username#
Type:

str

Emits:
  • valueChanged (tuple[int]) – Tuple whose first and only item is the new value. Emitted during initialization of the hardware object and when setting a new value.

  • limitsChanged (tuple[tuple[int, int]]) – Tuple whose first and only item is a two-item tuple of the new limits (low limit first and high limit second). Emitted by update_limits if limit values are changed.

  • stateChanged (tuple) – Tuple whose first and only item is the new state. Emitted by force_emit_signals

Parameters:

name (str) –

force_emit_signals() None[source]#

Force emission of all signals.

Method is called from GUI. Do not call it from within a hardware object.

Return type:

None

get_limits()[source]#

Return actuator low and high limits.

Returns:

Two-item tuple (low limit, high limit).

Return type:

(tuple)

abstract get_value()[source]#

Read the actuator position.

Returns:

Actuator position.

init()[source]#

Init properties: actuator_name, username, read_only and default_value.

re_emit_values() None[source]#

Update values for all internal attributes.

Return type:

None

set_limits(limits: tuple) None[source]#

Set actuator low and high limits and emit signal limitsChanged.

Parameters:

limits (tuple) – Two-item tuple (low limit, high limit).

Raises:

ValueError – Attempt to set limits for read-only actuator.

Return type:

None

set_value(value, timeout: float = 0) None[source]#

Set actuator to value.

If timeout == 0: return at once and do not wait (default). If timeout is None: wait forever.

Parameters:
  • value – target value

  • timeout (float) – Optional timeout in seconds. Default is 0: do not wait.

Raises:
  • ValueError – Invalid value or attemp to set read only actuator.

  • RuntimeError – Timeout waiting for status ready (from wait_ready):

Return type:

None

update_limits(limits=None) None[source]#

Check if the limits have changed and emit signal limitsChanged.

Parameters:

limits (tuple) – Two-item tuple (low limit, high limit).

Return type:

None

update_value(value=None) None[source]#

Check if the value has changed and emit signal valueChanged.

Parameters:

value – Value.

Return type:

None

validate_value(value) bool[source]#

Check if the value is within limits.

Parameters:

value (numerical) – Value.

Returns:

True if within the limits, False otherwise.

Return type:

bool