diff --git a/src/pymodaq_plugins_smaract/daq_move_plugins/daq_move_SmarActSCUINSA.py b/src/pymodaq_plugins_smaract/daq_move_plugins/daq_move_SmarActSCUINSA.py index 506ec55..8720531 100644 --- a/src/pymodaq_plugins_smaract/daq_move_plugins/daq_move_SmarActSCUINSA.py +++ b/src/pymodaq_plugins_smaract/daq_move_plugins/daq_move_SmarActSCUINSA.py @@ -1,15 +1,17 @@ from typing import Union, List, Dict -from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main, comon_parameters_fun +from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, main, comon_parameters_fun, DataActuatorType from pymodaq.utils.daq_utils import ThreadCommand from easydict import EasyDict as edict from pymodaq_plugins_smaract.hardware.smaract.scu.scu_wrapper import (get_devices, SCUType, SCUWrapper, SCULinear, SCURotation) +from pymodaq.utils.data import DataActuator + psets: list[SCUType] = get_devices() -psets_str = [f"Dev. Id{pset.device_id} channel {pset.channel}" for pset in psets] +psets_str = [f"Dev. Id{pset.device_id} channel {pset.channel} ({pset.scu_type.__name__})" for pset in psets] class DAQ_Move_SmarActSCUINSA(DAQ_Move_base): @@ -23,6 +25,8 @@ class DAQ_Move_SmarActSCUINSA(DAQ_Move_base): is_multiaxes = True _axis_names = ['1'] + data_actuator_type = DataActuatorType.DataActuator + params = [ {'title': 'Device', 'name': 'device', 'type': 'list','limits': psets_str}, {'title': 'Frequency (Hz)', 'name': 'frequency', 'type': 'int', 'value': 1000, 'limits': SCUWrapper.frequency_limits}, @@ -75,7 +79,7 @@ def get_actuator_value(self): ------- float: The position obtained after scaling conversion. """ - position = self.controller.get_position() + position = DataActuator(data=self.controller.get_position(), units=self.axis_unit) # convert position if scaling options have been used, mandatory here position = self.get_position_with_scaling(position) #position = self.target_position @@ -98,7 +102,7 @@ def move_abs(self, position): # has been activated by user position = self.set_position_with_scaling(position) - self.controller.move_abs(position) + self.controller.move_abs(position.value()) def move_rel(self, position): """ @@ -112,7 +116,7 @@ def move_rel(self, position): self.target_position = position + self.current_position position = self.set_position_relative_with_scaling(position) - self.controller.move_rel(position) + self.controller.move_rel(position.value()) def move_home(self): """ diff --git a/src/pymodaq_plugins_smaract/hardware/smaract/scu/scu_wrapper.py b/src/pymodaq_plugins_smaract/hardware/smaract/scu/scu_wrapper.py index 422bd3f..8f2c65a 100644 --- a/src/pymodaq_plugins_smaract/hardware/smaract/scu/scu_wrapper.py +++ b/src/pymodaq_plugins_smaract/hardware/smaract/scu/scu_wrapper.py @@ -15,7 +15,7 @@ def __init__(self, id: int, scu_type, channel: int): self.channel = channel def __repr__(self): - return f'SN: {self.device_id}, type:{self.scu_type}, channel: {self.channel}' + return f'SN: {self.device_id}, type:{self.scu_type.__name__}, channel: {self.channel}' def get_devices(): @@ -82,8 +82,7 @@ def __init__(self): self.hold_time = 0 self._amplitude = 100 #between 15 and 100 self._frequency = 440 #between 1 and 18500 - self._steps = 0 #between -30000 and 30000 - + self._position = 0 #between -30000 and 30000 @property @@ -167,8 +166,8 @@ def move_rel(self, n_steps : int): so the value will be converted accordingly - frequency: Frequency in Hz that the steps are performed with """ - self.steps += n_steps bindings.MoveStep_S(self.device_index, self.channel_index, int(n_steps), self.amplitude*10, self.frequency) + self._position += int(n_steps) def move_abs(self, steps): """ @@ -185,8 +184,9 @@ def move_abs(self, steps): - frequency: Frequency in Hz that the steps are performed with """ - self.steps = steps - self.steps - bindings.MoveStep_S(self.device_index, self.channel_index, int(self.steps), self.amplitude*10, self.frequency) + n_steps = int(steps - self._position) + bindings.MoveStep_S(self.device_index, self.channel_index, n_steps, self.amplitude*10, self.frequency) + self._position = steps def get_position(self) -> float: @@ -202,7 +202,7 @@ def get_position(self) -> float: - position: Buffer for the current position given in steps meters """ - return self._steps + return self._position def stop(self):