effusive.motor_controller¶
motor_controller ¶
Python-side motor controller for manual stack jogging.
Classes:
-
MotorController–Manual motor controller used by the napari widget.
Functions:
-
create_motor_controller–Create the requested Python motor controller.
MotorController ¶
Manual motor controller used by the napari widget.
Parameters:
-
(kind¶str) –Backend kind identifier. Supported values are
"dummy"and"real". -
(port_name¶str | None, default:None) –Serial port backing the real controller. Dummy controllers leave this as
None. -
(min_position_mm¶float, default:float('-inf')) –Minimum allowed motor position in millimeters.
-
(max_position_mm¶float, default:float('inf')) –Maximum allowed motor position in millimeters.
Methods:
-
close–Release the underlying transport if present.
-
home–Home the motor and return the post-home position.
-
jog_relative–Move by a relative offset and return the new position.
-
move_to–Move to an absolute target position in millimeters.
home ¶
home() -> float
Home the motor and return the post-home position.
Returns:
-
float–Absolute motor position in millimeters after homing.
Raises:
-
RuntimeError–If homing fails or reports an invalid response.
jog_relative ¶
move_to ¶
move_to(target_position_mm: float) -> None
create_motor_controller ¶
create_motor_controller(*, use_dummy_motor: bool, motor_port: str | None = None, min_position_mm: float | None = None, max_position_mm: float | None = None) -> MotorController
Create the requested Python motor controller.
Parameters:
-
(use_dummy_motor¶bool) –Whether to create the dummy backend instead of the real hardware backend.
-
(motor_port¶str | None, default:None) –Configured serial port for the real backend. If omitted, the function auto-selects the port when exactly one serial device is available.
-
(min_position_mm¶float | None, default:None) –Minimum allowed motor position in millimeters. If omitted, the value is read from the environment.
-
(max_position_mm¶float | None, default:None) –Maximum allowed motor position in millimeters. If omitted, the value is read from the environment.
Returns:
-
MotorController–Newly created controller instance.
Raises:
-
RuntimeError–If the real backend is requested but the serial dependency or port configuration is unavailable.