Files
motorDriverTests/setup/sinqMotor/masterMacs/reset.py
2025-11-03 16:31:18 +01:00

27 lines
676 B
Python
Executable File

import time
def reset(motor, target):
"""
Reset the motor for the next test. This means the following things:
1) Stopping the motor
2) Resetting all errors
3) Enabling the motor
4) Moving to zero
"""
# Wait a bit before starting each test so the IOC has some time
# to recover from any previous failed tests.
time.sleep(0.2)
if target is None:
target = motor.default_position
motor.put_pv('stop', 1)
motor.wait_for_done()
motor.put_pv('reseterrorpv', 1)
motor.wait_disabled()
motor.enable_and_wait()
motor.move_and_wait(target)
assert motor.at_target(target)
assert not motor.has_error()