Beispiel #1
0
def mountSample(sampID):
  global mountCounter

  saveDetDist = beamline_lib.motorPosFromDescriptor("detectorDist")  
  warmUpNeeded = 0
  if (getBlConfig("queueCollect") == 1):
    mountCounter+=1
    if (mountCounter > getBlConfig("robotWarmupInterval")):
      warmUpNeeded = 1
  mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample')
  currentMountedSampleID = mountedSampleDict["sampleID"]
  if (getBlConfig(TOP_VIEW_CHECK) == 1):
    logger.info("setting work pos")
    if (daq_utils.beamline == "amx"):                          
      setPvDesc("robotXWorkPos",getPvDesc("robotXMountPos"))
      setPvDesc("robotYWorkPos",getPvDesc("robotYMountPos"))
      setPvDesc("robotZWorkPos",getPvDesc("robotZMountPos"))
      setPvDesc("robotOmegaWorkPos",90.0)    
      logger.info("done setting work pos")  
  if (currentMountedSampleID != ""): #then unmount what's there
    if (sampID!=currentMountedSampleID):
      puckPos = mountedSampleDict["puckPos"]
      pinPos = mountedSampleDict["pinPos"]
      if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)):
        db_lib.deleteCompletedRequestsforSample(currentMountedSampleID)
        set_field("mounted_pin","")        
        db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""})        
        (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID)
        if (warmUpNeeded):
          gui_message("Warming gripper. Please stand by.")
          mountCounter = 0
        mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=0,warmup=warmUpNeeded)
        if (warmUpNeeded):
          destroy_gui_message()
        if (mountStat == 1):
          set_field("mounted_pin",sampID)
          detDist = beamline_lib.motorPosFromDescriptor("detectorDist")
          if (detDist != saveDetDist):
            if (getBlConfig("HePath") == 0):
              beamline_lib.mvaDescriptor("detectorDist",saveDetDist)
        elif(mountStat == 2):
          return 2
        else:
          return 0
      else:
        return 0
    else: #desired sample is mounted, nothing to do
      return 1
  else: #nothing mounted
    (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID)
    mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=1)
    if (mountStat == 1):
      set_field("mounted_pin",sampID)
    elif(mountStat == 2):
      return 2
    else:
      return 0
  db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':puckPos,'pinPos':pinPos,'sampleID':sampID})
  return 1
Beispiel #2
0
def mountSample(sampID):
  mountedSampleDict = db_lib.beamlineInfo('john', 'mountedSample')
  currentMountedSampleID = mountedSampleDict["sampleID"]
  if (currentMountedSampleID != 99): #then unmount what's there
    if (sampID!=currentMountedSampleID):
      puckPos = mountedSampleDict["puckPos"]
      pinPos = mountedSampleDict["pinPos"]
      robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)
      set_field("mounted_pin",sampID)
      (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(sampID)
      robot_lib.mountRobotSample(puckPos,pinPos,sampID)
    else: #desired sample is mounted, nothing to do
      return 1
  else: #nothing mounted
    (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(sampID)
    robot_lib.mountRobotSample(puckPos,pinPos,sampID)
  db_lib.beamlineInfo('john', 'mountedSample', info_dict={'puckPos':puckPos,'pinPos':pinPos,'sampleID':sampID})
Beispiel #3
0
def mountSample(sampID):
  global mountCounter

  warmUpNeeded = 0
  if (db_lib.getBeamlineConfigParam(daq_utils.beamline,"queueCollect") == 1):
    mountCounter+=1
    if (mountCounter > db_lib.getBeamlineConfigParam(daq_utils.beamline,"robotWarmupInterval")):
      warmUpNeeded = 1
  mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample')
  currentMountedSampleID = mountedSampleDict["sampleID"]
  if (currentMountedSampleID != ""): #then unmount what's there
    if (sampID!=currentMountedSampleID):
      puckPos = mountedSampleDict["puckPos"]
      pinPos = mountedSampleDict["pinPos"]
      if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)):
        db_lib.deleteCompletedRequestsforSample(currentMountedSampleID)
        set_field("mounted_pin","")        
        db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""})        
        (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID)
        if (warmUpNeeded):
          gui_message("Warming gripper. Please stand by.")
          mountCounter = 0
        mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=0,warmup=warmUpNeeded)
        if (warmUpNeeded):
          destroy_gui_message()
        if (mountStat == 1):
          set_field("mounted_pin",sampID)
        elif(mountStat == 2):
          return 2
        else:
          return 0
      else:
        return 0
    else: #desired sample is mounted, nothing to do
      return 1
  else: #nothing mounted
    (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID)
    mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=1)
    if (mountStat == 1):
      set_field("mounted_pin",sampID)
    elif(mountStat == 2):
      return 2
    else:
      return 0
  db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':puckPos,'pinPos':pinPos,'sampleID':sampID})
  return 1