DAQ: magnet positon sensor code
This commit is contained in:
@@ -535,6 +535,41 @@ class AareDAQ:
|
||||
logger.error(f"Failed to park and dry: {e}")
|
||||
raise e
|
||||
|
||||
def __magnet_position_sensor_check(self, timeout: float = 360.0):
|
||||
#TODO check this works, add beamstop z controls and test.
|
||||
|
||||
# logger.info("checking beamstop")
|
||||
# if self.__devs.beamstop_z.value < 24.0:
|
||||
# raise Exception("Beamstop Z below 24.0 mm - potentially unsafe with mounting")
|
||||
if self.__devs.magnet_position_sensor.value is None:
|
||||
logger.warning("!!!!!!!!!!!!!!!!!!!!!magnet position sensor not set!!!!!!!!!!!!!!!!!!")
|
||||
logger.warning("NOT IMPLEMENTED")
|
||||
|
||||
if self.__devs.magnet_position_sensor.value != 0:
|
||||
time.sleep(1)
|
||||
logger.warning("!!!!!!!!!!!!!!!!!!!!!magnet position sensor readout not 0!!!!!!!!!!!!!!!!!!")
|
||||
logger.debug(f"Checking magnet position sensor positon: {self.__devs.magnet_position_sensor_readout.value}")
|
||||
logger.debug(f"Checking smargon position: {self.__devs.smargon_pos}")
|
||||
logger.debug(f"Checking abr position: {self.__devs.aerotech_pos}")
|
||||
if self.__devs.magnet_position_sensor.value != 0:
|
||||
logger.warning("!!!!!!!!!!!!!!!!!!!!!magnet position sensor readout not 0!!!!!!!!!!!!!!!!!!")
|
||||
logger.info(f"!!!!!!!!!!!!!!!!!!!!!Starting to wait for magnet position sensor to be 0!!!!!!!!!!!!!!!!!!")
|
||||
logger.info(f"!!!!!!!!!!!!!!!!!!!!! Timeout in: {timeout} s !!!!!!!!!!!!!!!!!!")
|
||||
start = time.perf_counter()
|
||||
end = start + timeout
|
||||
while self.__devs.magnet_position_sensor.value != 0:
|
||||
time.sleep(1)
|
||||
logger.debug(f"Checking magnet position sensor positon: {self.__devs.magnet_position_sensor_readout.value}")
|
||||
logger.debug(f"Checking smargon position: {self.__devs.smargon_pos}")
|
||||
logger.debug(f"Checking abr position: {self.__devs.aerotech_pos}")
|
||||
if time.perf_counter() > end:
|
||||
raise Exception(f"Magnet position sensor is not in position: {self.__devs.magnet_position_sensor_readout.value}")
|
||||
if round(time.perf_counter(), 0) % 10 == 0:
|
||||
logger.info(f"!!!!!!!!!!!!!!!!!!!!!magnet position sensor readout not 0!!!!!!!!!!!!!!!!!!")
|
||||
logger.info(f"!!!!!!!!!!!!!!!!!!!!! Timeout in: {timeout} s !!!!!!!!!!!!!!!!!!")
|
||||
logger.info(f"!!!!!!!!!!!!!!!!!!!!! Time elapsed: {time.perf_counter() - start} s !!!!!!!!!!!!!!!!!!")
|
||||
|
||||
|
||||
def __mount_failure_handler(self, mount_error):
|
||||
pass
|
||||
|
||||
@@ -542,6 +577,7 @@ class AareDAQ:
|
||||
self.__devs.smargon_move_home()
|
||||
self.__devs.aerotech_pos = ABR_POS_MOUNT
|
||||
#collimator should be down!!!
|
||||
#self.__magnet_position_sensor_check(timeout=360.0)
|
||||
self.__devs.tell.check_enable_motion()
|
||||
self.__devs.tell.wait_not_busy()
|
||||
self.__devs.tell.set_in_mount_position(True)
|
||||
|
||||
Reference in New Issue
Block a user