Commit ad101cb1 authored by bliss administrator's avatar bliss administrator
Browse files

undulators: write move attribute only when target is outside tolerance

parent 0adaae67
Pipeline #67806 failed
import pytest
from bliss.common.axis import NoSettingsAxis
from bliss.common.logtools import log_debug, log_warning
from bliss.controllers.motors.esrf_undulator import ESRF_Undulator
from bliss.controllers.motors import esrf_undulator
......@@ -41,4 +43,23 @@ class ID26_Undulator(ESRF_Undulator):
def __init__(self, *args, **kwargs):
ESRF_Undulator.__init__(self, *args, **kwargs)
def start_one(self, motion, t0=None):
if motion.target_pos != pytest.approx(motion.axis.position, abs=motion.axis.tolerance):
self._set_attribute(
motion.axis,
"attr_pos_name",
float(motion.target_pos / motion.axis.steps_per_unit),
)
else:
log_warning(self,
"{0} within tolerance {1}: {2} (requested new pos id: {3})".format(
motion.axis.name,
motion.axis.tolerance,
motion.axis.position,
motion.target_pos,
)
)
log_debug(self, f"end of start {motion.axis.name}")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment