From 58d048b38ed8fe03530baf132b1254b7f28d1158 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 17:29:51 -0600 Subject: [PATCH 01/31] Import InertialMotor --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 9cdd755..4bbfcdc 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -19,6 +19,7 @@ clr.AddReference("Thorlabs.MotionControl.FilterFlipperCLI") clr.AddReference("Thorlabs.MotionControl.Benchtop.BrushlessMotorCLI") clr.AddReference("Thorlabs.MotionControl.KCube.PiezoCLI") +clr.AddReference("Thorlabs.MotionContro.TCube.InertialMotorCLI") import Thorlabs.MotionControl.FilterFlipperCLI as FilterFlipper import Thorlabs.MotionControl.IntegratedStepperMotorsCLI as Integrated @@ -26,6 +27,7 @@ import Thorlabs.MotionControl.GenericMotorCLI as Generic import Thorlabs.MotionControl.Benchtop.BrushlessMotorCLI as BrushlessMotorCLI import Thorlabs.MotionControl.KCube.PiezoCLI as KCubePiezo +import Thorlabs.MotionControl.TCube.InertialMotorCLI as InertialMotorCLI Device.DeviceManagerCLI.BuildDeviceList() serialnumbers_integrated_stepper = [str(ser) for ser in @@ -323,6 +325,9 @@ def get_position(self) -> float: def stop(self): pass +class KIM101(Kinesis): + def + if __name__ == '__main__': controller = BrushlessDCMotor() controller.connect(serialnumbers_brushless[0]) From 14386610349a073aca5aed13ef3c29d4448aadec Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 17:30:01 -0600 Subject: [PATCH 02/31] Create KIM101 --- .../daq_move_plugins/daq_move_KIM101.py | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py new file mode 100644 index 0000000..6c75517 --- /dev/null +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -0,0 +1,126 @@ +from pymodaq.control_modules.move_utility_classes import ( + DAQ_Move_base, comon_parameters_fun, main, DataActuatorType, DataActuator) +from pymodaq.utils.daq_utils import ThreadCommand +from pymodaq.utils.parameter import Parameter +from pymodaq_plugins_thorlabs.hardware.kinesis import serialnumbers_piezo, Piezo +from pymodaq.utils.logger import set_logger, get_module_name + +class DAQ_Move_KIM101(DAQ_Move_base): + """ Instrument plugin class for an actuator. + + This object inherits all functionalities to communicate with PyMoDAQ’s DAQ_Move module through inheritance via + DAQ_Move_base. It makes a bridge between the DAQ_Move module and the Python wrapper of a particular instrument. + + Attributes: + ----------- + controller: object + The particular object that allow the communication with the hardware, in general a python wrapper around the + hardware library. + + """ + _controller_units = Piezo.default_units + is_multiaxes = True + _axes_names = {'1': 1} + _epsilon = 0.01 + data_actuator_type = DataActuatorType.DataActuator + params = [ + {'title': 'Serial Number:', 'name': 'serial_number', 'type': 'list', + 'limits': serialnumbers_piezo, 'value': serialnumbers_piezo[0]} + + ] + comon_parameters_fun(is_multiaxes, axes_names=_axes_names, epsilon=_epsilon) + + def ini_attributes(self): + self.controller: Piezo = None + + def get_actuator_value(self): + """Get the current value from the hardware with scaling conversion. + + Returns + ------- + DataActuator: The position obtained after scaling conversion. + """ + pos = DataActuator( + data=self.controller.get_position(), + units=self.controller.get_units() + ) + pos = self.get_position_with_scaling(pos) + return pos + + def close(self): + """Terminate the communication protocol""" + if self.is_master: + self.controller.close() + + def commit_settings(self, param: Parameter): + """Apply the consequences of a change of value in the detector settings + + Parameters + ---------- + param: Parameter + A given parameter (within detector_settings) whose value has been changed by the user + """ + if param.name() == 'axis': + self.axis_unit = self.controller.get_units(self.axis_value) + + def ini_stage(self, controller=None): + """Actuator communication initialization + + Parameters + ---------- + controller: (object) + custom object of a PyMoDAQ plugin (Slave case). None if only one actuator by controller (Master case) + + Returns + ------- + info: str + initialized: bool + False if initialization failed otherwise True + """ + + if self.is_master: + self.controller = Piezo() + self.controller.connect(self.settings['serial_number']) + else: + self.controller = controller + + self.axis_unit = self._controller_units + + info = f'{self.controller.name} - {self.controller.serial_number}' + initialized = True + return info, initialized + + def move_abs(self, value: DataActuator): + """ Move the actuator to the absolute target defined by value + + Parameters + ---------- + value: (DataActuator) value of the absolute target positioning + """ + value = self.check_bound(value) + self.target_value = value + value = self.set_position_with_scaling(value) + self.controller.move_abs(value.value()) + + def move_rel(self, value: DataActuator): + """ Move the actuator to the relative target actuator value defined by value + + Parameters + ---------- + value: (DataActuator) value of the relative target positioning + """ + value = self.check_bound(self.current_value + value) - self.current_value + self.target_value = value + self.current_value + value = self.set_position_relative_with_scaling(value) + self.controller.move_abs(self.target_value.value()) + + def move_home(self): + """Call the reference method of the controller""" + self.controller.home() + + def stop_motion(self): + """Stop the actuator and emits move_done signal""" + self.controller.stop() + + +if __name__ == '__main__': + main(__file__, init=False) From c7ad61221d307650653ac553792bb419b072c988 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 17:55:45 -0600 Subject: [PATCH 03/31] Finish Kinesis --- .../hardware/kinesis.py | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 4bbfcdc..a2a96b9 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -19,7 +19,7 @@ clr.AddReference("Thorlabs.MotionControl.FilterFlipperCLI") clr.AddReference("Thorlabs.MotionControl.Benchtop.BrushlessMotorCLI") clr.AddReference("Thorlabs.MotionControl.KCube.PiezoCLI") -clr.AddReference("Thorlabs.MotionContro.TCube.InertialMotorCLI") +clr.AddReference("Thorlabs.MotionContro.KCube.InertialMotorCLI") import Thorlabs.MotionControl.FilterFlipperCLI as FilterFlipper import Thorlabs.MotionControl.IntegratedStepperMotorsCLI as Integrated @@ -27,7 +27,7 @@ import Thorlabs.MotionControl.GenericMotorCLI as Generic import Thorlabs.MotionControl.Benchtop.BrushlessMotorCLI as BrushlessMotorCLI import Thorlabs.MotionControl.KCube.PiezoCLI as KCubePiezo -import Thorlabs.MotionControl.TCube.InertialMotorCLI as InertialMotorCLI +import Thorlabs.MotionControl.KCube.InertialMotorCLI as InertialMotorCLI Device.DeviceManagerCLI.BuildDeviceList() serialnumbers_integrated_stepper = [str(ser) for ser in @@ -37,6 +37,7 @@ serialnumbers_brushless = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(BrushlessMotorCLI.BenchtopBrushlessMotor.DevicePrefix)] serialnumbers_piezo = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(KCubePiezo.KCubePiezo.DevicePrefix)] +serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotorCLI.InertialMotor.DevicePrefix)] class Kinesis: @@ -326,7 +327,30 @@ def stop(self): pass class KIM101(Kinesis): - def + default_units = 'mm' + + def __init__(self): + self._device: InertialMotorCLI.InertialMotor = None + + def connect(self, serial: int): + if serial in serialnumbers_inertial_motor: + self._device = InertialMotorCLI.InertialMotor.CreateKcubeInertialMotor(serial) + self._device.Connect(serial) + self._device.WaitForSettingsInitialized(5000) + self._device.StartPolling(250) + self._device.EnableDevice() + def move_abs(self, position: float, channel: int): + self._device.MoveTo(channel, Decimal(position), 6000) + + def get_position(self, channel: int): + return Decimal.ToDouble(self._device.GetPosition(channel)) + + def home(self, channel: int): + self._device.SetPositionAs(channel, Decimal(0)) + + def stop(self): + pass + if __name__ == '__main__': controller = BrushlessDCMotor() From 7c847177ebf37d00acf18ac636bc5eea690b95f7 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 17:56:59 -0600 Subject: [PATCH 04/31] Update import --- .../daq_move_plugins/daq_move_KIM101.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 6c75517..86ae1bb 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -2,7 +2,7 @@ DAQ_Move_base, comon_parameters_fun, main, DataActuatorType, DataActuator) from pymodaq.utils.daq_utils import ThreadCommand from pymodaq.utils.parameter import Parameter -from pymodaq_plugins_thorlabs.hardware.kinesis import serialnumbers_piezo, Piezo +from pymodaq_plugins_thorlabs.hardware.kinesis import serialnumbers_inertial_motor, KIM101 from pymodaq.utils.logger import set_logger, get_module_name class DAQ_Move_KIM101(DAQ_Move_base): @@ -18,19 +18,19 @@ class DAQ_Move_KIM101(DAQ_Move_base): hardware library. """ - _controller_units = Piezo.default_units + _controller_units = KIM101.default_units is_multiaxes = True _axes_names = {'1': 1} _epsilon = 0.01 data_actuator_type = DataActuatorType.DataActuator params = [ {'title': 'Serial Number:', 'name': 'serial_number', 'type': 'list', - 'limits': serialnumbers_piezo, 'value': serialnumbers_piezo[0]} + 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]} ] + comon_parameters_fun(is_multiaxes, axes_names=_axes_names, epsilon=_epsilon) def ini_attributes(self): - self.controller: Piezo = None + self.controller: KIM101 = None def get_actuator_value(self): """Get the current value from the hardware with scaling conversion. From de2cdabd1fc5b84c141dfa204f6e22c9ba5a9f5a Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 17:57:28 -0600 Subject: [PATCH 05/31] Add close method --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index a2a96b9..102647e 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -351,6 +351,10 @@ def home(self, channel: int): def stop(self): pass + def close(self): + self._device.StopPolling() + self._device.Disconnect() + if __name__ == '__main__': controller = BrushlessDCMotor() From 2c4df5b72cbf0312d931167fb7aaf60baa419339 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 18:00:14 -0600 Subject: [PATCH 06/31] Update daq_move --- .../daq_move_plugins/daq_move_KIM101.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 86ae1bb..207ea0e 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -25,7 +25,8 @@ class DAQ_Move_KIM101(DAQ_Move_base): data_actuator_type = DataActuatorType.DataActuator params = [ {'title': 'Serial Number:', 'name': 'serial_number', 'type': 'list', - 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]} + 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]}, + {'title': 'Channel:', 'name': 'channel', 'type': 'int', 'value': 1, 'default': 1} ] + comon_parameters_fun(is_multiaxes, axes_names=_axes_names, epsilon=_epsilon) @@ -59,8 +60,8 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - if param.name() == 'axis': - self.axis_unit = self.controller.get_units(self.axis_value) + if param.name() == 'channel': + self.axis_unit = self.controller.get_channel(self.axis_value) def ini_stage(self, controller=None): """Actuator communication initialization @@ -78,7 +79,7 @@ def ini_stage(self, controller=None): """ if self.is_master: - self.controller = Piezo() + self.controller = KIM101() self.controller.connect(self.settings['serial_number']) else: self.controller = controller From 6dfbadd3b9c6654b04278ed7f738ed36a1aece52 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 18:00:25 -0600 Subject: [PATCH 07/31] Add channel --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 102647e..aea425d 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -331,6 +331,7 @@ class KIM101(Kinesis): def __init__(self): self._device: InertialMotorCLI.InertialMotor = None + self._channel = 1 def connect(self, serial: int): if serial in serialnumbers_inertial_motor: From f52827ea3182e5ae6635014b403b8ae37b081cec Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 18:02:04 -0600 Subject: [PATCH 08/31] Fix self._channel --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index aea425d..51a5dc9 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -331,7 +331,7 @@ class KIM101(Kinesis): def __init__(self): self._device: InertialMotorCLI.InertialMotor = None - self._channel = 1 + self._channel = [0,0] def connect(self, serial: int): if serial in serialnumbers_inertial_motor: @@ -340,18 +340,24 @@ def connect(self, serial: int): self._device.WaitForSettingsInitialized(5000) self._device.StartPolling(250) self._device.EnableDevice() + def move_abs(self, position: float, channel: int): self._device.MoveTo(channel, Decimal(position), 6000) + self._channel[channel - 1] = channel def get_position(self, channel: int): return Decimal.ToDouble(self._device.GetPosition(channel)) def home(self, channel: int): self._device.SetPositionAs(channel, Decimal(0)) + self._channel[channel - 1] = channel def stop(self): pass + def get_channel(self): + return self._channel + def close(self): self._device.StopPolling() self._device.Disconnect() From 68a02ef504eaee9c96be2ba0f0aabf5c64b97c2d Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 18:03:22 -0600 Subject: [PATCH 09/31] Update channel daq_move --- .../daq_move_plugins/daq_move_KIM101.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 207ea0e..6605568 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -61,7 +61,7 @@ def commit_settings(self, param: Parameter): A given parameter (within detector_settings) whose value has been changed by the user """ if param.name() == 'channel': - self.axis_unit = self.controller.get_channel(self.axis_value) + self.axis_unit = self.controller.get_channel(self.axis_values['channel']) def ini_stage(self, controller=None): """Actuator communication initialization From b3cabc0d02be968a8b6ea0361fea54b8540554cc Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:02:33 +0900 Subject: [PATCH 10/31] Correct typo. --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 51a5dc9..e779abe 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -19,7 +19,7 @@ clr.AddReference("Thorlabs.MotionControl.FilterFlipperCLI") clr.AddReference("Thorlabs.MotionControl.Benchtop.BrushlessMotorCLI") clr.AddReference("Thorlabs.MotionControl.KCube.PiezoCLI") -clr.AddReference("Thorlabs.MotionContro.KCube.InertialMotorCLI") +clr.AddReference("Thorlabs.MotionControl.KCube.InertialMotorCLI") import Thorlabs.MotionControl.FilterFlipperCLI as FilterFlipper import Thorlabs.MotionControl.IntegratedStepperMotorsCLI as Integrated From 054a8ea590e2a12e99ee132fec0dcb0dda4ea82a Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:11:41 +0900 Subject: [PATCH 11/31] Add suggestion in move_rel, channel, and others. --- .../daq_move_plugins/daq_move_KIM101.py | 12 ++++++------ src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 6605568..11d3bb9 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -20,13 +20,13 @@ class DAQ_Move_KIM101(DAQ_Move_base): """ _controller_units = KIM101.default_units is_multiaxes = True - _axes_names = {'1': 1} + _axes_names = {'1': 1} # DK - Add more. KIM101 has 4 channels _epsilon = 0.01 data_actuator_type = DataActuatorType.DataActuator params = [ {'title': 'Serial Number:', 'name': 'serial_number', 'type': 'list', 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]}, - {'title': 'Channel:', 'name': 'channel', 'type': 'int', 'value': 1, 'default': 1} + {'title': 'Channel:', 'name': 'channel', 'type': 'int', 'value': 1, 'default': 1} # DK - delete this line. channel will be handled in multiaxes feature. ] + comon_parameters_fun(is_multiaxes, axes_names=_axes_names, epsilon=_epsilon) @@ -60,7 +60,7 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - if param.name() == 'channel': + if param.name() == 'channel': # DK - delete this statement accordingly. self.axis_unit = self.controller.get_channel(self.axis_values['channel']) def ini_stage(self, controller=None): @@ -86,7 +86,7 @@ def ini_stage(self, controller=None): self.axis_unit = self._controller_units - info = f'{self.controller.name} - {self.controller.serial_number}' + info = f'{self.controller.name} - {self.controller.serial_number}' # DK - self.controller.serial_number should be corrected because self.controller does not have a property of `serial_number` initialized = True return info, initialized @@ -111,8 +111,8 @@ def move_rel(self, value: DataActuator): """ value = self.check_bound(self.current_value + value) - self.current_value self.target_value = value + self.current_value - value = self.set_position_relative_with_scaling(value) - self.controller.move_abs(self.target_value.value()) + value = self.set_position_relative_with_scaling(value) # DK - If you reuse move_abs, use set_position_with_scaling. + self.controller.move_abs(self.target_value.value()) # DK - use an attribute of the scaled `value` def move_home(self): """Call the reference method of the controller""" diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index e779abe..d7c9940 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -327,7 +327,7 @@ def stop(self): pass class KIM101(Kinesis): - default_units = 'mm' + default_units = 'mm' # KIM101 uses only V. def __init__(self): self._device: InertialMotorCLI.InertialMotor = None From a8de663292824bb7739429fd80da26f22c79e1d5 Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:12:31 +0900 Subject: [PATCH 12/31] default_units --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index d7c9940..1686a57 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -327,7 +327,7 @@ def stop(self): pass class KIM101(Kinesis): - default_units = 'mm' # KIM101 uses only V. + default_units = 'mm' # DK - KIM101 uses only V. def __init__(self): self._device: InertialMotorCLI.InertialMotor = None From 020a1940f4276d4b567703b51377736a9044a14c Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 20:16:53 -0600 Subject: [PATCH 13/31] Fix params, fix serialnumbers --- .../daq_move_plugins/daq_move_KIM101.py | 9 ++++----- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 11d3bb9..a3844b3 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -20,13 +20,12 @@ class DAQ_Move_KIM101(DAQ_Move_base): """ _controller_units = KIM101.default_units is_multiaxes = True - _axes_names = {'1': 1} # DK - Add more. KIM101 has 4 channels + _axes_names = {'1': 1, '2': 2, '3': 3, '4': 4} _epsilon = 0.01 data_actuator_type = DataActuatorType.DataActuator params = [ {'title': 'Serial Number:', 'name': 'serial_number', 'type': 'list', 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]}, - {'title': 'Channel:', 'name': 'channel', 'type': 'int', 'value': 1, 'default': 1} # DK - delete this line. channel will be handled in multiaxes feature. ] + comon_parameters_fun(is_multiaxes, axes_names=_axes_names, epsilon=_epsilon) @@ -60,8 +59,8 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - if param.name() == 'channel': # DK - delete this statement accordingly. - self.axis_unit = self.controller.get_channel(self.axis_values['channel']) + if param.name() == 'axis' + self.axis = param.value() def ini_stage(self, controller=None): """Actuator communication initialization @@ -86,7 +85,7 @@ def ini_stage(self, controller=None): self.axis_unit = self._controller_units - info = f'{self.controller.name} - {self.controller.serial_number}' # DK - self.controller.serial_number should be corrected because self.controller does not have a property of `serial_number` + info = "KIM101 Initialized" initialized = True return info, initialized diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 1686a57..7a0892a 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -27,7 +27,7 @@ import Thorlabs.MotionControl.GenericMotorCLI as Generic import Thorlabs.MotionControl.Benchtop.BrushlessMotorCLI as BrushlessMotorCLI import Thorlabs.MotionControl.KCube.PiezoCLI as KCubePiezo -import Thorlabs.MotionControl.KCube.InertialMotorCLI as InertialMotorCLI +import Thorlabs.MotionControl.KCube.InertialMotorCLI as InertialMotor Device.DeviceManagerCLI.BuildDeviceList() serialnumbers_integrated_stepper = [str(ser) for ser in @@ -37,7 +37,7 @@ serialnumbers_brushless = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(BrushlessMotorCLI.BenchtopBrushlessMotor.DevicePrefix)] serialnumbers_piezo = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(KCubePiezo.KCubePiezo.DevicePrefix)] -serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotorCLI.InertialMotor.DevicePrefix)] +serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotor.KCube.DevicePrefix)] #or InertialMotor.KCube.InertialMotor.DevicePrefix class Kinesis: @@ -327,7 +327,7 @@ def stop(self): pass class KIM101(Kinesis): - default_units = 'mm' # DK - KIM101 uses only V. + default_units = 'V' def __init__(self): self._device: InertialMotorCLI.InertialMotor = None From 112411928ae9317bb597f78ed6a6fbe64f016997 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 20:19:23 -0600 Subject: [PATCH 14/31] pass move_rel --- .../daq_move_plugins/daq_move_KIM101.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index a3844b3..3a1db2b 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -99,7 +99,7 @@ def move_abs(self, value: DataActuator): value = self.check_bound(value) self.target_value = value value = self.set_position_with_scaling(value) - self.controller.move_abs(value.value()) + self.controller.move_abs(value.value(), axis=self.axis) def move_rel(self, value: DataActuator): """ Move the actuator to the relative target actuator value defined by value @@ -108,10 +108,7 @@ def move_rel(self, value: DataActuator): ---------- value: (DataActuator) value of the relative target positioning """ - value = self.check_bound(self.current_value + value) - self.current_value - self.target_value = value + self.current_value - value = self.set_position_relative_with_scaling(value) # DK - If you reuse move_abs, use set_position_with_scaling. - self.controller.move_abs(self.target_value.value()) # DK - use an attribute of the scaled `value` + pass def move_home(self): """Call the reference method of the controller""" From 3e76ecb6a9f853bdfbd7f7d7b3112e7033d8220e Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Wed, 11 Dec 2024 20:19:55 -0600 Subject: [PATCH 15/31] Update axis --- .../daq_move_plugins/daq_move_KIM101.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 3a1db2b..d95f6b9 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -59,7 +59,7 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - if param.name() == 'axis' + if param.name() == 'axis': self.axis = param.value() def ini_stage(self, controller=None): @@ -112,7 +112,7 @@ def move_rel(self, value: DataActuator): def move_home(self): """Call the reference method of the controller""" - self.controller.home() + self.controller.home(self.axis) def stop_motion(self): """Stop the actuator and emits move_done signal""" From d0c0336f5a05ea87235e8e20c474739e07f862e0 Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:44:23 +0900 Subject: [PATCH 16/31] test and debug --- .../hardware/kinesis.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 7a0892a..ef527d6 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -37,7 +37,8 @@ serialnumbers_brushless = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(BrushlessMotorCLI.BenchtopBrushlessMotor.DevicePrefix)] serialnumbers_piezo = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(KCubePiezo.KCubePiezo.DevicePrefix)] -serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotor.KCube.DevicePrefix)] #or InertialMotor.KCube.InertialMotor.DevicePrefix +# TODO fix serialnumbers_inertial_motor +serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotor.KCubeInertialMotor.DevicePrefix_KIM101)] #or InertialMotor.KCube.InertialMotor.DevicePrefix class Kinesis: @@ -330,19 +331,25 @@ class KIM101(Kinesis): default_units = 'V' def __init__(self): - self._device: InertialMotorCLI.InertialMotor = None - self._channel = [0,0] + self._device: InertialMotor.KCubeInertialMotor = None + self._channel = [] def connect(self, serial: int): if serial in serialnumbers_inertial_motor: - self._device = InertialMotorCLI.InertialMotor.CreateKcubeInertialMotor(serial) - self._device.Connect(serial) + self._device = InertialMotor.KCubeInertialMotor.CreateKCubeInertialMotor(serial) + self._device.Connect(serial) self._device.WaitForSettingsInitialized(5000) self._device.StartPolling(250) - self._device.EnableDevice() - - def move_abs(self, position: float, channel: int): - self._device.MoveTo(channel, Decimal(position), 6000) + self._device.EnableDevice() + self._channel = [ + InertialMotor.InertialMotorStatus.MotorChannels.Channel1, + InertialMotor.InertialMotorStatus.MotorChannels.Channel2, + InertialMotor.InertialMotorStatus.MotorChannels.Channel3, + InertialMotor.InertialMotorStatus.MotorChannels.Channel4 + ] + + def move_abs(self, position: float, channel: int): # DK - position should be int + self._device.MoveTo(channel, Decimal(position), 6000) # DK - Decimal(position) should be position self._channel[channel - 1] = channel def get_position(self, channel: int): From b09c8094fcbda2d90527f0fb84d4899e8e993b41 Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:04:19 +0900 Subject: [PATCH 17/31] Correct unit. Add suggestion --- .../daq_move_plugins/daq_move_KIM101.py | 2 +- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index d95f6b9..e8fbf94 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -59,7 +59,7 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - if param.name() == 'axis': + if param.name() == 'axis':# DK - delete this. daq_move covers this. self.axis = param.value() def ini_stage(self, controller=None): diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index ef527d6..05839b9 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -328,7 +328,7 @@ def stop(self): pass class KIM101(Kinesis): - default_units = 'V' + default_units = ' ' def __init__(self): self._device: InertialMotor.KCubeInertialMotor = None From f2150fd0b8a3ab86f02e3d905da1343a632f190f Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Thu, 12 Dec 2024 22:12:52 -0600 Subject: [PATCH 18/31] add self.axis --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 05839b9..96eaa67 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -362,8 +362,8 @@ def home(self, channel: int): def stop(self): pass - def get_channel(self): - return self._channel + def get_channel(self, channel: int): + return self._channel[channel - 1] def close(self): self._device.StopPolling() From ebc88adb46d1029e007dc0bb25f6bd98277b4ea5 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Thu, 12 Dec 2024 22:13:10 -0600 Subject: [PATCH 19/31] Update channel --- .../daq_move_plugins/daq_move_KIM101.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index e8fbf94..5566fa9 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -40,7 +40,7 @@ def get_actuator_value(self): DataActuator: The position obtained after scaling conversion. """ pos = DataActuator( - data=self.controller.get_position(), + data=self.controller.get_position(channel=self.axis), units=self.controller.get_units() ) pos = self.get_position_with_scaling(pos) From 35232e7f7c2b692634711da29ac2e713e9936811 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Thu, 12 Dec 2024 22:16:26 -0600 Subject: [PATCH 20/31] Add int() for channel --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 96eaa67..e6fba8b 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -342,10 +342,10 @@ def connect(self, serial: int): self._device.StartPolling(250) self._device.EnableDevice() self._channel = [ - InertialMotor.InertialMotorStatus.MotorChannels.Channel1, - InertialMotor.InertialMotorStatus.MotorChannels.Channel2, - InertialMotor.InertialMotorStatus.MotorChannels.Channel3, - InertialMotor.InertialMotorStatus.MotorChannels.Channel4 + int(InertialMotor.InertialMotorStatus.MotorChannels.Channel1), + int(InertialMotor.InertialMotorStatus.MotorChannels.Channel2), + int(InertialMotor.InertialMotorStatus.MotorChannels.Channel3), + int(InertialMotor.InertialMotorStatus.MotorChannels.Channel4) ] def move_abs(self, position: float, channel: int): # DK - position should be int From b299c54363845b10baf36bdd88327d03ff28e1c9 Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:15:20 +0900 Subject: [PATCH 21/31] Update move_abs, home. Test and debug. --- .../hardware/kinesis.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index e6fba8b..7a5d45b 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -342,28 +342,26 @@ def connect(self, serial: int): self._device.StartPolling(250) self._device.EnableDevice() self._channel = [ - int(InertialMotor.InertialMotorStatus.MotorChannels.Channel1), - int(InertialMotor.InertialMotorStatus.MotorChannels.Channel2), - int(InertialMotor.InertialMotorStatus.MotorChannels.Channel3), - int(InertialMotor.InertialMotorStatus.MotorChannels.Channel4) + InertialMotor.InertialMotorStatus.MotorChannels.Channel1, + InertialMotor.InertialMotorStatus.MotorChannels.Channel2, + InertialMotor.InertialMotorStatus.MotorChannels.Channel3, + InertialMotor.InertialMotorStatus.MotorChannels.Channel4 ] def move_abs(self, position: float, channel: int): # DK - position should be int - self._device.MoveTo(channel, Decimal(position), 6000) # DK - Decimal(position) should be position - self._channel[channel - 1] = channel + self._device.MoveTo(self._channel[channel-1], position, 6000) def get_position(self, channel: int): - return Decimal.ToDouble(self._device.GetPosition(channel)) + return self._device.GetPosition(self._channel[channel-1]) def home(self, channel: int): - self._device.SetPositionAs(channel, Decimal(0)) - self._channel[channel - 1] = channel + self._device.MoveTo(self._channel[channel-1], 0, 6000) def stop(self): pass - def get_channel(self, channel: int): - return self._channel[channel - 1] + # def get_channel(self, channel: int): + # return self._channel[channel - 1] def close(self): self._device.StopPolling() From 858926a39d7d2d77ba219e7606f560023d7d81cc Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Fri, 13 Dec 2024 00:03:24 -0600 Subject: [PATCH 22/31] Remove decimal --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index e6fba8b..b84d90c 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -349,8 +349,7 @@ def connect(self, serial: int): ] def move_abs(self, position: float, channel: int): # DK - position should be int - self._device.MoveTo(channel, Decimal(position), 6000) # DK - Decimal(position) should be position - self._channel[channel - 1] = channel + self._device.MoveTo(self._channel[channel-1], position, 6000) def get_position(self, channel: int): return Decimal.ToDouble(self._device.GetPosition(channel)) From 58b8b51b9cfca1c2a7b48a413e8eba20b8176dd0 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Fri, 13 Dec 2024 00:06:43 -0600 Subject: [PATCH 23/31] Add channel and pass move_rel --- .../daq_move_plugins/daq_move_KPZ101.py | 9 +++------ src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py index ee8c95b..28df607 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py @@ -102,7 +102,7 @@ def move_abs(self, value: DataActuator): value = self.check_bound(value) self.target_value = value value = self.set_position_with_scaling(value) - self.controller.move_abs(value.value()) + self.controller.move_abs(value.value(), axis=self.axis) def move_rel(self, value: DataActuator): """ Move the actuator to the relative target actuator value defined by value @@ -111,14 +111,11 @@ def move_rel(self, value: DataActuator): ---------- value: (DataActuator) value of the relative target positioning """ - value = self.check_bound(self.current_value + value) - self.current_value - self.target_value = value + self.current_value - value = self.set_position_relative_with_scaling(value) - self.controller.move_abs(self.target_value.value()) + pass def move_home(self): """Call the reference method of the controller""" - self.controller.home() + self.controller.home(axis=self.axis) def stop_motion(self): """Stop the actuator and emits move_done signal""" diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 7a5d45b..85c5e2b 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -348,7 +348,7 @@ def connect(self, serial: int): InertialMotor.InertialMotorStatus.MotorChannels.Channel4 ] - def move_abs(self, position: float, channel: int): # DK - position should be int + def move_abs(self, position: int, channel: int): # DK - position should be int self._device.MoveTo(self._channel[channel-1], position, 6000) def get_position(self, channel: int): From 41f7989b3786266192a93bc35ef7faa644c6ee11 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Fri, 13 Dec 2024 00:07:12 -0600 Subject: [PATCH 24/31] Update info --- .../daq_move_plugins/daq_move_KPZ101.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py index 28df607..ddb5161 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KPZ101.py @@ -88,7 +88,7 @@ def ini_stage(self, controller=None): self.axis_unit = self._controller_units - info = f'{self.controller.name} - {self.controller.serial_number}' + info = "KIM101 Initialized" initialized = True return info, initialized From 2097b0f1d2996458b42a4f96ce418922fd532671 Mon Sep 17 00:00:00 2001 From: nano713 <50872819+nano713@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:57:49 +0900 Subject: [PATCH 25/31] Update move_rel method. Co-authored-by: Amelie Francoise Deshazer --- .../daq_move_plugins/daq_move_KIM101.py | 21 ++++++++++++------- .../hardware/kinesis.py | 13 ++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 5566fa9..57ea396 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -20,12 +20,12 @@ class DAQ_Move_KIM101(DAQ_Move_base): """ _controller_units = KIM101.default_units is_multiaxes = True - _axes_names = {'1': 1, '2': 2, '3': 3, '4': 4} + _axes_names = {'1': 1, '2': 2, '3': 3, '4': 4} _epsilon = 0.01 data_actuator_type = DataActuatorType.DataActuator params = [ {'title': 'Serial Number:', 'name': 'serial_number', 'type': 'list', - 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]}, + 'limits': serialnumbers_inertial_motor, 'value': serialnumbers_inertial_motor[0]}, ] + comon_parameters_fun(is_multiaxes, axes_names=_axes_names, epsilon=_epsilon) @@ -40,7 +40,7 @@ def get_actuator_value(self): DataActuator: The position obtained after scaling conversion. """ pos = DataActuator( - data=self.controller.get_position(channel=self.axis), + data=self.controller.get_position(channel=self.axis_value), units=self.controller.get_units() ) pos = self.get_position_with_scaling(pos) @@ -98,21 +98,26 @@ def move_abs(self, value: DataActuator): """ value = self.check_bound(value) self.target_value = value - value = self.set_position_with_scaling(value) - self.controller.move_abs(value.value(), axis=self.axis) + value = self.set_position_with_scaling(value) + self.controller.move_abs(int(value.value()), self.axis_value) def move_rel(self, value: DataActuator): """ Move the actuator to the relative target actuator value defined by value Parameters ---------- - value: (DataActuator) value of the relative target positioning + value: (float) value of the relative target positioning """ - pass + value = self.check_bound(self.current_position + value) - self.current_position + self.target_value = value + self.current_position + value = self.set_position_relative_with_scaling(value) + + self.controller.move_rel(int(value.value()), self.axis_value) + def move_home(self): """Call the reference method of the controller""" - self.controller.home(self.axis) + self.controller.home(self.axis_value) def stop_motion(self): """Stop the actuator and emits move_done signal""" diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 85c5e2b..2829b20 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -6,6 +6,7 @@ from System import Action from System import UInt64 from System import UInt32 +import logging kinesis_path = 'C:\\Program Files\\Thorlabs\\Kinesis' sys.path.append(kinesis_path) @@ -351,6 +352,18 @@ def connect(self, serial: int): def move_abs(self, position: int, channel: int): # DK - position should be int self._device.MoveTo(self._channel[channel-1], position, 6000) + def move_rel(self, increment: int, channel: int): + target_position = self.get_position(channel) + increment + while (increment != 0): + if (increment > 0): + step = min(increment, 1) + else: + step = max(increment, -1) + position_new = self.get_position(channel) + step + self.move_abs(position_new, channel) + increment = target_position - self.get_position(channel) + + def get_position(self, channel: int): return self._device.GetPosition(self._channel[channel-1]) From 61af638bee6961ef718393460e6b8de5d1d17eaa Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Tue, 17 Dec 2024 22:28:29 -0600 Subject: [PATCH 26/31] pass commit_settings --- .../daq_move_plugins/daq_move_KIM101.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py index 57ea396..c4e6280 100644 --- a/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py +++ b/src/pymodaq_plugins_thorlabs/daq_move_plugins/daq_move_KIM101.py @@ -59,8 +59,7 @@ def commit_settings(self, param: Parameter): param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - if param.name() == 'axis':# DK - delete this. daq_move covers this. - self.axis = param.value() + pass def ini_stage(self, controller=None): """Actuator communication initialization From 51b5b335e16d71555e55d55572083c16b408d7f4 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Mon, 13 Jan 2025 20:06:07 -0600 Subject: [PATCH 27/31] Delete comments --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 2829b20..6a6ec12 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -349,7 +349,7 @@ def connect(self, serial: int): InertialMotor.InertialMotorStatus.MotorChannels.Channel4 ] - def move_abs(self, position: int, channel: int): # DK - position should be int + def move_abs(self, position: int, channel: int): self._device.MoveTo(self._channel[channel-1], position, 6000) def move_rel(self, increment: int, channel: int): @@ -373,9 +373,6 @@ def home(self, channel: int): def stop(self): pass - # def get_channel(self, channel: int): - # return self._channel[channel - 1] - def close(self): self._device.StopPolling() self._device.Disconnect() From fe36ecc1f5a8e0995e91b2a756fb2abf670f6633 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Mon, 13 Jan 2025 20:12:46 -0600 Subject: [PATCH 28/31] Update actuators --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 882c569..0321e4c 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,7 @@ Actuators * **PRM1Z8_pylablib**: DC servo motorized 360° rotation mount (Thorlabs PRM1Z8) using the pylablib control module. The Thorlabs APT software should be installed: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=9019. * **BrushlessDCMotor**: Kinesis control of DC Brushless Motor (tested with the BBD201 controller) * **Kinesis_KPZ101**: Piezo Electric Stage Kinesis series (KPZ101) +* **KIM101**: Four Channel Piezo Inertia Motion Kinesis series (KIM101) Viewer0D From fbb46bca90048514bf676c59e175122dc1f21566 Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Mon, 13 Jan 2025 20:13:07 -0600 Subject: [PATCH 29/31] Rename KIM101 --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 0321e4c..8cc503b 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ Actuators * **PRM1Z8_pylablib**: DC servo motorized 360° rotation mount (Thorlabs PRM1Z8) using the pylablib control module. The Thorlabs APT software should be installed: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=9019. * **BrushlessDCMotor**: Kinesis control of DC Brushless Motor (tested with the BBD201 controller) * **Kinesis_KPZ101**: Piezo Electric Stage Kinesis series (KPZ101) -* **KIM101**: Four Channel Piezo Inertia Motion Kinesis series (KIM101) +* **Kinesis_KIM101**: Four Channel Piezo Inertia Motion Kinesis series (KIM101) Viewer0D From 19ff78ac898dfc02cabd8551d97f337800be3b6e Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Mon, 13 Jan 2025 20:39:32 -0600 Subject: [PATCH 30/31] delete comments --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 6a6ec12..61a51a6 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -38,7 +38,7 @@ serialnumbers_brushless = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(BrushlessMotorCLI.BenchtopBrushlessMotor.DevicePrefix)] serialnumbers_piezo = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(KCubePiezo.KCubePiezo.DevicePrefix)] -# TODO fix serialnumbers_inertial_motor + serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotor.KCubeInertialMotor.DevicePrefix_KIM101)] #or InertialMotor.KCube.InertialMotor.DevicePrefix From cf1d26214893d087940c286b437fc31707b9c01a Mon Sep 17 00:00:00 2001 From: adeshazer123 Date: Mon, 13 Jan 2025 20:40:08 -0600 Subject: [PATCH 31/31] Refractor comments --- src/pymodaq_plugins_thorlabs/hardware/kinesis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py index 61a51a6..168017b 100644 --- a/src/pymodaq_plugins_thorlabs/hardware/kinesis.py +++ b/src/pymodaq_plugins_thorlabs/hardware/kinesis.py @@ -39,7 +39,7 @@ Device.DeviceManagerCLI.GetDeviceList(BrushlessMotorCLI.BenchtopBrushlessMotor.DevicePrefix)] serialnumbers_piezo = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(KCubePiezo.KCubePiezo.DevicePrefix)] -serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotor.KCubeInertialMotor.DevicePrefix_KIM101)] #or InertialMotor.KCube.InertialMotor.DevicePrefix +serialnumbers_inertial_motor = [str(ser) for ser in Device.DeviceManagerCLI.GetDeviceList(InertialMotor.KCubeInertialMotor.DevicePrefix_KIM101)] class Kinesis: