From 0d36741754a0524135811fccd1b9a6528748d023 Mon Sep 17 00:00:00 2001 From: Jeremie Margueritat Date: Mon, 12 Oct 2026 22:22:41 +0200 Subject: [PATCH 1/6] Remove template leftovers and update the repository URL --- pyproject.toml | 7 +- .../app/custom_app_template.py | 125 ---------------- .../extensions/custom_extension_template.py | 140 ------------------ .../models/PIDModelTemplate.py | 100 ------------- 4 files changed, 2 insertions(+), 370 deletions(-) delete mode 100644 src/pymodaq_plugins_acs_motion/app/custom_app_template.py delete mode 100644 src/pymodaq_plugins_acs_motion/extensions/custom_extension_template.py delete mode 100644 src/pymodaq_plugins_acs_motion/models/PIDModelTemplate.py diff --git a/pyproject.toml b/pyproject.toml index ce87ae3..951fe1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,10 +6,10 @@ h5exporters = false # true if plugin contains custom h5 file exporters scanners = false # true if plugin contains custom scan layout (daq_scan extensions) [urls] -package-url = 'https://github.com/JMargueritatLab/pymodaq_plugins_acs_motion' +package-url = 'https://github.com/PyMoDAQ/pymodaq_plugins_acs_motion' [project] -name = "pymodaq_plugins_acs_motion" #todo modify template by your plugin short name +name = "pymodaq_plugins_acs_motion" description = 'This plugins interact with ACS motion controllers to drive stages.' dependencies = [ "pymodaq>=5.3.2", @@ -17,16 +17,13 @@ dependencies = [ "pymodaq_gui>=5.3.0", "pymodaq_data>=5.3.0", "ACSpy", - #todo: list here all dependencies your package may have ] authors = [ {name = "Jérémie Margueritat", email = "jeremie.margueritat@univ-lyon1.fr"}, - #todo: list here all authors of your plugin ] maintainers = [ {name = "Jérémie Margueritat", email = "jeremie.margueritat@univ-lyon1.fr"}, - #todo: list here all maintainers of your plugin ] # nottodo: leave everything below as is! diff --git a/src/pymodaq_plugins_acs_motion/app/custom_app_template.py b/src/pymodaq_plugins_acs_motion/app/custom_app_template.py deleted file mode 100644 index dc1d514..0000000 --- a/src/pymodaq_plugins_acs_motion/app/custom_app_template.py +++ /dev/null @@ -1,125 +0,0 @@ -from qtpy import QtWidgets - -from pymodaq_gui import utils as gutils -from pymodaq_utils.config import Config -from pymodaq_utils.logger import set_logger, get_module_name - -# todo: replace here *pymodaq_plugins_template* by your plugin package name -from pymodaq_plugins_acs_motion.utils import Config as PluginConfig - -logger = set_logger(get_module_name(__file__)) - -main_config = Config() -plugin_config = PluginConfig() - - -# todo: modify the name of this class to reflect its application and change the name in the main -# method at the end of the script -class CustomAppTemplate(gutils.CustomApp): - - # todo: if you wish to create custom Parameter and corresponding widgets. These will be - # automatically added as children of self.settings. Morevover, the self.settings_tree will - # render the widgets in a Qtree. If you wish to see it in your app, add is into a Dock - params = [] - - def __init__(self, parent: gutils.DockArea): - super().__init__(parent) - - self.setup_ui() - - def setup_docks(self): - """Mandatory method to be subclassed to setup the docks layout - - Examples - -------- - >>>self.docks['ADock'] = gutils.Dock('ADock name') - >>>self.dockarea.addDock(self.docks['ADock']) - >>>self.docks['AnotherDock'] = gutils.Dock('AnotherDock name') - >>>self.dockarea.addDock(self.docks['AnotherDock'''], 'bottom', self.docks['ADock']) - - See Also - -------- - pyqtgraph.dockarea.Dock - """ - # todo: create docks and add them here to hold your widgets - # reminder, the attribute self.settings_tree will render the widgets in a Qtree. - # If you wish to see it in your app, add is into a Dock - raise NotImplementedError - - def setup_actions(self): - """Method where to create actions to be subclassed. Mandatory - - Examples - -------- - >>> self.add_action('quit', 'Quit', 'close2', "Quit program") - >>> self.add_action('grab', 'Grab', 'camera', "Grab from camera", checkable=True) - >>> self.add_action('load', 'Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera" - , checkable=False) - >>> self.add_action('save', 'Save', 'SaveAs', "Save current data", checkable=False) - - See Also - -------- - ActionManager.add_action - """ - raise NotImplementedError(f'You have to define actions here') - - def connect_things(self): - """Connect actions and/or other widgets signal to methods""" - raise NotImplementedError - - def setup_menu(self, menubar: QtWidgets.QMenuBar = None): - """Non mandatory method to be subclassed in order to create a menubar - - create menu for actions contained into the self._actions, for instance: - - Examples - -------- - >>>file_menu = menubar.addMenu('File') - >>>self.affect_to('load', file_menu) - >>>self.affect_to('save', file_menu) - - >>>file_menu.addSeparator() - >>>self.affect_to('quit', file_menu) - - See Also - -------- - pymodaq.utils.managers.action_manager.ActionManager - """ - # todo create and populate menu using actions defined above in self.setup_actions - pass - - def value_changed(self, param): - """ Actions to perform when one of the param's value in self.settings is changed from the - user interface - - For instance: - if param.name() == 'do_something': - if param.value(): - print('Do something') - self.settings.child('main_settings', 'something_done').setValue(False) - - Parameters - ---------- - param: (Parameter) the parameter whose value just changed - """ - pass - - -def main(): - from pymodaq_gui.utils.utils import mkQApp - app = mkQApp('CustomApp') - - mainwindow = QtWidgets.QMainWindow() - dockarea = gutils.DockArea() - mainwindow.setCentralWidget(dockarea) - - # todo: change the name here to be the same as your app class - prog = CustomAppTemplate(dockarea) - - mainwindow.show() - - app.exec() - - -if __name__ == '__main__': - main() diff --git a/src/pymodaq_plugins_acs_motion/extensions/custom_extension_template.py b/src/pymodaq_plugins_acs_motion/extensions/custom_extension_template.py deleted file mode 100644 index 538608b..0000000 --- a/src/pymodaq_plugins_acs_motion/extensions/custom_extension_template.py +++ /dev/null @@ -1,140 +0,0 @@ -from qtpy import QtWidgets - -from pymodaq_gui import utils as gutils -from pymodaq_utils.config import Config, ConfigError -from pymodaq_utils.logger import set_logger, get_module_name - -from pymodaq.utils.config import get_set_preset_path -from pymodaq.extensions.utils import CustomExt - - -# todo: replace here *pymodaq_plugins_template* by your plugin package name -from pymodaq_plugins_acs_motion.utils import Config as PluginConfig - -logger = set_logger(get_module_name(__file__)) - -main_config = Config() -plugin_config = PluginConfig() - -# todo: modify this as you wish -EXTENSION_NAME = 'MY_EXTENSION_NAME' # the name that will be displayed in the extension list in the -# dashboard -CLASS_NAME = 'CustomExtensionTemplate' # this should be the name of your class defined below - - -# todo: modify the name of this class to reflect its application and change the name in the main -# method at the end of the script -class CustomExtensionTemplate(CustomExt): - - # todo: if you wish to create custom Parameter and corresponding widgets. These will be - # automatically added as children of self.settings. Morevover, the self.settings_tree will - # render the widgets in a Qtree. If you wish to see it in your app, add is into a Dock - params = [] - - def __init__(self, parent: gutils.DockArea, dashboard): - super().__init__(parent, dashboard) - - # info: in an extension, if you want to interact with ControlModules you have to use the - # object: self.modules_manager which is a ModulesManager instance from the dashboard - - self.setup_ui() - - def setup_docks(self): - """Mandatory method to be subclassed to setup the docks layout - - Examples - -------- - >>>self.docks['ADock'] = gutils.Dock('ADock name') - >>>self.dockarea.addDock(self.docks['ADock']) - >>>self.docks['AnotherDock'] = gutils.Dock('AnotherDock name') - >>>self.dockarea.addDock(self.docks['AnotherDock'''], 'bottom', self.docks['ADock']) - - See Also - -------- - pyqtgraph.dockarea.Dock - """ - # todo: create docks and add them here to hold your widgets - # reminder, the attribute self.settings_tree will render the widgets in a Qtree. - # If you wish to see it in your app, add is into a Dock - raise NotImplementedError - - def setup_actions(self): - """Method where to create actions to be subclassed. Mandatory - - Examples - -------- - >>> self.add_action('quit', 'Quit', 'close2', "Quit program") - >>> self.add_action('grab', 'Grab', 'camera', "Grab from camera", checkable=True) - >>> self.add_action('load', 'Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera" - , checkable=False) - >>> self.add_action('save', 'Save', 'SaveAs', "Save current data", checkable=False) - - See Also - -------- - ActionManager.add_action - """ - raise NotImplementedError(f'You have to define actions here') - - def connect_things(self): - """Connect actions and/or other widgets signal to methods""" - raise NotImplementedError - - def setup_menu(self, menubar: QtWidgets.QMenuBar = None): - """Non mandatory method to be subclassed in order to create a menubar - - create menu for actions contained into the self._actions, for instance: - - Examples - -------- - >>>file_menu = menubar.addMenu('File') - >>>self.affect_to('load', file_menu) - >>>self.affect_to('save', file_menu) - - >>>file_menu.addSeparator() - >>>self.affect_to('quit', file_menu) - - See Also - -------- - pymodaq.utils.managers.action_manager.ActionManager - """ - # todo create and populate menu using actions defined above in self.setup_actions - pass - - def value_changed(self, param): - """ Actions to perform when one of the param's value in self.settings is changed from the - user interface - - For instance: - if param.name() == 'do_something': - if param.value(): - print('Do something') - self.settings.child('main_settings', 'something_done').setValue(False) - - Parameters - ---------- - param: (Parameter) the parameter whose value just changed - """ - pass - - -def main(): - from pymodaq.utils.gui_utils.utils import mkQApp - from pymodaq.utils.gui_utils.loader_utils import load_dashboard_with_preset - from pymodaq.utils.messenger import messagebox - - app = mkQApp(EXTENSION_NAME) - try: - preset_file_name = plugin_config('presets', f'preset_for_{CLASS_NAME.lower()}') - load_dashboard_with_preset(preset_file_name, EXTENSION_NAME) - app.exec() - - except ConfigError as e: - messagebox(f'No entry with name f"preset_for_{CLASS_NAME.lower()}" has been configured' - f'in the plugin config file. The toml entry should be:\n' - f'[presets]' - f"preset_for_{CLASS_NAME.lower()} = {'a name for an existing preset'}" - ) - - -if __name__ == '__main__': - main() diff --git a/src/pymodaq_plugins_acs_motion/models/PIDModelTemplate.py b/src/pymodaq_plugins_acs_motion/models/PIDModelTemplate.py deleted file mode 100644 index 2b2dce8..0000000 --- a/src/pymodaq_plugins_acs_motion/models/PIDModelTemplate.py +++ /dev/null @@ -1,100 +0,0 @@ -import numpy as np - -from pymodaq.extensions.pid.utils import PIDModelGeneric, DataToActuatorPID, main -from pymodaq_data.data import DataToExport, DataCalculated - -from pymodaq.utils.data import DataActuator - -from typing import List - - -def some_function_to_convert_the_pid_outputs(outputs: List[float], dt: float, stab=True): - """ Should be replaced here or in the model class to process the outputs """ - return outputs - - -def some_function_to_convert_the_data(measurements: DataToExport): - """ Should be replaced here or in the model class to process the measurement """ - a = 0 - b = 1 - return [a, b] - - -class PIDModelTemplate(PIDModelGeneric): - limits = dict(max=dict(state=False, value=100), - min=dict(state=False, value=-100),) - konstants = dict(kp=0.1, ki=0.000, kd=0.0000) - - Nsetpoints = 2 # number of setpoints - setpoint_ini = [128, 128] # number and values of initial setpoints - setpoints_names = ['Xaxis', 'Yaxis'] # number and names of setpoints - - actuators_name = ["Xpiezo", "Ypiezo"] # names of actuator's control modules involved in the PID - detectors_name = ['Camera'] # names of detector's control modules involved in the PID - - params = [] # list of dict to initialize specific Parameters - - def __init__(self, pid_controller): - super().__init__(pid_controller) - - def update_settings(self, param): - """ - Get a parameter instance whose value has been modified by a user on the UI - Parameters - ---------- - param: (Parameter) instance of Parameter object - """ - if param.name() == '': - pass - - def ini_model(self): - super().ini_model() - - # add here other specifics initialization if needed - - def convert_input(self, measurements: DataToExport): - """ - Convert the measurements in the units to be fed to the PID (same dimensionality as the setpoint) - Parameters - ---------- - measurements: DataToExport - Data from the declared detectors from which the model extract a value of the same units as the setpoint - - Returns - ------- - InputFromDetector: the converted input in the setpoints units - - """ - - x, y = some_function_to_convert_the_data(measurements) - return DataToExport('pid inputs', - data=[DataCalculated('pid calculated', - data=[np.array([x]), - np.array([y])])]) - - def convert_output(self, outputs: List[float], dt: float, stab=True) -> DataToActuatorPID: - """ - Convert the output of the PID in units to be fed into the actuator - Parameters - ---------- - outputs: List of float - output value from the PID from which the model extract a value of the same units as the actuator - dt: float - Ellapsed time since the last call to this function - stab: bool - - Returns - ------- - OutputToActuator: the converted output - - """ - outputs = some_function_to_convert_the_pid_outputs(outputs, dt, stab) - return DataToActuatorPID('pid output', mode='rel', - data=[DataActuator(self.actuators_name[ind], data=outputs[ind]) - for ind in range(len(outputs))]) - - -if __name__ == '__main__': - main("BeamSteeringMockNoModel.xml") # some preset configured with the right actuators and detectors - - From ec927c55eba7552fffde7811fa27c3deace5ba3d Mon Sep 17 00:00:00 2001 From: Jeremie Margueritat Date: Mon, 12 Oct 2026 22:34:37 +0200 Subject: [PATCH 2/6] Update class attributes to the PyMoDAQ 5 interface and remove template comments --- .../daq_move_plugins/daq_move_AcsXY.py | 56 ++++--------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py index fb2af0c..57bd264 100644 --- a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py +++ b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py @@ -36,38 +36,26 @@ class DAQ_Move_AcsXY(DAQ_Move_base): controller: object The particular object that allow the communication with the hardware, in general a python wrapper around the hardware library. - - # TODO add your particular attributes here if any """ is_multiaxes = True - # Configured for only two axiss, but can be changed to 8 axes. - _axis_names: Union[List[str], Dict[str, int]] = {'Axis0':0, 'Axis1':1} - # Here all axes are translations stages with the same unit if difefrent type of stages are used as for example one translation and one rotation the dict must be updated in consequences. - _controller_units: Union[str, List[str]] = {'Axis0': 'mm', 'Axis1': 'mm'} - # WARNING: Please refer to your specific stage to set a meaningful value. If you use different type of stages (ex: translation and rotation) it can be replaced by the appropriate epsilon value. - _epsilon: Union[float, List[float]] = 0.00001 - data_actuator_type = DataActuatorType.DataActuator - # # wether you use the new data style for actuator otherwise set this - # as DataActuatorType.float (or entirely remove the line) - # At this step I will not use the new data dtyle it might be implemented in the future + # Configured for two axes, can be extended up to 8 axes. + _axis_names: Union[List[str], Dict[str, int]] = {'Axis0': 0, 'Axis1': 1} + # All axes are translation stages here; adapt per axis if stages of different types are used. + _controller_units: Union[str, Dict[str, str]] = {'Axis0': 'mm', 'Axis1': 'mm'} + # Tolerance used to decide that the target is reached; refer to your stages for a meaningful value. + _epsilons: Union[float, Dict[str, float]] = {'Axis0': 0.00001, 'Axis1': 0.00001} + data_actuator_type = DataActuatorType.DataActuator params = [ {'title': 'Serial Number', 'name': 'serial_num', 'type': 'str', 'value': '', 'readonly': True,}, {'title': 'Buffer Number', 'name': 'buff_num', 'type': 'int', 'value': 1, 'limits': [0, 9],} - ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon) - # _epsilon is the initial default value for the epsilon parameter allowing pymodaq to know if the controller reached - # the target value. It is the developer responsibility to put here a meaningful value + ] + comon_parameters_fun(is_multiaxes,axis_names=_axis_names) def ini_attributes(self): - # TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy - # autocompletion self.controller: Controller = None - #TODO declare here attributes you want/need to init with a default value - pass - def get_actuator_value(self): """Get the current value from the hardware with scaling conversion. @@ -82,45 +70,21 @@ def get_actuator_value(self): pos = self.get_position_with_scaling(pos) return pos - def user_condition_to_reach_target(self) -> bool: - """ Implement a condition for exiting the polling mechanism and specifying that the - target value has been reached - - Returns - ------- - bool: if True, PyMoDAQ considers the target value has been reached - """ - # TODO either delete this method if the usual polling is fine with you, but if need you can - # add here some other condition to be fullfilled either a completely new one or - # using or/and operations between the epsilon_bool and some other custom booleans - # for a usage example see DAQ_Move_brushlessMotor from the Thorlabs plugin - return True - def close(self): """Terminate the communication protocol""" self.controller.disable_all() self.controller.disconnect() def commit_settings(self, param: Parameter): - """Apply the consequences of a change of value in the detector settings + """Apply the consequences of a change of value in the settings Parameters ---------- param: Parameter A given parameter (within detector_settings) whose value has been changed by the user """ - ## TODO for your custom plugin if param.name() == 'axis': - self.get_actuator_value() # to update the current position of the axis - #self.axis_unit = 'mm' - # do this only if you can and if the units are not known beforehand, for instance - # if the motors connected to the controller are of different type (mm, µm, nm, , etc...) - # see BrushlessDCMotor from the thorlabs plugin for an exemple - - elif param.name() == "a_parameter_you've_added_in_self.params": - self.controller.your_method_to_apply_this_param_change() - else: - pass + self.get_actuator_value() # update the current position of the newly selected axis def ini_stage(self, controller=None): """Actuator communication initialization From ca8083296e3232f90b0c13357e453b7e568b9e00 Mon Sep 17 00:00:00 2001 From: Jeremie Margueritat Date: Mon, 12 Oct 2026 22:45:01 +0200 Subject: [PATCH 3/6] implement stop, initialization check and units handling in the AcsXY actuator --- .../daq_move_plugins/daq_move_AcsXY.py | 59 ++++++------------- .../hardware/acscontrol.py | 4 ++ 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py index 57bd264..db10b44 100644 --- a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py +++ b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py @@ -3,7 +3,6 @@ from pymodaq.control_modules.move_utility_classes import (DAQ_Move_base, comon_parameters_fun, main, DataActuatorType, DataActuator) -from pymodaq_utils.utils import ThreadCommand # object used to send info back to the main thread from pymodaq_gui.parameter import Parameter try: @@ -51,7 +50,7 @@ class DAQ_Move_AcsXY(DAQ_Move_base): 'value': '', 'readonly': True,}, {'title': 'Buffer Number', 'name': 'buff_num', 'type': 'int', 'value': 1, 'limits': [0, 9],} - ] + comon_parameters_fun(is_multiaxes,axis_names=_axis_names) + ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names) def ini_attributes(self): self.controller: Controller = None @@ -64,16 +63,16 @@ def get_actuator_value(self): float: The position obtained after scaling conversion. """ - pos = DataActuator( - data=self.controller.axes[self.axis_value].rpos, - unit=self.axis_unit) + pos = DataActuator(data=self.controller.axes[self.axis_value].rpos, + units=self.axis_unit) pos = self.get_position_with_scaling(pos) return pos def close(self): """Terminate the communication protocol""" - self.controller.disable_all() - self.controller.disconnect() + if self.controller is not None: + self.controller.disable_all() + self.controller.disconnect() def commit_settings(self, param: Parameter): """Apply the consequences of a change of value in the settings @@ -112,50 +111,28 @@ def ini_stage(self, controller=None): info = "Controller connected and axis enabled" - initialized = True#self.controller.a_method_or_atttribute_to_check_if_init() # todo + initialized = all(axis.enabled for axis in self.controller.axes) return info, initialized def move_abs(self, value: DataActuator): - """ Move the actuator to the absolute target defined by value - - Parameters - ---------- - value: (float) value of the absolute target positioning - """ - - value = self.check_bound(value) #if user checked bounds, the defined bounds are applied here + """Move the actuator to the absolute target defined by value""" + value = self.check_bound(value) self.target_value = value - value = self.set_position_with_scaling(value) # apply scaling if the user specified one - self.controller.axes[self.axis_value].ptp(value.value()) # when writing your own plugin replace this line - self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) + value = self.set_position_with_scaling(value) + self.controller.axes[self.axis_value].ptp(value.units_as(self.axis_unit).value()) def move_rel(self, value: DataActuator): - """ Move the actuator to the relative target actuator value defined by value - - Parameters - ---------- - value: (float) value of the relative target positioning - """ - 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.axes[self.axis_value].ptpr(value.value()) - self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) + """Move the actuator by the relative amount defined by value""" + self.move_abs(self.current_value + value) def move_home(self): - """Call the reference method of the controller""" - self.move_abs(DataActuator(data=0, unit=self.axis_unit)) - + """Move the current axis back to position 0""" + self.move_abs(DataActuator(data=0, units=self.axis_unit)) def stop_motion(self): - """Stop the actuator and emits move_done signal""" - - ## TODO for your custom plugin - raise NotImplemented # when writing your own plugin remove this line - self.controller.your_method_to_stop_positioning() # when writing your own plugin replace this line - self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log'])) + """Stop the current axis and emit the move_done signal""" + self.controller.axes[self.axis_value].halt() + self.move_done() if __name__ == '__main__': diff --git a/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py b/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py index ee0a68a..61e303b 100644 --- a/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py +++ b/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py @@ -85,6 +85,10 @@ def ptpr(self, distance, wait=acsc.SYNCHRONOUS): """Performance a point to point move in relative coordinates.""" self.ptp(distance, coordinates="relative", wait=wait) + def halt(self, wait=acsc.SYNCHRONOUS): + """Stops the motion of the axis using the defined deceleration.""" + acsc.halt(self.controller.hc, self.axisno, wait) + @property def axis_state(self): """Returns axis state dict.""" From 0c0b595c112d674c205b63f9ca2aa1f53c562a8c Mon Sep 17 00:00:00 2001 From: Jeremie Margueritat Date: Tue, 13 Oct 2026 09:41:33 +0200 Subject: [PATCH 4/6] STop overwriting the controller buffer at initialization --- .../daq_move_plugins/daq_move_AcsXY.py | 1 - src/pymodaq_plugins_acs_motion/hardware/acscontrol.py | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py index db10b44..632abcd 100644 --- a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py +++ b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py @@ -107,7 +107,6 @@ def ini_stage(self, controller=None): self.controller.connect() # any object that will control the stages self.controller.enable_all() # enable all axes self.settings['serial_num']=self.controller.serial_number() - self.controller.load_buffer(self.settings['buff_num']) # load the buffer file (it is needed to configure the controller) info = "Controller connected and axis enabled" diff --git a/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py b/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py index 61e303b..69fde2d 100644 --- a/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py +++ b/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py @@ -30,10 +30,6 @@ def run_buffer(self, buffer_number=1): """Loads a buffer file.""" acsc.runBuffer(self.hc, buffer_number) - def load_buffer(self, buffer_number=1, program_name="buffer"): - """Loads a buffer file.""" - acsc.loadBuffer(self.hc, buffer_number, program_name) - def stop_buffer(self, buffer_number=1): """Stops a buffer file.""" acsc.stopBuffer(self.hc, buffer_number) From aacf557d92b903716b05d50d2d0c545c5e068bf6 Mon Sep 17 00:00:00 2001 From: Jeremie Margueritat Date: Tue, 13 Oct 2026 09:51:49 +0200 Subject: [PATCH 5/6] Run the homing program of the controller on move_home --- .../daq_move_plugins/daq_move_AcsXY.py | 8 +++++--- src/pymodaq_plugins_acs_motion/hardware/acscontrol.py | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py index 632abcd..e5818f6 100644 --- a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py +++ b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py @@ -48,7 +48,7 @@ class DAQ_Move_AcsXY(DAQ_Move_base): params = [ {'title': 'Serial Number', 'name': 'serial_num', 'type': 'str', 'value': '', 'readonly': True,}, - {'title': 'Buffer Number', 'name': 'buff_num', 'type': 'int', + {'title': 'Homing buffer', 'name': 'buff_num', 'type': 'int', 'value': 1, 'limits': [0, 9],} ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names) @@ -125,8 +125,10 @@ def move_rel(self, value: DataActuator): self.move_abs(self.current_value + value) def move_home(self): - """Move the current axis back to position 0""" - self.move_abs(DataActuator(data=0, units=self.axis_unit)) + """Run the homing program of the controller and wait for its end""" + self.controller.run_buffer(self.settings['buff_num']) + self.controller.wait_program_end(self.settings['buff_num']) + self.target_value = self.get_actuator_value() def stop_motion(self): """Stop the current axis and emit the move_done signal""" diff --git a/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py b/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py index 69fde2d..644f8c1 100644 --- a/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py +++ b/src/pymodaq_plugins_acs_motion/hardware/acscontrol.py @@ -30,6 +30,10 @@ def run_buffer(self, buffer_number=1): """Loads a buffer file.""" acsc.runBuffer(self.hc, buffer_number) + def wait_program_end(self, buffer_number=1, timeout=120000): + """Waits until the program of the buffer has finished (timeout in ms).""" + acsc.waitProgramEnd(self.hc, buffer_number, timeout) + def stop_buffer(self, buffer_number=1): """Stops a buffer file.""" acsc.stopBuffer(self.hc, buffer_number) From e122fccb4812cf1c578250d1b851e6f14749374c Mon Sep 17 00:00:00 2001 From: Jeremie Margueritat Date: Tue, 13 Oct 2026 10:04:56 +0200 Subject: [PATCH 6/6] Update documentation after hardware tests --- README.rst | 13 ++++++++++--- .../daq_move_plugins/daq_move_AcsXY.py | 8 +++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 4d21a62..e80b9cb 100644 --- a/README.rst +++ b/README.rst @@ -37,8 +37,15 @@ The stages were alio's translation stages AI-CM-6000-XY Installation instructions ========================= -The user as to install the drivers from ACS. He may also need to intialise the stage within the software with the buffer file provided by ACS. In this new release, the plugin is able to load the buffer file automatically during initialization. Users are encouraged to check the compatibility of their ACS hardware with the latest version of the plugin. Additionally, it is recommended to refer to the ACS documentation for any specific setup requirements. - -* PyMoDAQ’s version: developed with PyMoDAQ 5.0.5 +The user has to install the drivers from ACS. The homing program provided with the stages +must be stored in a buffer of the controller (buffer 1 by default, set with the +'Homing buffer' parameter of the plugin). The plugin never modifies the buffers of the +controller: the Home button runs the homing program and waits for its end, homing all the +axes at once. It is recommended to keep a full backup of the controller application, made +with the Application Wizard of SPiiPlus MMI Application Studio. Users are encouraged to check +the compatibility of their ACS hardware with the latest version of the plugin, and to refer +to the ACS documentation for any specific setup requirements.. + +* PyMoDAQ’s version: developed with PyMoDAQ 5.3.2 * Operating system’s version: Windows 11 * The plugin assumes that the acs drivers are installed. \ No newline at end of file diff --git a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py index e5818f6..fa08725 100644 --- a/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py +++ b/src/pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py @@ -24,11 +24,13 @@ class DAQ_Move_AcsXY(DAQ_Move_base): (It has been tested with USB to ethernet adapter). Tested with ACS SPiiPlusEC controller and one drive UDMnt(2 axes). The stages were alio's translation stages AI-CM-6000-XY. - PyMoDAQ version during the test was PyMoDAQ==5.0.5. + PyMoDAQ version during the test was PyMoDAQ==5.3.2. The operating system used was Windows 11. Installation instructions: ACS drivers must be installed from the manufacturer's. - They usually come with the controller and with a "buffer" file for coniguration. - + The homing program provided with the stages must be stored in a buffer of the controller + (buffer 1 by default on the tested equipment, see the 'Homing buffer' parameter). + The plugin never modifies it. + The Home button runs this program and waits for its end: it homes all the axes at once. Attributes: -----------