Added sequencing test
This commit is contained in:
2
example_custom_script.py
Normal file → Executable file
2
example_custom_script.py
Normal file → Executable file
@@ -23,4 +23,4 @@ motor.write_field('enable', 0)
|
||||
time.sleep(2)
|
||||
|
||||
# Reenable the motor
|
||||
motor.write_field('enable', 0)
|
||||
motor.write_field('enable', 1)
|
||||
|
||||
@@ -6,7 +6,9 @@ epicsEnvSet("ASYN_PORT","p$(NAME)")
|
||||
drvAsynIPPortConfigure("$(ASYN_PORT)","$(MASTERMACS1_IP):$(MASTERMACS1_PORT)")
|
||||
masterMacsController("$(NAME)","$(ASYN_PORT)",8,$(MASTERMACS1_BUSYPOLL),$(MASTERMACS1_IDLEPOLL),0.3);
|
||||
masterMacsAxis("$(NAME)",1);
|
||||
# masterMacsAxis("$(NAME)",2);
|
||||
masterMacsAxis("$(NAME)",2);
|
||||
#masterMacsAxis("$(NAME)",3);
|
||||
#masterMacsAxis("$(NAME)",4);
|
||||
|
||||
epicsEnvSet("SINQDBPATH","$(masterMacs_DB)/sinqMotor.db")
|
||||
dbLoadTemplate("$(IOCDIR)/motors/$(NAME).substitutions", "INSTR=$(PVPREFIX):$(NAME):,CONTROLLER=$(NAME)")
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
file $(SINQDBPATH)
|
||||
{
|
||||
pattern
|
||||
{ AXIS, M, EGU, DIR, MRES, ENABLEMOVWATCHDOG, LIMITSOFFSET, CANSETSPEED }
|
||||
{ 1, "lin1", mm, Pos, 0.001, 1, 1.0, 1 }
|
||||
{ AXIS, M, EGU, DIR, MRES, ENABLEMOVWATCHDOG, LIMITSOFFSET, CANSETSPEED }
|
||||
{ 1, "lin1", mm, Pos, 0.001, 1, 1.0, 1 }
|
||||
{ 2, "rot1", deg, Pos, 0.001, 1, 1.0, 1 }
|
||||
#{ 3, "doesnotexist1", mm, Pos, 0.001, 1, 1.0, 1 }
|
||||
#{ 4, "doesnotexist2", mm, Pos, 0.001, 1, 1.0, 1 }
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ require masterMacs, $(MASTERMACS_VERSION)
|
||||
|
||||
# Initialize the motors itself
|
||||
< motors/turboPmac1.cmd
|
||||
#< motors/masterMacs1.cmd
|
||||
< motors/masterMacs1.cmd
|
||||
|
||||
# Create the test record which is used to detect if the IOC is running
|
||||
dbLoadRecords("$(IOCDIR)/db/ready.db", "PVPREFIX=$(PVPREFIX)")
|
||||
|
||||
@@ -34,6 +34,10 @@ def move_while_move(motor, first_target, second_target):
|
||||
assert motor.at_target()
|
||||
assert not motor.has_error()
|
||||
|
||||
def stop_then_move(motor, target):
|
||||
motor.write_field('stop', 1)
|
||||
motor.write_field('writepv', target)
|
||||
|
||||
|
||||
def stop(motor, target):
|
||||
"""
|
||||
|
||||
21
tests/sinqMotor/turboPmac/common.py
Normal file
21
tests/sinqMotor/turboPmac/common.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import time
|
||||
import pytest
|
||||
|
||||
def stop_reset_enable_move_sequence(motor, target):
|
||||
|
||||
motor.write_field('stop', 1)
|
||||
motor.write_field('reseterrorpv', 1)
|
||||
motor.write_field('enable', 1)
|
||||
|
||||
# Wait until the motor is enabled.
|
||||
now = time.time()
|
||||
max_enable_time = 10
|
||||
while motor.read_field('enable_rbv') == 0:
|
||||
# Wait a maximum of max_enable_time seconds until enabling
|
||||
if time.time() > now + max_enable_time:
|
||||
pytest.fail(f'Motor {self.pv} could not be enabled in {max_enable_time} seconds')
|
||||
time.sleep(0.1)
|
||||
|
||||
motor.move_and_wait(target)
|
||||
assert motor.at_target(target)
|
||||
assert not motor.has_error()
|
||||
7
tests/sinqMotor/turboPmac/reset.py
Normal file → Executable file
7
tests/sinqMotor/turboPmac/reset.py
Normal file → Executable file
@@ -9,20 +9,19 @@ def reset(motor, initpos=0):
|
||||
4) Moving to zero
|
||||
"""
|
||||
|
||||
# motor.write_field('stop', 1)
|
||||
motor.write_field('stop', 1)
|
||||
|
||||
# Reset any errors
|
||||
motor.write_field('reseterrorpv', 1)
|
||||
|
||||
# The reset may take some time -> Wait a bit
|
||||
time.sleep(1)
|
||||
time.sleep(2*motor.idlepoll)
|
||||
|
||||
if motor.read_field('enable_rbv') == 0:
|
||||
motor.write_field('enable', 1)
|
||||
|
||||
# Wait until the motor is enabled.
|
||||
now = time.time()
|
||||
max_enable_time = 5
|
||||
max_enable_time = 10
|
||||
while motor.read_field('enable_rbv') == 0:
|
||||
# Wait a maximum of max_enable_time seconds until enabling
|
||||
if time.time() > now + max_enable_time:
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
from tests.move import *
|
||||
from tests.sinqMotor.limits import *
|
||||
from tests.sinqMotor.turboPmac.common import *
|
||||
from tests.sinqMotor.turboPmac.reset import reset
|
||||
|
||||
def stop_reset_enable_move_sequence(motor):
|
||||
stop_reset_enable_move(motor, 5)
|
||||
|
||||
def test_move_to_low_limit_switch(motor):
|
||||
reset(motor)
|
||||
@@ -21,5 +24,11 @@ def test_stop(motor):
|
||||
reset(motor)
|
||||
stop(motor, 3000)
|
||||
|
||||
def test_stop_then_move(motor):
|
||||
reset(motor)
|
||||
stop_then_move(motor, 0)
|
||||
|
||||
|
||||
|
||||
#def test_reread_limits_from_hw(motor):
|
||||
# reread_limits_from_hw(motor)
|
||||
|
||||
Reference in New Issue
Block a user