From 45ffc3730c99779ae86375ffe488dfc52c45c287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Margueritat?= Date: Wed, 11 Nov 2026 12:41:28 +0100 Subject: [PATCH 1/4] Make the default axis units configurable, for controllers that cannot report them (e.g. E-517) --- .../daq_move_plugins/daq_move_PI.py | 2 +- .../resources/config_template.toml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py b/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py index a4fe9ac..e68ed07 100644 --- a/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py +++ b/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py @@ -107,7 +107,7 @@ def ini_stage(self, controller=None): self.settings.child('controller_id').setValue(self.controller.identify()) self.axis_names = self.controller.axis_names - self.axis_units = self.controller.get_axis_units() + self.axis_units = self.controller.get_axis_units(default=config['default_units']) self.epsilons = [self._epsilon for _ in range(len(self.axis_names))] # self.controller.set_referencing(self.axis_name) diff --git a/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml b/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml index 84e4b29..1e05542 100644 --- a/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml +++ b/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml @@ -19,5 +19,7 @@ dll_names = ['PI_GCS2_DLL', 'E816_DLL', 'C7XX_GCS_DLL'] # dll to use in order t # 'HEX_GCS_DLL': ['HEXAPOD', 'HEXAPOD_GCS1', ], # 'PI_G_GCS2_DLL': ['UNKNOWN', ], +default_units = 'mm' # units of the axes when the controller cannot give them, e.g. 'um' for an E-517 piezo controller + [mmc] com_port = 'COM13' \ No newline at end of file From 9d34be8791fe8b02b30021715eb4136ba2210b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Margueritat?= Date: Wed, 11 Nov 2026 12:49:37 +0100 Subject: [PATCH 2/4] Ignore the error 10 reported by PI controllers after a stop, so that move_done is called --- src/pymodaq_plugins_physik_instrumente/hardware/pi_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pymodaq_plugins_physik_instrumente/hardware/pi_wrapper.py b/src/pymodaq_plugins_physik_instrumente/hardware/pi_wrapper.py index 64fe93f..70681b5 100644 --- a/src/pymodaq_plugins_physik_instrumente/hardware/pi_wrapper.py +++ b/src/pymodaq_plugins_physik_instrumente/hardware/pi_wrapper.py @@ -277,7 +277,7 @@ def is_referenced(self, axis_name: str): def stop(self): """ Stop the motion of the connected device""" - self.device.StopAll() + self.device.StopAll(noraise=True) # the controller then reports error 10 (stopped by command), expected def get_axis_position(self, axis_name: str) -> float: """ Get the specified axis position From d2bc395eda9df206352a66c81c6a54e13ec210bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Margueritat?= Date: Wed, 11 Nov 2026 13:00:47 +0100 Subject: [PATCH 3/4] Update the servo state and the limits when the axis is changed (multiaxes group removed in PyMoDAQ 5.3) --- .../daq_move_plugins/daq_move_PI.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py b/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py index e68ed07..85be97c 100644 --- a/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py +++ b/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py @@ -7,7 +7,6 @@ DataActuator, DataActuatorType) from pymodaq_utils.utils import ThreadCommand, getLineInfo, is_64bits, find_keys_from_val -from pymodaq_gui.parameter.utils import iter_children from pymodaq_plugins_physik_instrumente.utils import Config, get_devices_and_dlls @@ -79,9 +78,8 @@ def commit_settings(self, param): if param.name() == 'use_joystick': self.controller.use_joystick(param.value()) - elif param.name() == 'axis' and param.name() in iter_children(self.settings.child('multiaxes')): - self.settings.child('closed_loop').setValue(self.controller.get_servo(param.value())) - self.controller.set_referencing(self.axis_name) + elif param.name() == 'axis': + self.settings.child('closed_loop').setValue(self.controller.get_servo(self.axis_name)) self.set_axis_limits(self.controller.get_axis_limits(self.axis_name)) elif param.name() == 'closed_loop': From 370e1ab28166de348c67e80d2f5d40f44e5111b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Margueritat?= Date: Wed, 11 Nov 2026 18:35:14 +0100 Subject: [PATCH 4/4] Read the axis names offered before connection from the configuration, so that axes can be set in Dashboard experiments --- .../daq_move_plugins/daq_move_PI.py | 4 ++-- .../resources/config_template.toml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py b/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py index 85be97c..eae5584 100644 --- a/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py +++ b/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py @@ -43,7 +43,7 @@ class DAQ_Move_PI(DAQ_Move_base): data_actuator_type = DataActuatorType.DataActuator is_multiaxes = True - stage_names = [''] + _axis_names = config['axis_names'] or [''] # from the configuration, or known only once connected _epsilon = 0.01 @@ -64,7 +64,7 @@ class DAQ_Move_PI(DAQ_Move_base): {'title': 'Min:', 'name': 'min', 'type': 'float'}, {'title': 'Max:', 'name': 'max', 'type': 'float'}, ]}, - ] + comon_parameters_fun(is_multiaxes, axis_names=stage_names, epsilon=_epsilon) + ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon) def ini_attributes(self): self.controller: PIWrapper = None diff --git a/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml b/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml index 1e05542..5154796 100644 --- a/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml +++ b/src/pymodaq_plugins_physik_instrumente/resources/config_template.toml @@ -20,6 +20,7 @@ dll_names = ['PI_GCS2_DLL', 'E816_DLL', 'C7XX_GCS_DLL'] # dll to use in order t # 'PI_G_GCS2_DLL': ['UNKNOWN', ], default_units = 'mm' # units of the axes when the controller cannot give them, e.g. 'um' for an E-517 piezo controller +axis_names = [] # axes offered before connection (Dashboard experiments), e.g. ['A', 'B', 'C'] for an E-517 [mmc] com_port = 'COM13' \ No newline at end of file