added cameras plus some fixes

This commit is contained in:
Holler Mirko
2024-11-05 13:37:14 +01:00
committed by wakonig_k
parent c9536d9380
commit 41d574253e
7 changed files with 161 additions and 43 deletions
@@ -19,6 +19,9 @@ from csaxs_bec.bec_ipython_client.plugins.omny.omny_sample_transfer_mixin import
from csaxs_bec.bec_ipython_client.plugins.omny.omny_rt import OMNY_rt_client
from csaxs_bec.bec_ipython_client.plugins.omny.x_ray_eye_align import XrayEyeAlign
from bec_widgets.cli.client import BECDockArea as _BECDockArea
logger = bec_logger.logger
if builtins.__dict__.get("bec") is not None:
@@ -543,6 +546,26 @@ class OMNY(
self.OMNYTools = OMNYTools(self.client)
OMNY_rt_client.__init__(self)
self.align = XrayEyeAlign(self.client, self)
self.gui = getattr(client, 'gui',None)
self.fig = None
def start_gui(self):
if self.gui is None:
self.gui = _BECDockArea()
self.gui.show()
def stop_gui(self):
if self.gui is not None:
self.fig = None
self.gui.close()
self.gui = None
def add_image_dock(self):
self.fig = self.gui.add_dock(name="cam1").add_widget("BECImageWidget")
self.fig.image("cam200")
self.fig.set_rotation(3)
#self.gui.remove_dock(dock_name="Waveform Dock")
def start_x_ray_eye_alignment(self):
if self.OMNYTools.yesno(
@@ -192,7 +192,7 @@ class OMNYAlignmentMixin:
print(
f"Loading default mirror correction from file {correction_file} containing {int_num_elements} elements."
)
print(corr_pos)
#print(corr_pos)
return corr_pos, corr_angle
def read_additional_correction_x(self, correction_file: str):
@@ -306,7 +306,7 @@ class OMNYOpticsMixin:
def ffzp_info(self, mokev_val=-1, ofzpz_val=-1):
def ofzp_info(self, mokev_val=-1, ofzpz_val=-1):
print(f"{ofzpz_val}")
if mokev_val == -1:
@@ -142,6 +142,8 @@ class OMNY_rt_client:
self.mirror_amplitutde_increase = 0
dev.rtx.controller.show_signal_strength_interferometer()
def show_signal_strength_interferometer(self):
dev.rtx.controller.show_signal_strength_interferometer()
def omny_interferometer_align_incoupling_angle(self):
dev.rtx.controller.omny_interferometer_align_incoupling_angle()
@@ -33,6 +33,11 @@ class OMNYSampleTransferMixin:
self.shuttle_was_aligned[5]=False
self.shuttle_was_aligned[6]=False
self.fig200 = None
self.fig201 = None
self.fig202 = None
self.fig203 = None
@staticmethod
@@ -94,10 +99,98 @@ class OMNYSampleTransferMixin:
raise OMNYTransferError("The shuttle did not close.")
def _omnycam_parking(self):
pass
if self.fig200 is None:
self._omnycam_clear()
self.fig200 = self.gui.add_dock(name="omnycam200").add_widget("BECImageWidget")
if self._omnycam_check_device_exists(dev.cam200):
self.fig200.image("cam200")
time.sleep(0.3)
try:
self.fig200.set_rotation(deg_90=3)
except:
time.sleep(0.2)
self.fig200.set_rotation(deg_90=3)
self.fig200.lock_aspect_ratio(True)
else:
print("Cannot open cam200. Device does not exist.")
self.fig203 = self.gui.add_dock(name="omnycam203").add_widget("BECImageWidget")
if self._omnycam_check_device_exists(dev.cam203):
self.fig203.image("cam203")
time.sleep(0.3)
try:
self.fig203.set_rotation(deg_90=3)
except:
time.sleep(0.2)
self.fig203.set_rotation(deg_90=3)
self.fig203.lock_aspect_ratio(True)
else:
print("Cannot open cam203. Device does not exist.")
try:
self.gui.remove_dock(name="default_figure")
except:
pass
def _omnycam_samples(self):
pass
def _omnycam_clear(self):
try:
self.gui.remove_dock(name="omnycam200")
except:
pass
try:
self.gui.remove_dock(name="omnycam201")
except:
pass
try:
self.gui.remove_dock(name="omnycam202")
except:
pass
try:
self.gui.remove_dock(name="omnycam203")
except:
pass
self.fig200 = None
self.fig201 = None
self.fig202 = None
self.fig203 = None
def _omnycam_check_device_exists(self,device):
try:
device
except:
return False
else:
return True
def _omnycam_samplestage(self):
if self.fig201 is None:
self._omnycam_clear()
self.fig201 = self.gui.add_dock(name="omnycam201").add_widget("BECImageWidget")
if self._omnycam_check_device_exists(dev.cam201):
self.fig201.image("cam201")
time.sleep(0.3)
try:
self.fig201.set_rotation(deg_90=3)
except:
time.sleep(0.2)
self.fig201.set_rotation(deg_90=3)
self.fig201.lock_aspect_ratio(True)
else:
print("Cannot open cam201. Device does not exist.")
if self._omnycam_check_device_exists(dev.cam202):
self.fig202 = self.gui.add_dock(name="omnycam202").add_widget("BECImageWidget")
self.fig202.image("cam202")
time.sleep(0.3)
try:
self.fig202.set_rotation(deg_90=3)
except:
time.sleep(0.2)
self.fig202.set_rotation(deg_90=3)
self.fig202.lock_aspect_ratio(True)
else:
print("Cannot open cam202. Device does not exist.")
try:
self.gui.remove_dock(name="default_figure")
except:
pass
def _otransfer_shuttle_align(self):
_active_shuttle_pos = self._oparkz_slot_check()
@@ -683,7 +776,7 @@ class OMNYSampleTransferMixin:
# global _ogalil_encoder_steps_per_mm
if pin_position==0:
self._omnycam_samples()
self._omnycam_samplestage()
else:
self._omnycam_parking()
@@ -772,7 +865,7 @@ class OMNYSampleTransferMixin:
if pin_position==0 or pin_position==100:
# oeye_cam_in
self._omnycam_samples()
self._omnycam_samplestage()
# if (_rt_status_feedback() == 0) {
# print("May the feedback be disabled? Y/n?")
# if(!yesno(1))
@@ -1315,9 +1408,9 @@ class OMNYSampleTransferMixin:
def otransfer_help(self):
print("omny.transfer.otransfer_park_slot(slot) drive the parking station to transfer from <slot> with the gripper")
print("omny.transfer.otransfer_park_loadlock_slot(slot) drive the parking station to transfer from <slot> with the loadlock")
print("omny.transfer.otransfer_get_sample(position) pick with the gripper from <position>")
print("omny.transfer.otransfer_put_sample(position) put with the gripper to <position>")
print("omny.otransfer_park_slot(slot) drive the parking station to transfer from <slot> with the gripper")
print("omny.otransfer_park_loadlock_slot(slot) drive the parking station to transfer from <slot> with the loadlock")
print("omny.otransfer_get_sample(position) pick with the gripper from <position>")
print("omny.otransfer_put_sample(position) put with the gripper to <position>")
print("To modify the storage information see dev.omny_samples.help()")
+30 -30
View File
@@ -1,6 +1,6 @@
############################################################
#################### IDS Camera ######################
############################################################
# ############################################################
# #################### IDS Camera ######################
# ############################################################
cam200:
description: Camera200
deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
@@ -27,35 +27,35 @@ cam201:
readOnly: false
readoutPriority: async
# cam202:
# description: Camera202
# deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
# deviceConfig:
# camera_ID: 202
# bits_per_pixel: 24
# channels: 3
# m_n_colormode: 1
# enabled: true
# onFailure: buffer
# readOnly: false
# readoutPriority: async
cam202:
description: Camera202
deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
deviceConfig:
camera_ID: 202
bits_per_pixel: 24
channels: 3
m_n_colormode: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: async
# cam203:
# description: Camera203
# deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
# deviceConfig:
# camera_ID: 203
# bits_per_pixel: 24
# channels: 3
# m_n_colormode: 1
# enabled: true
# onFailure: buffer
# readOnly: false
# readoutPriority: async
cam203:
description: Camera203
deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
deviceConfig:
camera_ID: 203
bits_per_pixel: 24
channels: 3
m_n_colormode: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: async
# ############################################################
# #################### flOMNI RT motors ######################
# ############################################################
############################################################
#################### OMNY RT motors ########################
############################################################
rtx:
description: OMNY rt
+2 -2
View File
@@ -187,7 +187,7 @@ class GalilController(Controller):
while self.is_axis_moving(None, axis_Id_numeric):
time.sleep(0.01)
if verbose:
self.get_device_manager().connector.send_client_info(f"Current microstep position {self._omny_get_microstep_position(axis_Id)}", scope="drive axis to limit", show_asap=True)
self.get_device_manager().connector.send_client_info(f"Current microstep position {self._omny_get_microstep_position(axis_Id):.0f}", scope="drive axis to limit", show_asap=True)
time.sleep(0.5)
# check if we actually hit the limit
@@ -224,7 +224,7 @@ class GalilController(Controller):
while self.is_axis_moving(None, axis_Id_numeric):
time.sleep(0.1)
if verbose:
self.get_device_manager().connector.send_client_info(f"Current microstep position {self._omny_get_microstep_position(axis_Id)} reference is before {self._omny_get_reference_limit(axis_Id)}", scope="find axis reference", show_asap=True)
self.get_device_manager().connector.send_client_info(f"Current microstep position {self._omny_get_microstep_position(axis_Id):.0f} reference is before {self._omny_get_reference_limit(axis_Id)}", scope="find axis reference", show_asap=True)
time.sleep(0.5)
if not self.axis_is_referenced(axis_Id_numeric):