wip: fix attocube
This commit is contained in:
parent
1169e0cd09
commit
ea8570d422
15
cfg/attocube_cfg.py
Normal file
15
cfg/attocube_cfg.py
Normal file
@ -0,0 +1,15 @@
|
||||
Node('attocube_test.psi.ch',
|
||||
'a single attocube axis',
|
||||
interface='tcp://5000',
|
||||
)
|
||||
|
||||
Mod('r',
|
||||
'frappy_psi.attocube.Axis',
|
||||
'ANRv220-F3-02882',
|
||||
axis = 1,
|
||||
unit = 'deg',
|
||||
tolerance = 0.01,
|
||||
target_limits = (0, 360),
|
||||
# gear = 1.2,
|
||||
)
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
import sys
|
||||
import time
|
||||
from frappy.core import Drivable, Parameter, Command, Property, ERROR, WARN, BUSY, IDLE, Done, nopoll
|
||||
from frappy.features import HasTargetLimits, HasSimpleOffset
|
||||
from frappy.core import Drivable, Parameter, Command, Property, ERROR, WARN, BUSY, IDLE, Done, nopoll, TupleOf
|
||||
# from frappy.features import HasSimpleOffset
|
||||
from frappy.datatypes import IntRange, FloatRange, StringType, BoolType
|
||||
from frappy.errors import ConfigError, BadValueError
|
||||
sys.path.append('/home/l_samenv/Documents/anc350/Linux64/userlib/lib')
|
||||
@ -52,6 +52,7 @@ class FreezeStatus:
|
||||
return Done
|
||||
return inner(self)
|
||||
|
||||
wrapped.poll = True
|
||||
cls.read_status = wrapped
|
||||
super().__init_subclass__()
|
||||
|
||||
@ -61,16 +62,18 @@ class FreezeStatus:
|
||||
self.status = code, text
|
||||
|
||||
|
||||
class Axis(HasTargetLimits, FreezeStatus, Drivable):
|
||||
class Axis(FreezeStatus, Drivable):
|
||||
axis = Property('axis number', IntRange(0, 2), 0)
|
||||
value = Parameter('axis position', FloatRange(unit='deg'))
|
||||
frequency = Parameter('frequency', FloatRange(1, unit='Hz'), readonly=False)
|
||||
amplitude = Parameter('amplitude', FloatRange(0, unit='V'), readonly=False)
|
||||
gear = Parameter('gear factor', FloatRange(), readonly=False, default=1, initwrite=True)
|
||||
gear = Parameter('gear factor', FloatRange(), readonly=False, default=1)
|
||||
tolerance = Parameter('positioning tolerance', FloatRange(0, unit='$'), readonly=False, default=0.01)
|
||||
output = Parameter('enable output', BoolType(), readonly=False)
|
||||
info = Parameter('axis info', StringType())
|
||||
statusbits = Parameter('status bits', StringType())
|
||||
target_limits = Parameter('target limits', TupleOf(FloatRange(), FloatRange()), readonly=False)
|
||||
|
||||
|
||||
_hw = Positioner()
|
||||
_scale = 1 # scale for custom units
|
||||
@ -85,9 +88,10 @@ class Axis(HasTargetLimits, FreezeStatus, Drivable):
|
||||
|
||||
def __init__(self, name, logger, opts, srv):
|
||||
unit = opts.pop('unit', 'deg')
|
||||
opts['value.unit'] = unit
|
||||
# opts['value.unit'] = unit
|
||||
try:
|
||||
self._scale = self.SCALES[unit] * opts.get('gear', 1)
|
||||
# self._scale = self.SCALES[unit] * opts.get('gear', 1)
|
||||
self._scale = self.SCALES['deg'] * opts.get('gear', 1)
|
||||
except KeyError as e:
|
||||
raise ConfigError('unsupported unit: %s' % unit)
|
||||
super().__init__(name, logger, opts, srv)
|
||||
@ -191,7 +195,7 @@ class Axis(HasTargetLimits, FreezeStatus, Drivable):
|
||||
def write_target(self, value):
|
||||
if value == self.read_value():
|
||||
return value
|
||||
self.check_limits(value)
|
||||
# self.check_limits(value)
|
||||
self._try_count = 0
|
||||
self._direction = 1 if value > self.value else -1
|
||||
# if self._error_state and DIRECTION_NAME[-self._direction] not in self._error_state:
|
||||
|
Loading…
x
Reference in New Issue
Block a user