Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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},
Expand Down Expand Up @@ -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
Expand All @@ -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):
"""
Expand All @@ -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):
"""
Expand Down
14 changes: 7 additions & 7 deletions src/pymodaq_plugins_smaract/hardware/smaract/scu/scu_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand All @@ -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:
Expand All @@ -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):
Expand Down
Loading