Skip to content

Commit

Permalink
Merge pull request #372 from vshekar/check-iced-pin
Browse files Browse the repository at this point in the history
Added iced pin check
  • Loading branch information
vshekar authored Apr 29, 2024
2 parents fdcef80 + 80b1793 commit 3a53fbf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions embl_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ def mount(self, gov_robot, puckPos,pinPos,sampID,**kwargs):
logger.error(e)
e_s = str(e)
if (e_s.find("Fatal") != -1):
if self.isSampleDetected(e_s):
return MOUNT_STEP_SUCCESSFUL
daq_macros.robotOff()
daq_macros.disableMount()
daq_lib.gui_message(e_s + ". FATAL ROBOT ERROR - CALL STAFF! robotOff() executed.")
Expand Down Expand Up @@ -324,6 +326,25 @@ def mount(self, gov_robot, puckPos,pinPos,sampID,**kwargs):
return MOUNT_FAILURE
return MOUNT_STEP_SUCCESSFUL

def isSampleDetected(self, error_string, max_wait_time=60):
"""Sometimes after mount, the pin is not detected on the gonio because
there is a buildup of ice between the pin and gonio
This function checks for that error, and if it is detected will check for
the pin every second for max_wait_time seconds.
If after that time it still does not detect the sample it will throw an error
"""

if (error_string.find("Pin lost during mount transaction") != -1):
logger.info(f"Pin probably has ice, waiting for {max_wait_time + 1} seconds")
wait_time = 0
while wait_time < max_wait_time:
wait_time += 1
time.sleep(1)
if getPvDesc("sampleDetected") == 0:
# Sample is detected
return True
return False

def postMount(self, gov_robot, puck, pinPos, sampID):
sampYadjust = float(getBlConfig('sampYAdjust'))
if getBlConfig('robot_online'):
Expand Down

0 comments on commit 3a53fbf

Please sign in to comment.