27 lines
681 B
Python
Executable File
27 lines
681 B
Python
Executable File
import time
|
|
|
|
def reset(motor, target=None):
|
|
"""
|
|
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()
|