continue init script of omny, various mods in galil

This commit is contained in:
Holler Mirko
2024-07-04 10:56:26 +02:00
committed by wakonig_k
parent f3d2100b03
commit c7f9d37c12
5 changed files with 61 additions and 7 deletions

View File

@@ -129,8 +129,16 @@ class OMNYInitStagesMixin:
dev.oeyex.limits = [-47, 10]
dev.oeyez.limits = [-85, 10]
user_input = input("find reference mark of oeyey?")
if user_input == "y":
dev.oeyez.drive_axis_to_limit("forward")
dev.oeyey.controller.socket_put_confirmed(""indspeed[7]=2000"")
dev.oeyey.find_reference()
dev.oeyey.limits = [-61, 1]
#ensure closed shuttle and shuttle aligner down
if not dev.oshuttleopen.get_motor_limit_switch()[0]:
dev.oshuttleopen.drive_axis_to_limit("reverse")

View File

@@ -141,7 +141,7 @@ class FlomniGalilAxesReferenced(GalilAxesReferenced):
class FlomniGalilMotor(Device, PositionerBase):
USER_ACCESS = ["controller"]
USER_ACCESS = ["controller", "drive_axis_to_limit"]
readback = Cpt(FlomniGalilReadbackSignal, signal_name="readback", kind="hinted")
user_setpoint = Cpt(FlomniGalilSetpointSignal, signal_name="setpoint")
motor_resolution = Cpt(FlomniGalilMotorResolution, signal_name="resolution", kind="config")
@@ -337,6 +337,18 @@ class FlomniGalilMotor(Device, PositionerBase):
def unstage(self) -> list[object]:
return super().unstage()
def drive_axis_to_limit(self, direction: str) -> None:
"""
Drive an axis to the limit in a specified direction.
Args:
direction (str): Direction in which the axis should be driven to the limit. Either 'forward' or 'reverse'.
"""
self.controller.drive_axis_to_limit(self.axis_Id_numeric, direction)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())
def stop(self, *, success=False):
self.controller.stop_all_axes()
return super().stop(success=success)

View File

@@ -171,8 +171,6 @@ class GalilController(Controller):
if not limit:
raise GalilError(f"Failed to drive axis {axis_Id}/{axis_Id_numeric} to limit.")
else:
print(f"Axis {}")
def find_reference(self, axis_Id_numeric: int) -> None:
"""

View File

@@ -19,7 +19,6 @@ from csaxs_bec.devices.omny.galil.galil_ophyd import (
GalilSetpointSignal,
GalilSignalRO,
retry_once,
)
logger = bec_logger.logger
@@ -101,7 +100,7 @@ class LamniGalilReadbackSignal(GalilSignalRO):
return val
class LamniGalilMotor(Device, PositionerBase):
USER_ACCESS = ["controller"]
USER_ACCESS = ["controller", "drive_axis_to_limit", "find_reference"]
readback = Cpt(LamniGalilReadbackSignal, signal_name="readback", kind="hinted")
user_setpoint = Cpt(GalilSetpointSignal, signal_name="setpoint")
motor_resolution = Cpt(GalilMotorResolution, signal_name="resolution", kind="config")
@@ -288,6 +287,27 @@ class LamniGalilMotor(Device, PositionerBase):
"""The engineering units (EGU) for positions"""
return "mm"
def find_reference(self):
"""
Find the reference of the axis.
"""
self.controller.find_reference(self.axis_Id_numeric)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())
def drive_axis_to_limit(self, direction: str) -> None:
"""
Drive an axis to the limit in a specified direction.
Args:
direction (str): Direction in which the axis should be driven to the limit. Either 'forward' or 'reverse'.
"""
self.controller.drive_axis_to_limit(self.axis_Id_numeric, direction)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())
def stop(self, *, success=False):
self.controller.stop_all_axes()
return super().stop(success=success)

View File

@@ -160,6 +160,7 @@ class OMNYGalilController(GalilController):
self._ogalil_folerr_not_ignore()
def _ogalil_folerr_not_ignore(self):
self.socket_put_confirmed("IgNoFol=0")
@@ -196,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"]
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"]
readback = Cpt(OMNYGalilReadbackSignal, signal_name="readback", kind="hinted")
user_setpoint = Cpt(GalilSetpointSignal, signal_name="setpoint")
motor_resolution = Cpt(GalilMotorResolution, signal_name="resolution", kind="config")
@@ -390,12 +391,18 @@ class OMNYGalilMotor(Device, PositionerBase):
def _ogalil_set_axis_to_pos_wo_reference_search(self, pos_mm):
motor_resolution = self.motor_resolution.get()
self.controller._ogalil_set_axis_to_pos_wo_reference_search(self.axis_Id_numeric, self.axis_Id, pos_mm, motor_resolution, self.sign)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())
def find_reference(self):
"""
Find the reference of the axis.
"""
self.controller.find_reference(self.axis_Id_numeric)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())
def drive_axis_to_limit(self, direction: str) -> None:
"""
@@ -405,6 +412,15 @@ class OMNYGalilMotor(Device, PositionerBase):
direction (str): Direction in which the axis should be driven to the limit. Either 'forward' or 'reverse'.
"""
self.controller.drive_axis_to_limit(self.axis_Id_numeric, direction)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())
def get_motor_limit_switch(self) -> list:
"""
Get status of the motor limit switches
"""
self.controller.get_motor_limit_switch(self.axis_Id)
def stop(self, *, success=False):
self.controller.stop_all_axes()