def unmountRobotSample(puckPos,pinPos,sampID): #will somehow know where it came from # absPos = (pinsPerPuck*puckPos)+pinPos+1 absPos = (pinsPerPuck*(puckPos%3))+pinPos+1 robotOnline = db_lib.getBeamlineConfigParam(daq_utils.beamline,'robot_online') print("robot online = " + str(robotOnline)) if (robotOnline): detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if (detDist<199.0): beamline_support.setPvValFromDescriptor("govRobotDetDistOut",200.0) beamline_support.setPvValFromDescriptor("govHumanDetDistOut",200.0) daq_lib.setRobotGovState("SE") print("unmounting " + str(puckPos) + " " + str(pinPos) + " " + str(sampID)) print("absPos = " + str(absPos)) platePos = int(puckPos/3) rotMotTarget = daq_utils.dewarPlateMap[platePos][0] rotCP = beamline_lib.motorPosFromDescriptor("dewarRot") print("dewar target,CP") print(rotMotTarget,rotCP) if (abs(rotMotTarget-rotCP)>1): print("rot dewar") try: RobotControlLib.runCmd("park") except Exception as e: e_s = str(e) daq_lib.gui_message("ROBOT park ERROR: " + e_s) print(e) return 0 beamline_lib.mvaDescriptor("dewarRot",rotMotTarget) try: par_init=(beamline_support.get_any_epics_pv("SW:RobotState","VAL")!="Ready") par_cool=(beamline_support.getPvValFromDescriptor("gripTemp")>-170) if par_cool == False and daq_utils.beamline == "fmx": time.sleep(3) RobotControlLib.unmount1(init=par_init,cooldown=par_cool) except Exception as e: e_s = str(e) daq_lib.gui_message("ROBOT unmount ERROR: " + e_s) print(e) return 0 detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if (detDist<200.0): beamline_lib.mvaDescriptor("detectorDist",200.0) if (beamline_lib.motorPosFromDescriptor("detectorDist") < 199.0): print("ERROR - Detector < 200.0!") return 0 try: RobotControlLib.unmount2(absPos) except Exception as e: e_s = str(e) if (e_s.find("Fatal") != -1): daq_macros.robotOff() daq_macros.disableMount() daq_lib.gui_message(e_s + ". FATAL ROBOT ERROR - CALL STAFF! robotOff() executed.") return 0 daq_lib.gui_message("ROBOT unmount2 ERROR: " + e_s) print(e) return 0 if (not daq_lib.waitGovRobotSE()): daq_lib.clearMountedSample() print("could not go to SE") return 0 return 1
def unmountRobotSample(puckPos, pinPos, sampID): #will somehow know where it came from absPos = (pinsPerPuck * (puckPos % 3)) + pinPos + 1 robotOnline = getBlConfig('robot_online') logger.info("robot online = " + str(robotOnline)) if (robotOnline): detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if (detDist < ROBOT_MIN_DISTANCE): setPvDesc("govRobotDetDistOut", ROBOT_MIN_DISTANCE) setPvDesc("govHumanDetDistOut", ROBOT_MIN_DISTANCE) daq_lib.setRobotGovState("SE") logger.info("unmounting " + str(puckPos) + " " + str(pinPos) + " " + str(sampID)) logger.info("absPos = " + str(absPos)) platePos = int(puckPos / 3) rotMotTarget = daq_utils.dewarPlateMap[platePos][0] rotCP = beamline_lib.motorPosFromDescriptor("dewarRot") logger.info("dewar target,CP") logger.info("%s %s" % (rotMotTarget, rotCP)) if (abs(rotMotTarget - rotCP) > 1): logger.info("rot dewar") try: RobotControlLib.runCmd("park") except Exception as e: e_s = str(e) message = "ROBOT park ERROR: " + e_s daq_lib.gui_message(message) logger.error(message) return 0 beamline_lib.mvaDescriptor("dewarRot", rotMotTarget) try: par_init = (beamline_support.get_any_epics_pv( "SW:RobotState", "VAL") != "Ready") par_cool = (getPvDesc("gripTemp") > -170) RobotControlLib.unmount1(init=par_init, cooldown=par_cool) except Exception as e: e_s = str(e) message = "ROBOT unmount ERROR: " + e_s daq_lib.gui_message(message) logger.error(message) return 0 if daq_utils.beamline == "fmx": det_z_pv = 'XF:17IDC-ES:FMX{Det-Ax:Z}Mtr' detDist = caget(f'{det_z_pv}.RBV') if detDist < ROBOT_MIN_DISTANCE: caput( f'{det_z_pv}.VAL', ROBOT_MIN_DISTANCE, wait=True ) # TODO shouldn't this wait for SE transition or something?? detDist = caget(f'{det_z_pv}.RBV') else: detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if detDist < ROBOT_MIN_DISTANCE and abs( detDist - ROBOT_MIN_DISTANCE) > ROBOT_DISTANCE_TOLERANCE: logger.error( f"ERROR - Detector closer than {ROBOT_MIN_DISTANCE} and move than {ROBOT_DISTANCE_TOLERANCE} from {ROBOT_MIN_DISTANCE}! actual distance: {detDist}. Stopping." ) return 0 try: RobotControlLib.unmount2(absPos) except Exception as e: e_s = str(e) if (e_s.find("Fatal") != -1): daq_macros.robotOff() daq_macros.disableMount() daq_lib.gui_message( e_s + ". FATAL ROBOT ERROR - CALL STAFF! robotOff() executed.") return 0 message = "ROBOT unmount2 ERROR: " + e_s daq_lib.gui_message(message) logger.error(message) return 0 if (not daq_lib.waitGovRobotSE()): daq_lib.clearMountedSample() logger.info("could not go to SE") return 0 return 1
def unmountRobotSample(puckPos, pinPos, sampID): #will somehow know where it came from absPos = (pinsPerPuck * (puckPos % 3)) + pinPos + 1 robotOnline = getBlConfig('robot_online') logger.info("robot online = " + str(robotOnline)) if (robotOnline): detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if (detDist < 200.0): setPvDesc("govRobotDetDistOut", 200.0) setPvDesc("govHumanDetDistOut", 200.0) daq_lib.setRobotGovState("SE") logger.info("unmounting " + str(puckPos) + " " + str(pinPos) + " " + str(sampID)) logger.info("absPos = " + str(absPos)) platePos = int(puckPos / 3) rotMotTarget = daq_utils.dewarPlateMap[platePos][0] rotCP = beamline_lib.motorPosFromDescriptor("dewarRot") logger.info("dewar target,CP") logger.info("%s %s" % (rotMotTarget, rotCP)) if (abs(rotMotTarget - rotCP) > 1): logger.info("rot dewar") try: RobotControlLib.runCmd("park") except Exception as e: e_s = str(e) message = "ROBOT park ERROR: " + e_s daq_lib.gui_message(message) logger.error(message) return 0 beamline_lib.mvaDescriptor("dewarRot", rotMotTarget) try: par_init = (beamline_support.get_any_epics_pv( "SW:RobotState", "VAL") != "Ready") par_cool = (getPvDesc("gripTemp") > -170) RobotControlLib.unmount1(init=par_init, cooldown=par_cool) except Exception as e: e_s = str(e) message = "ROBOT unmount ERROR: " + e_s daq_lib.gui_message(message) logger.error(message) return 0 detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if (detDist < 200.0): beamline_lib.mvaDescriptor("detectorDist", 200.0) if (beamline_lib.motorPosFromDescriptor("detectorDist") < 199.0): logger.error("ERROR - Detector < 200.0!") return 0 try: RobotControlLib.unmount2(absPos) except Exception as e: e_s = str(e) if (e_s.find("Fatal") != -1): daq_macros.robotOff() daq_macros.disableMount() daq_lib.gui_message( e_s + ". FATAL ROBOT ERROR - CALL STAFF! robotOff() executed.") return 0 message = "ROBOT unmount2 ERROR: " + e_s daq_lib.gui_message(message) logger.error(message) return 0 if (not daq_lib.waitGovRobotSE()): daq_lib.clearMountedSample() logger.info("could not go to SE") return 0 return 1