Skip to content

Commit

Permalink
Merge pull request #393 from vshekar/automated-robot-recovery-procedure
Browse files Browse the repository at this point in the history
Robot recovery procedure during automated collection for EMBL robot
  • Loading branch information
vshekar authored Jul 16, 2024
2 parents 8e21202 + 7e132de commit 9034046
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
10 changes: 10 additions & 0 deletions daq_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import parseSheet
import attenCalc
import raddoseLib
import robot_lib
from raddoseLib import *
import logging
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -248,6 +249,15 @@ def changeImageCenterHighMag(x,y,czoom):
"face_on_omega" : 0
}

def run_robot_recovery_procedure():
""" Generic recovery procedure to be used during automated
collection"""
# Recover robot
robot_lib.recoverRobot()
# Dry Gripper
robot_lib.dryGripper()
# Park Gripper and cool gripper
robot_lib.cooldownGripper()

def run_top_view_optimized():
RE(topview_optimized())
Expand Down
23 changes: 19 additions & 4 deletions embl_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def unmount(self, gov_robot, puckPos, pinPos, sampID):
absPos = (PINS_PER_PUCK*(puckPos%3))+pinPos+1
if getBlConfig('robot_online'):
try:
logger.info("Unmounting sample")
RobotControlLib.unmount2(absPos)
except Exception as e:
e_s = str(e)
Expand All @@ -450,10 +451,24 @@ def unmount(self, gov_robot, puckPos, pinPos, sampID):
daq_macros.disableMount()
daq_lib.gui_message(e_s + ". FATAL ROBOT ERROR - CALL STAFF! robotOff() executed.")
return UNMOUNT_FAILURE
message = "ROBOT unmount2 ERROR: " + e_s
daq_lib.gui_message(message)
logger.error(message)
return UNMOUNT_FAILURE
elif "SE" in e_s:
# In case there is an SE Timeout error, run the recovery procedure
daq_macros.run_robot_recovery_procedure()
try:
# Try to unmount again
RobotControlLib.unmount2(absPos)
except Exception as e:
# If there is an exception again, return UNMOUNT_FAILURE
daq_macros.run_robot_recovery_procedure()
message = f"ROBOT unmount2 ERROR: {e}"
daq_lib.gui_message(message)
logger.error(message)
return UNMOUNT_FAILURE
else:
message = "ROBOT unmount2 ERROR: " + e_s
daq_lib.gui_message(message)
logger.error(message)
return UNMOUNT_FAILURE
gov_status = gov_lib.setGovRobot(gov_robot, 'SE')
if not gov_status.success:
daq_lib.clearMountedSample()
Expand Down
3 changes: 3 additions & 0 deletions robot_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ def openGripper():

def closeGripper():
robot.closeGripper()

def cooldownGripper():
robot.cooldownGripper()

0 comments on commit 9034046

Please sign in to comment.