From 5f90b32210f2cb565f47d35514e1b88a98e7ce17 Mon Sep 17 00:00:00 2001 From: Holler Mirko Date: Thu, 29 Aug 2024 15:04:22 +0200 Subject: [PATCH] started commissioning of sample transfer. shuttle align, open and close --- .../omny/omny_sample_transfer_mixin.py | 70 +++++++++++-------- .../startup/post_startup.py | 1 - 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/omny/omny_sample_transfer_mixin.py b/csaxs_bec/bec_ipython_client/plugins/omny/omny_sample_transfer_mixin.py index 2212b94..a9300cf 100644 --- a/csaxs_bec/bec_ipython_client/plugins/omny/omny_sample_transfer_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/omny/omny_sample_transfer_mixin.py @@ -50,6 +50,7 @@ class OMNYSampleTransferMixin: searchwrongendswitch=0 while searchwrongendswitch<100 and not dev.oshuttlealign.get_motor_limit_switch()[0]: dev.oshuttlealign.socket_put_confirmed("PRH=200") + time.sleep(0.01) dev.oshuttlealign.socket_put_confirmed(1,"BGH") while(self._otransfer_wait_aligner_movement()==1): time.sleep(0.2) @@ -106,7 +107,7 @@ class OMNYSampleTransferMixin: #ensure aligner is in down position #if (!_ogalil_high_limit_set(1,7)) #{ - #print("Strange, the aligner is not in the down position. Moving down.\n") + #print("Strange, the aligner is not in the down position. Moving down.") #_ogalil_drive_to_limit(1,7,1) #} #sleep(0.1) @@ -125,11 +126,11 @@ class OMNYSampleTransferMixin: if not dev.oshuttlealign.get_motor_limit_switch()[0]: print("Not in correct start position for alignment.") dev.oshuttlealign.controller.socket_put_confirmed("MO") - user_input = input("Shall I try to move it to the correct start position? Do this only once! [y/n]") - if user_input == "y": + if self.OMNYTools.yesno("Shall I try to move it to the correct start position? Do this only once!"): print("starting...") dev.oshuttlealign.controller.socket_put_confirmed("SHH") dev.oshuttlealign.controller.socket_put_confirmed("PRH=200") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("LDH=1") dev.oshuttlealign.controller.socket_put_confirmed("BGH") time.sleep(1) @@ -150,6 +151,7 @@ class OMNYSampleTransferMixin: dev.oshuttlealign.controller.socket_put_confirmed("DCH=60000") dev.oshuttlealign.controller.socket_put_confirmed("PRH=-5000") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("BGH") while(self._otransfer_wait_aligner_movement()==True): time.sleep(0.2) @@ -164,22 +166,28 @@ class OMNYSampleTransferMixin: # movements for alignment and down again dev.oshuttlealign.controller.socket_put_confirmed("PRH=-19500") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("BGH") while(self._otransfer_wait_aligner_movement()==True): time.sleep(0.2) time.sleep(0.5) dev.oshuttlealign.controller.socket_put_confirmed("PRH=3000") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("BGH") while(self._otransfer_wait_aligner_movement()==True): time.sleep(0.2) time.sleep(0.5) dev.oshuttlealign.controller.socket_put_confirmed("PRH=-3000") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("BGH") + time.sleep(0.01) while(self._otransfer_wait_aligner_movement()==True): time.sleep(0.2) time.sleep(0.5) dev.oshuttlealign.controller.socket_put_confirmed("PRH=23500") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("BGH") + time.sleep(0.01) while(self._otransfer_wait_aligner_movement()==True): time.sleep(0.2) #_ogalil_put_confirmed( 1,"MOH") @@ -189,20 +197,22 @@ class OMNYSampleTransferMixin: searchwrongendswitch=0 #_ogalil_put_confirmed( 1,"SHH") - while searchwrongendswitch<10 and dev.oshuttlealign.get_motor_limit_switch()[0] == False: + while searchwrongendswitch<22 and dev.oshuttlealign.get_motor_limit_switch()[0] == False: dev.oshuttlealign.controller.socket_put_confirmed("PRH=200") + time.sleep(0.01) dev.oshuttlealign.controller.socket_put_confirmed("BGH") + time.sleep(0.01) while(self._otransfer_wait_aligner_movement()==True): time.sleep(0.2) searchwrongendswitch+=1 if dev.oshuttlealign.get_motor_limit_switch()[0]: - print("Aligner is back down.\n") + print("Aligner is back down.") dev.oshuttlealign.controller.socket_put_confirmed("MOH") #todo #_otransfer_shuttle_was_aligned=1 - if not dev.oshuttlealign.get_motor_limit_switch()[1]: + if not dev.oshuttlealign.get_motor_limit_switch()[0]: raise OMNYTransferError("The shuttle aligner did not move back.") def _otransfer_shield_open(self, pin_position): @@ -339,17 +349,17 @@ class OMNYSampleTransferMixin: def _otransfer_gripper_to_park_z(self): if not self._otransfer_gripper_querry_status_closed(): - user_input = input("The gripper appears to be open, while it was expected to be closed.May it be closed now? (y/n)") - if user_input == "y": + if self.OMNYTools.yesno("The gripper appears to be open, while it was expected to be closed.May it be closed now?","y"): dev.otransy.controller.socket_put_confirmed("XQ#GRCLOS") time.sleep(0.5) if not dev.otransx.controller.all_axes_referenced(): raise OMNYTransferError("Not all axes are referenced.") - if np.fabs(dev.otransx.get().readback-20<0.1) and dev.otransy.get().readback>-2 and np.fabs(dev.otransz.get().readback+50)<0.1: + if np.fabs(dev.otransx.get().readback-20)<0.1 and dev.otransy.get().readback>-2 and np.fabs(dev.otransz.get().readback+50)<0.1: print("Gripper is in parking position") else: + print("Gripper is not yet in parking position. Moving...") self._otransfer_gripper_up() #if coming from a position beyond a shuttle in parking station @@ -379,11 +389,11 @@ class OMNYSampleTransferMixin: _omny_oeye_xray_iny = self._get_user_param_safe("oeyey", "xray_in") self._oeyey_mv(_omny_oeye_xray_iny) umv(dev.otransx, -100, dev.oeyex, _omny_oeye_xray_inx, dev.oeyez, -2) + else: + umv(dev.otransx, -100) else: + self._oshield_ST_close() umv(dev.otransx, -100) - else: - self._oshield_ST_close() - umv(dev.otransx, -100) #if process was aborted while moving to ST if dev.otransx.get().readback < -105: @@ -667,7 +677,7 @@ class OMNYSampleTransferMixin: input("Ready. Press Enter to start the mount process now...") dev.otransy.controller.socket_put_confirmed("XQ#GRPUT") - print("The mount process started.\n") + print("The mount process started.") self._otransfer_confirm() self._otransfer_controller_disable_mount_mode() @@ -751,7 +761,7 @@ class OMNYSampleTransferMixin: dev.otransy.controller.socket_put_confirmed("XQ#GRGET") - print("The Unmount process started.\n") + print("The Unmount process started.") self._otransfer_confirm() self._otransfer_controller_disable_mount_mode() @@ -842,7 +852,7 @@ class OMNYSampleTransferMixin: def _otransfer_stage_to_FZP(self): - raise OMNYTransferError("This routine needs commissioning after park pos of gripper and new transfer stages changed.\n") + raise OMNYTransferError("This routine needs commissioning after park pos of gripper and new transfer stages changed.") # print("Please confirm that the npoint piezo controller is off. y/n.") # if(!yesno(1)) @@ -882,10 +892,10 @@ class OMNYSampleTransferMixin: def _otransfer_stage_to_OSA(self): - raise OMNYTransferError("This routine needs commissioning after park pos of gripper and new transfer stages changed.\n") + raise OMNYTransferError("This routine needs commissioning after park pos of gripper and new transfer stages changed.") # if(A[ofzpz]>40) { - # print("The FZP stage is too close in z direction. Please move it to at least 60 mm or less upstream.\n") + # print("The FZP stage is too close in z direction. Please move it to at least 60 mm or less upstream.") # exit # } @@ -907,7 +917,7 @@ class OMNYSampleTransferMixin: # umv otransz -55.6013 # if(fabs(A[ofzpz]-77.7)>0.1) # { - # print("FZP did not reach target position. Potentially the motor is too hot.\n") + # print("FZP did not reach target position. Potentially the motor is too hot.") # exit # } @@ -1019,13 +1029,13 @@ class OMNYSampleTransferMixin: # } # else # { - # print("There is no FZP available.\n") + # print("There is no FZP available.") # return(0) # } # } # else # { - # print("There is no FZP shuttle installed at the current parkz position.\n") + # print("There is no FZP shuttle installed at the current parkz position.") # return(0) # } # } @@ -1054,13 +1064,13 @@ class OMNYSampleTransferMixin: # } # else # { - # print("There is no OSA available.\n") + # print("There is no OSA available.") # return(0) # } # } # else # { - # print("There is no OSA shuttle installed at the current parkz position.\n") + # print("There is no OSA shuttle installed at the current parkz position.") # return(0) # } # } @@ -1131,7 +1141,7 @@ class OMNYSampleTransferMixin: # { } # else # { - # print("There is a sample pin in the gripper, which is not compatible with position %d\n", _osampleposition) + # print("There is a sample pin in the gripper, which is not compatible with position %d", _osampleposition) # exit # } # #FZP holder @@ -1140,7 +1150,7 @@ class OMNYSampleTransferMixin: # { } # else # { - # print("There is a FZP holder in the gripper, which is not compatible with position %d\n", _osampleposition) + # print("There is a FZP holder in the gripper, which is not compatible with position %d", _osampleposition) # exit # } # #OSA holder @@ -1149,7 +1159,7 @@ class OMNYSampleTransferMixin: # { } # else # { - # print("There is an OSA holder in the gripper, which is not compatible with position %d\n", _osampleposition) + # print("There is an OSA holder in the gripper, which is not compatible with position %d", _osampleposition) # exit # } @@ -1199,13 +1209,13 @@ class OMNYSampleTransferMixin: # } # else # { - # print("There is no free FZP position available.\n") + # print("There is no free FZP position available.") # return(0) # } # } # else # { - # print("There is no FZP shuttle installed at the current parkz position.\n") + # print("There is no FZP shuttle installed at the current parkz position.") # return(0) # } # } @@ -1234,13 +1244,13 @@ class OMNYSampleTransferMixin: # } # else # { - # print("There is no free OSA position available.\n") + # print("There is no free OSA position available.") # return(0) # } # } # else # { - # print("There is no OSA shuttle installed at the current parkz position.\n") + # print("There is no OSA shuttle installed at the current parkz position.") # return(0) # } # } @@ -1255,7 +1265,7 @@ class OMNYSampleTransferMixin: dev.omny_samples.unset_sample_in_gripper() return True else: - print("There is no free space at this position.\n") + print("There is no free space at this position.") return False #sample stage diff --git a/csaxs_bec/bec_ipython_client/startup/post_startup.py b/csaxs_bec/bec_ipython_client/startup/post_startup.py index 9632da9..4f7c6aa 100644 --- a/csaxs_bec/bec_ipython_client/startup/post_startup.py +++ b/csaxs_bec/bec_ipython_client/startup/post_startup.py @@ -62,7 +62,6 @@ bec._beamline_mixin._bl_info_register(OperatorInfo) bec._ip.prompts.username = _session_name bec._ip.prompts.status = 1 - # REGISTER BEAMLINE CHECKS from bec_lib.bl_conditions import ( FastOrbitFeedbackCondition,