Files
motorDriverTests/setup/sinqMotor/limits.py
T
Stefan Mathis 7ab4486748 Restructured the test setup
General test configurations are now separated from specific axis test
definitions.
2025-08-11 12:01:37 +02:00

30 lines
1022 B
Python
Executable File

import time
import math
from setup.classes import read_config
def reread_limits_from_hw(motor):
"""
sinqMotor drivers usually read their limits from the hardware at each poll,
hence any values manually written to DHLM or DLLM should be overwritten
after the next poll at latest
"""
(high_limit, low_limit) = motor.limits()
motor.put_pv('dialhighlimit', high_limit+10)
motor.put_pv('diallowlimit', low_limit-10)
# Wait two idle poll periods
time.sleep(2 * motor.idlepoll)
# Values should have been reread
assert math.isclose(motor.get_pv('highlimit'),
high_limit, rel_tol=1e-9, abs_tol=0.001)
assert math.isclose(motor.get_pv('lowlimit'),
low_limit, rel_tol=1e-9, abs_tol=0.001)
assert math.isclose(motor.get_pv('dialhighlimit'),
high_limit, rel_tol=1e-9, abs_tol=0.001)
assert math.isclose(motor.get_pv('diallowlimit'),
low_limit, rel_tol=1e-9, abs_tol=0.001)