interferometer feedback running

This commit is contained in:
Holler Mirko
2024-09-27 12:38:09 +02:00
committed by wakonig_k
parent cb16dcfb4c
commit a8cc2bcbe0
5 changed files with 140 additions and 126 deletions
@@ -388,8 +388,15 @@ class OMNY_rt_client:
self.mirror_channel=-1
def omny_interferometer_tweak_otrack(self):
self.OMNYTools.tweak_cursor(dev.otracky,.1,dev.otrackz,.1,special_command=dev.rtx.controller.laser_tracker_print_intensity_for_otrack_tweaking)
self.OMNYTools.tweak_cursor(dev.otrackz,.1,dev.otracky,.1,special_command=dev.rtx.controller.laser_tracker_print_intensity_for_otrack_tweaking)
def feedback_enable(self):
dev.rtx.controller._feedback_enable_with_reset_part1()
self.omny_interferometer_align_tracking()
dev.rtx.controller._feedback_enable_with_reset_part2()
def feedback_disable(self):
dev.rtx.controller.feedback_disable()
def omny_interferometer_align_tracking(self):
self.mirror_channel=6
+90 -90
View File
@@ -1,104 +1,104 @@
############################################################
#################### IDS Camera ######################
############################################################
cam200:
description: Camera200
deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
deviceConfig:
camera_ID: 200
bits_per_pixel: 24
channels: 3
m_n_colormode: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: async
# cam200:
# description: Camera200
# deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
# deviceConfig:
# camera_ID: 200
# bits_per_pixel: 24
# channels: 3
# m_n_colormode: 1
# enabled: true
# onFailure: buffer
# readOnly: false
# readoutPriority: async
cam201:
description: Camera201
deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
deviceConfig:
camera_ID: 201
bits_per_pixel: 24
channels: 3
m_n_colormode: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: async
# cam201:
# description: Camera201
# deviceClass: csaxs_bec.devices.ids_cameras.ids_camera.IDSCamera
# deviceConfig:
# camera_ID: 201
# 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
# 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 ######################
# ############################################################
# rtx:
# description: OMNY rt
# deviceClass: csaxs_bec.devices.omny.rt.rt_omny_ophyd.RtOMNYMotor
# deviceConfig:
# axis_Id: A
# host: mpc3217.psi.ch
# port: 3333
# sign: 1
# enabled: true
# onFailure: buffer
# readOnly: false
# readoutPriority: on_request
# userParameter:
# low_signal: 11000
# min_signal: 10000
# rt_pid_voltage: -0.06219
# rty:
# description: OMNY rt
# deviceClass: csaxs_bec.devices.omny.rt.rt_omny_ophyd.RtOMNYMotor
# deviceConfig:
# axis_Id: B
# host: mpc3217.psi.ch
# port: 3333
# sign: 1
# enabled: true
# onFailure: buffer
# readOnly: false
# readoutPriority: on_request
# userParameter:
# tomo_additional_offsety: 0
# rtz:
# description: OMNY rt
# deviceClass: csaxs_bec.devices.omny.rt.rt_omny_ophyd.RtOMNYMotor
# deviceConfig:
# axis_Id: C
# host: mpc3217.psi.ch
# port: 3333
# sign: 1
# enabled: true
# onFailure: buffer
# readOnly: false
# readoutPriority: on_request
rtx:
description: OMNY rt
deviceClass: csaxs_bec.devices.omny.rt.rt_omny_ophyd.RtOMNYMotor
deviceConfig:
axis_Id: A
host: mpc3217.psi.ch
port: 3333
sign: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: on_request
userParameter:
low_signal: 11000
min_signal: 10000
rt_pid_voltage: -0.06219
rty:
description: OMNY rt
deviceClass: csaxs_bec.devices.omny.rt.rt_omny_ophyd.RtOMNYMotor
deviceConfig:
axis_Id: B
host: mpc3217.psi.ch
port: 3333
sign: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: on_request
userParameter:
tomo_additional_offsety: 0
rtz:
description: OMNY rt
deviceClass: csaxs_bec.devices.omny.rt.rt_omny_ophyd.RtOMNYMotor
deviceConfig:
axis_Id: C
host: mpc3217.psi.ch
port: 3333
sign: 1
enabled: true
onFailure: buffer
readOnly: false
readoutPriority: on_request
# ############################################################
# ##################### OMNY samples #########################
+1 -1
View File
@@ -92,7 +92,7 @@ class LamniGalilReadbackSignal(GalilSignalRO):
val = super().read()
if self.parent.axis_Id_numeric == 2:
try:
rt = self.parent.device_manager.devices[self.parent.rt]
rt = self.parent.device_manager.devices[self.parent.rtx]
if rt.enabled:
rt.obj.controller.set_rotation_angle(val[self.parent.name]["value"])
except KeyError:
+1 -1
View File
@@ -73,7 +73,7 @@ class OMNYGalilReadbackSignal(GalilSignalRO):
#if reading rotation stage angle
if self.parent.axis_Id_numeric == 2 and self.sock.port == 8083:
try:
rt = self.parent.device_manager.devices[self.parent.rt]
rt = self.parent.device_manager.devices["rtx"]
if rt.enabled:
rt.obj.controller.set_rotation_angle(val[self.parent.name]["value"])
except KeyError:
+40 -33
View File
@@ -46,7 +46,8 @@ class RtOMNYController(Controller):
"socket_put_and_receive",
"set_rotation_angle",
"feedback_disable",
"feedback_enable_with_reset",
"_feedback_enable_with_reset_part1",
"_feedback_enable_with_reset_part2",
"feedback_is_running",
"add_pos_to_scan",
"get_pid_x",
@@ -156,7 +157,9 @@ class RtOMNYController(Controller):
return False
return True
def feedback_enable_with_reset(self):
def _feedback_enable_with_reset_part1(self):
self.get_device_manager().connector.send_client_info(f"Enabling the feedback...", scope="", show_asap=True)
self.socket_put("J0") # disable feedback
self.move_to_zero()
@@ -165,12 +168,12 @@ class RtOMNYController(Controller):
self.laser_tracker_on()
self.laser_tracker_wait_on_target()
# move to 0 (which is -25). rt will set the rotation angle during readout maybe needed syntax fsamx = self.get_device_manager().devices.fsamx
dev.osamroy.read(cached=False)
if (dev.osamroy.get().readback - 25 > 0.1):
self.get_device_manager().devices.osamroy.obj.move(-25, wait=True)
osamroy = self.get_device_manager().devices.osamroy
# the following read will also upate the angle in rt during readout
readback = osamroy.obj.readback.get()
if (np.fabs(readback + 25) > 0.1):
self.get_device_manager().connector.send_client_info(f"Rotating to zero", scope="feedback enable", show_asap=True)
osamroy.obj.move(-25, wait=True)
osamx = self.get_device_manager().devices.osamx
@@ -182,7 +185,9 @@ class RtOMNYController(Controller):
time.sleep(0.3)
self.laser_tracker_wait_on_target()
self.laser_tracker_check_signal()
#now the client checks the signal of tracking and readligns if needed
def _feedback_enable_with_reset_part2(self):
self.socket_put("J1")
time.sleep(0.5)
@@ -200,6 +205,9 @@ class RtOMNYController(Controller):
self.set_device_enabled("oosax", False)
self.set_device_enabled("oosax", False)
print("Feedback is running.")
@threadlocked
def clear_trajectory_generator(self):
self.socket_put("sc")
@@ -259,7 +267,7 @@ class RtOMNYController(Controller):
#update variables and enable if not yet active
if not self.laser_tracker_check_enabled():
logger.info("Enabling the laser tracker. Please wait...")
print("Enabling the laser tracker. Please wait...")
self.get_device_manager().connector.send_client_info(f"Enabling the laser tracker. Please wait...", scope="", show_asap=True)
tracker_intensity = self.tracker_info["tracker_intensity"]
if (
@@ -281,7 +289,7 @@ class RtOMNYController(Controller):
"trackzct=0"
)
self.laser_tracker_check_and_wait_for_signalstrength()
self.laser_tracker_wait_on_target()
logger.info("Laser tracker running!")
print("Laser tracker running!")
@@ -316,41 +324,39 @@ class RtOMNYController(Controller):
print("Failed to reach laser target position.")
raise RtError("Failed to reach laser target position.")
def laser_tracker_print_intensity_for_otrack_tweaking(self):
self.laser_update_tracker_info()
_laser_tracker_intensity = self.tracker_info["tracker_intensity"]
print(f"\r PSD beam intensity: {_laser_tracker_intensity:.2f}\r")
#self.laser_update_tracker_info()
#_laser_tracker_intensity = self.tracker_info["tracker_intensity"]
#print(f"\r PSD beam intensity: {_laser_tracker_intensity:.2f}\r")
self.laser_tracker_show_all(extra_endline="\r")
def laser_tracker_show_all(self):
def laser_tracker_show_all(self,extra_endline=""):
self.laser_update_tracker_info()
enabled_y = self.tracker_info["enabled_y"]
print(f"Tracker enabled: {bool(enabled_y)}")
print(extra_endline+f"Tracker enabled: {bool(enabled_y)}"+extra_endline)
if self.tracker_info["tracker_intensity"] < self.tracker_info["threshold_intensity_y"]:
print(self.red+" LOW INTENSITY"+self.white)
print(self.red+" LOW INTENSITY"+self.white+extra_endline)
_laser_tracker_intensity = self.tracker_info["tracker_intensity"]
print(f" PSD beam intensity: {_laser_tracker_intensity:.2f}")
print(f" PSD beam intensity: {_laser_tracker_intensity:.2f}"+extra_endline)
_laser_tracker_y_beampos = self.tracker_info["beampos_y"]
print(f" Y beam position: {_laser_tracker_y_beampos:.2f}")
print(f" Y beam position: {_laser_tracker_y_beampos:.2f}"+extra_endline)
_laser_tracker_y_target = self.tracker_info["target_y"]
print(f" target position: {_laser_tracker_y_target:.2f}")
print(f" target position: {_laser_tracker_y_target:.2f}"+extra_endline)
_laser_tracker_y_threshold_intensity = self.tracker_info["threshold_intensity_y"]
print(f" threshold intensity: {_laser_tracker_y_threshold_intensity:.2f}")
print(f" threshold intensity: {_laser_tracker_y_threshold_intensity:.2f}"+extra_endline)
_laser_tracker_y_piezo_voltage = self.tracker_info["piezo_voltage_y"]
print(f" Piezo voltage: {_laser_tracker_y_piezo_voltage:.2f}")
print(f" Piezo voltage: {_laser_tracker_y_piezo_voltage:.2f}"+extra_endline)
_laser_tracker_z_beampos = self.tracker_info["beampos_z"]
print(f" Z beam position: {_laser_tracker_z_beampos:.2f}")
print(f" Z beam position: {_laser_tracker_z_beampos:.2f}"+extra_endline)
_laser_tracker_z_target = self.tracker_info["target_z"]
print(f" target position: {_laser_tracker_z_target:.2f}")
print(f" target position: {_laser_tracker_z_target:.2f}"+extra_endline)
_laser_tracker_z_threshold_intensity = self.tracker_info["threshold_intensity_z"]
print(f" threshold intensity: {_laser_tracker_z_threshold_intensity:.2f}")
print(f" threshold intensity: {_laser_tracker_z_threshold_intensity:.2f}"+extra_endline)
_laser_tracker_z_piezo_voltage = self.tracker_info["piezo_voltage_z"]
print(f" Piezo voltage: {_laser_tracker_z_piezo_voltage:.2f}")
print(" Reminder - there is also an upper threshold active in rt\n")
self.laser_tracker_galil_status()
print(f" Piezo voltage: {_laser_tracker_z_piezo_voltage:.2f}"+extra_endline)
print(" Reminder - there is also an upper threshold active in rt\n"+extra_endline)
if extra_endline == "":
self.laser_tracker_galil_status()
@@ -371,7 +377,7 @@ class RtOMNYController(Controller):
otracky_con = self.get_device_manager().devices.otracky.obj.controller
if bool(float(otracky_con.socket_put_and_receive("MGtracken").strip())) == 0:
print(self.red+"Tracking in the Galil Controller is disabled."+self.white)
print("Use laser_tracker_galil_enable to enable.\n")
print("Use dev.rtx.controller.laser_tracker_galil_enable to enable.\n")
return(0)
else:
print("Tracking in the Galil Controller is enabled.")
@@ -831,6 +837,7 @@ class RtOMNYMotor(Device, PositionerBase):
self.user_setpoint.put(position, wait=False)
def move_and_finish():
# while not self.controller.slew_rate_limiters_on_target() and not self._stopped:
while not self._stopped:
print("motor is moving")
val = self.readback.read()