diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py index 8502028..fb44267 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py @@ -22,6 +22,7 @@ class LaMNIInitStagesMixin: user_input = input("Starting initialization of LamNI stages. OK? [y/n]") if user_input == "y": print("staring...") + dev.lsamrot.enabled=True else: return @@ -41,38 +42,44 @@ class LaMNIInitStagesMixin: return self.drive_axis_to_limit(dev.lsamrot, "forward") + dev.lsamrot.enabled=False print("Now hard reboot the controller and run the initialization routine again.") + print("The controller will be disabled in bec. To enable dev.lsamrot.enabled=True") return user_input = input( - "Init of lopty. Can the stage move to the upstream limit without collision?? [y/n]" + "Init of loptz. Can the stage move to the upstream limit without collision?? [y/n]" ) if user_input == "y": print("ok then...") else: return + print("Referencing loptz") self.drive_axis_to_limit(dev.loptz, "forward") - self.find_reference_mark("loptz") + self.find_reference_mark(dev.loptz) + print("Referencing loptx") self.drive_axis_to_limit(dev.loptx, "reverse") - self.find_reference_mark("loptx") + self.find_reference_mark(dev.loptx) + print("Referencing lopty") self.drive_axis_to_limit(dev.lopty, "forward") - self.find_reference_mark("lopty") + self.find_reference_mark(dev.lopty) + print("Referencing lsamx") self.drive_axis_to_limit(dev.lsamx, "forward") - self.find_reference_mark("lsamx") + self.find_reference_mark(dev.lsamx) + print("Referencing lsamy") self.drive_axis_to_limit(dev.lsamy, "reverse") - self.find_reference_mark("lsamy") + self.find_reference_mark(dev.lsamy) # the dual encoder requires the reference mark to pass on both encoders + print("Referencing lsamrot") self.drive_axis_to_limit(dev.lsamrot, "reverse") time.sleep(0.1) - self.drive_axis_to_limit(dev.lsamrot, "forward") - time.sleep(0.1) - self.find_reference_mark("lsamrot") + self.find_reference_mark(dev.lsamrot) user_input = input("Init of leye. Can the stage move to -x limit without collision? [y/n]") if user_input == "y": @@ -80,7 +87,9 @@ class LaMNIInitStagesMixin: else: return + print("Referencing leyex") self.drive_axis_to_limit(dev.leyex, "forward") + print("Referencing leyey") self.drive_axis_to_limit(dev.leyey, "forward") # set_lm lsamx 6 14 diff --git a/csaxs_bec/devices/galil/galil_ophyd.py b/csaxs_bec/devices/galil/galil_ophyd.py index 6a0aec5..dea8ce6 100644 --- a/csaxs_bec/devices/galil/galil_ophyd.py +++ b/csaxs_bec/devices/galil/galil_ophyd.py @@ -169,8 +169,10 @@ class GalilController(Controller): Args: axis_Id_numeric (int): Axis number """ + time.sleep(0.1) self.socket_put_confirmed(f"naxis={axis_Id_numeric}") self.socket_put_and_receive("XQ#NEWPAR") + time.sleep(0.1) self.socket_put_confirmed("XQ#FRM") time.sleep(0.1) while self.is_axis_moving(None, axis_Id_numeric): @@ -334,12 +336,16 @@ class GalilSetpointSignal(GalilSignalBase): time.sleep(0.1) if self.parent.axis_Id_numeric == 2: - angle_status = self.parent.device_manager.devices[ - self.parent.rt - ].obj.controller.feedback_status_angle_lamni() - - if angle_status: - self.controller.socket_put_confirmed("angintf=1") + try: + rt = self.parent.device_manager.devices[self.parent.rt] + if rt.enabled: + angle_status = self.parent.device_manager.devices[ + self.parent.rt + ].obj.controller.feedback_status_angle_lamni() + if angle_status: + self.controller.socket_put_confirmed("angintf=1") + except KeyError: + logger.warning("RT is disabled. Failed to update RT angle interferometer status to galil.") self.controller.socket_put_confirmed(f"naxis={self.parent.axis_Id_numeric}") self.controller.socket_put_confirmed(f"ntarget={target_val:.3f}")