started commissioning with hardware. first movements. added smaract to config

This commit is contained in:
Holler Mirko
2024-11-05 15:06:35 +01:00
committed by wakonig_k
parent dd2f20fba4
commit e03b3b84e0
5 changed files with 120 additions and 4 deletions
@@ -36,6 +36,46 @@ class OMNYError(Exception):
class OMNYInitStagesMixin:
def _omny_find_reference_loop(self, direction_endswitch, device, auto_retry=0):
retry_counter = 0
limits = device.get_motor_limit_switch()
if not limits[0] and not limits[1]:
raise OMNYInitError("Expect to be in a limit switch when calling find reference loop.")
if limits[0] and limits[1]:
raise OMNYInitError("Both limit switches are triggered. This indicates an error.")
if limits[0]:
direction_endswitch_start = "reverse"
if limits[1]:
direction_endswitch_start = "forward"
if direction_endswitch_start != direction_endswitch:
raise OMNYInitError("Expect current endswitch to match the call of the method.")
if device.axis_is_referenced():
raise OMNYInitError("This axis is already referenced")
while not device.axis_is_referenced():
device.find_reference()
time.sleep(1)
if not device.axis_is_referenced():
if auto_retry == 0:
user_input = input("Did not reference successfully. Try again to move to endswitch and find reference?")
if user_input == "y":
device.drive_axis_to_limit(direction_endswitch_start)
time.sleep(1)
elif auto_retry > 0:
if retry_counter < auto_retry:
print(f"Did not reference successfully. Try again to move to endswitch and find reference. Attempt {retry_counter+1} out of max {auto_retry}")
device.drive_axis_to_limit(direction_endswitch_start)
time.sleep(1)
retry_counter += 1
temperature = device.get_motor_temperature()
while temperature > 100:
print(f"The temperature of the motor is {temperature}, and larger than the threshold of 100 degC. Waiting 60 s for cool down.")
time.sleep(60)
temperature = device.get_motor_temperature()
def omny_init_stages(self):
user_input = input("Starting initialization of OMNY stages. OK? [y/n]")
@@ -315,7 +355,7 @@ class OMNYInitStagesMixin:
user_input = input("drive otransy stage to +Y limit?")
if user_input == "y":
dev.otransy.drive_axis_to_limit("forward")
print("otrany reached limit")
print("otransy reached limit")
else:
print("otransy is in upper limit, i.e. safe condition")
@@ -332,6 +372,10 @@ class OMNYInitStagesMixin:
dev.ocsx.limits = [-2, 5]
dev.ocsy.limits = [-1, 3]
dev.oshield.controller.set_closed_loop_move_speed(0,1)
dev.oshield.controller.set_closed_loop_move_speed(1,1)
dev.oshield.controller.set_closed_loop_move_speed(2,1)
user_input = input("Move CS out of the beam path?")
if user_input == "y":
umv(dev.ocsx, 5, dev.ocsy, 2)
+57 -1
View File
@@ -412,4 +412,60 @@ oeyey:
readOnly: false
readoutPriority: baseline
userParameter:
xray_in: 0
xray_in: 0
############################################################
#################### flOMNI Smaract motors #################
############################################################
ocsx:
description: Central Stop X
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
deviceConfig:
axis_Id: A
host: mpc3217.psi.ch
limits:
- -2
- 2
port: 3334
sign: -1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: baseline
userParameter:
nothing: 0
ocsy:
description: Central Stop Y
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
deviceConfig:
axis_Id: B
host: mpc3217.psi.ch
limits:
- -2
- 2
port: 3334
sign: -1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: baseline
userParameter:
nothing: 0
oshield:
description: Thermal Shield Sample Stage
deviceClass: csaxs_bec.devices.smaract.smaract_ophyd.SmaractMotor
deviceConfig:
axis_Id: C
host: mpc3217.psi.ch
limits:
- -14.5
- 15.8
port: 3334
sign: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: baseline
userParameter:
nothing: 0
@@ -160,6 +160,7 @@ class GalilController(Controller):
self.socket_put_confirmed("XQ#FES")
time.sleep(0.1)
while self.is_axis_moving(None, axis_Id_numeric):
print("waiting...")
time.sleep(0.01)
axis_Id = self.axis_Id_numeric_to_alpha(axis_Id_numeric)
@@ -171,6 +172,8 @@ class GalilController(Controller):
if not limit:
raise GalilError(f"Failed to drive axis {axis_Id}/{axis_Id_numeric} to limit.")
else:
print("Limit reached.")
def find_reference(self, axis_Id_numeric: int) -> None:
"""
+14 -2
View File
@@ -197,7 +197,7 @@ class OMNYGalilController(GalilController):
class OMNYGalilMotor(Device, PositionerBase):
USER_ACCESS = ["controller", "find_reference", "drive_axis_to_limit", "_ogalil_folerr_reset_and_ignore", "_ogalil_set_axis_to_pos_wo_reference_search", "get_motor_limit_switch"]
USER_ACCESS = ["controller", "find_reference", "drive_axis_to_limit", "_ogalil_folerr_reset_and_ignore", "_ogalil_set_axis_to_pos_wo_reference_search", "get_motor_limit_switch", "axis_is_referenced", "get_motor_temperature"]
readback = Cpt(OMNYGalilReadbackSignal, signal_name="readback", kind="hinted")
user_setpoint = Cpt(GalilSetpointSignal, signal_name="setpoint")
motor_resolution = Cpt(GalilMotorResolution, signal_name="resolution", kind="config")
@@ -420,7 +420,19 @@ class OMNYGalilMotor(Device, PositionerBase):
"""
Get status of the motor limit switches
"""
self.controller.get_motor_limit_switch(self.axis_Id)
return self.controller.get_motor_limit_switch(self.axis_Id)
def get_motor_temperature(self) -> float:
"""
Get motor temperature
"""
return self.controller.motor_temperature(self.axis_Id_numeric)
def axis_is_referenced(self) -> bool:
"""
check if an axis is referenced
"""
return self.controller.axis_is_referenced(self.axis_Id_numeric)
def stop(self, *, success=False):
self.controller.stop_all_axes()
@@ -80,6 +80,7 @@ class SmaractController(Controller):
"describe",
"axis_is_referenced",
"all_axes_referenced",
"set_closed_loop_move_speed",
]
def __init__(