aux puck dry tool, gripper switches

This commit is contained in:
gac-S_Changer
2021-10-22 10:21:20 +02:00
parent 6eba018159
commit aa7b26f8b4
6 changed files with 79 additions and 83 deletions
+3 -4
View File
@@ -1,11 +1,10 @@
#Wed Oct 13 15:20:54 CEST 2021
dry_mount_counter=5
mounted_sample_position=D214
#Fri Oct 22 10:20:19 CEST 2021
dry_mount_counter=0
room_temperature_enabled=false
pin_offset=-0.0
puck_types=true
imaging_enabled=false
dry_timestamp=1.634130424209E9
dry_timestamp=1.634884370097E9
roi_h=1000
led_level=0.0
beamline_status_enabled=false
+2 -2
View File
@@ -1,2 +1,2 @@
#Tue Jun 22 08:54:23 CEST 2021
FileSequentialNumber=174
#Thu Oct 21 13:40:17 CEST 2021
FileSequentialNumber=176
+5 -7
View File
@@ -103,6 +103,7 @@ set_setting(ROOM_TEMPERATURE_ENABLED_PREFERENCE, is_room_temperature_enabled())
def is_gripper_really_empty(timeout=2.0):
evlog = Controller.getInstance().logEvent
timeout = timeout + time.time()
while time.time() < timeout:
if robot.eval_bool("diToolHasSample"):
@@ -111,9 +112,8 @@ def is_gripper_really_empty(timeout=2.0):
else:
return True
msg = "WARNING 1st try: gripper should be empty, sample detected (dwell for 2s and try again)"
log(msg, False)
print msg
msg = "is_gripper_really_empty() WARNING GRIPPER-TEST 1st try: gripper should be empty, sample detected (dwell for 2s and try again)"
evlog(msg)
time.sleep(2.0)
robot.eval_bool("diToolOpen")
@@ -122,14 +122,12 @@ def is_gripper_really_empty(timeout=2.0):
timeout = 2.0 + time.time()
while time.time() < timeout:
if robot.eval_bool("diToolHasSample"):
print "test"
time.sleep(0.10)
else:
return True
msg = "WARNING 2nd try: gripper should be empty, sample detected"
log(msg, False)
print printmsg
msg = "WARNING GRIPPER-TEST 2nd try: gripper should be empty, sample detected"
evlog(msg)
return False
+11
View File
@@ -21,3 +21,14 @@ def swap_samples(a, b, empty):
robot.get_aux(empty)
robot.put_aux(b)
def fetch_go_cold():
robot.move_gonio()
robot.get_gonio()
robot.move_cold()
def pickup(seg, puck, sam):
robot.move_dewar()
robot.get_dewar(seg, puck, sam)
robot.move_cold()
+39 -45
View File
@@ -39,6 +39,12 @@ def mount(segment, puck, sample, force=True, read_dm=False, auto_unmount=False):
segment = puck_address[:1]
puck = int(puck_address[1:])
sampleAddress = str(segment) + str(puck) + "-" + str(sample)
set_status("Mounting: " + sampleAddress)
evlog(">>>>>>>>>>>>>>> MOUNT <<<<<<<<<<<<<<<<<<<<<")
evlog("mount() Mount Sample", sampleAddress)
print "%4.1f s asserting" % (tg() - t1,)
#Initial checks
@@ -68,13 +74,17 @@ def mount(segment, puck, sample, force=True, read_dm=False, auto_unmount=False):
smart_magnet.set_supress(False)
time.sleep(0.2)
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
evlog("SMC Sample Detection", str(sample_det))
evlog("mount() SMC Sample Detection", str(sample_det))
print "%4.1f s SMC checked" % (tg() - t1,)
hasSample = robot.gripper_has_sample()
if hasSample:
msg = "CRITICAL ERROR: the gripper has a sample stuck to it, call local contact."
evlog(msg)
evlog("mount() terminating mount early")
raise Exception(msg)
mounting_in_same_segment = False
sampleAddress = str(segment) + str(puck) + "-" + str(sample)
try:
if sample_det == True:
@@ -93,10 +103,10 @@ def mount(segment, puck, sample, force=True, read_dm=False, auto_unmount=False):
do_unmount = True
if sample_det == True:
raise Exception("Pin detected on gonio")
set_status("Mounting: " + sampleAddress)
evlog("Mount Sample", sampleAddress)
msg = "CRITICAL a pin is being detected on gonio after an unmount attempt, either trash the sample or try unmounting again"
evlog(msg)
evlog("mount() terminating mount early")
raise Exception(msg)
if not do_unmount:
enable_motion()
@@ -130,57 +140,45 @@ def mount(segment, puck, sample, force=True, read_dm=False, auto_unmount=False):
robot.get_dewar(segment, puck, sample, mounting_in_same_segment=mounting_in_same_segment)
hasSample = robot.gripper_has_sample()
hasSample = robot.gripper_has_sample()
msg = "mount() WARNING GRIPPER-TEST - after get_(dewar,rt,aux) gripper has sample: {}".format(hasSample)
evlog(msg)
evlog(msg)
if not hasSample:
msg = "WARNING GRIPPER-TEST no sample in position {}".format(sampleAddress)
evlog(msg)
if not hasSample:
if is_aux or is_rt:
robot.move_park()
else:
robot.move_cold()
msg = "MISSING SAMPLE in position {} - try the next one".format(sampleAddress)
evlog(msg)
evlog("mount() terminating mount early")
raise Exception(msg)
if read_dm:
if read_dm:
barcode_reader.start_read(10.0)
robot.move_scanner()
robot.move_scanner()
robot.move_gonio()
robot.move_gonio()
if read_dm:
if read_dm:
mount_sample_id = barcode_reader.get_readout()
print "%4.1f s ....done --- barcode: %s" % (tg() - t1, mount_sample_id)
mount_sample_id = barcode_reader.get_readout()
evlog("mount() read pin barcode: %s" % (mount_sample_id,))
else:
mount_sample_id = None
curpos = cryopos.getPosition()
if is_room_temperature_enabled():
if curpos < 50:
if curpos < 50:
cryopos.move(50.)
else:
else:
speed = cryopos.getSpeed() / 1000.0
movetime = int(round(3000 + (15. - curpos) / speed))
cryopos.move(15.0, movetime)
cryopos.waitValueInRange(15.0, 1.0, movetime)
robot.put_gonio()
robot.put_gonio()
robot.close_tool() # closes gripper
if is_normal:
if is_normal:
cryopos.moveAsync(5.0)
@@ -195,23 +193,16 @@ def mount(segment, puck, sample, force=True, read_dm=False, auto_unmount=False):
elif zero_counts:
set_setting("dry_mount_counter", 0)
if is_rt:
if is_rt:
robot.move_park()
elif is_normal:
elif is_normal:
robot.move_cold()
elif is_aux:
if was_cold:
print "%4.1f s mount/moving cold after auxtool mount " % (tg() - t1,)
robot.move_cold()
else:
print "%4.1f s mount/moving park after auxtool mount" % (tg() - t1,)
elif is_aux:
robot.move_park()
else:
robot.move_cold()
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
evlog("mount() SMC Detection", str(mount_sample_detected))
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
@@ -221,28 +212,31 @@ def mount(segment, puck, sample, force=True, read_dm=False, auto_unmount=False):
# option to dry gripper and lose the sample
reallyEmpty = is_gripper_really_empty(1.2)
if not reallyEmpty:
if not reallyEmpty:
msg = "CRITICAL The gripper still has sample {} after mount attempt, call local contact".format(sampleAddress)
evlog(msg)
print "%4.1f s %s" % (tg() - t1, msg)
evlog(msg)
evlog("mount() terminating mount early")
raise Exception(msg)
sampleDelivered = True
robot.open_tool() # open gripper
if sampleDelivered and not mount_sample_detected:
msg = "WARNING GRIPPER-TEST sample {} lost during mount".format(sampleAddress)
evlog("SMC Sample Detection false after put gonio")
print "%4.1f s %s" % (tg() - t1, msg)
if sampleDelivered and not mount_sample_detected:
msg = "CRITICAL The sample {} seems to have been lost during mount procedure. Try another sample or call your local contact".format(sampleAddress)
evlog(msg)
evlog("mount() terminating mount early")
raise Exception(msg)
if is_force_dry():
smart_magnet.set_default_current()
print "%4.1f Auto dry async" % (tg() - t1,)
smart_magnet.set_default_current()
if is_aux and was_cold:
evlog("mount() drying after tool mount")
set_exec_pars(then = "dry(wait_cold=-1)")
elif is_force_dry():
evlog("mount() Starting async auto dry")
set_exec_pars(then = "dry()")
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
return [mount_sample_detected, mount_sample_id]
finally:
finally:
evlog("############### MOUNT-FINISHED ####################")
smart_magnet.set_default_current()
+19 -25
View File
@@ -14,8 +14,8 @@ def unmount(segment = None, puck = None, sample = None, force=True, auto_unmount
sampleAddress = str(segment) + str(puck) + "-" + str(sample)
msg = "Unmounting %s" % (sampleAddress,)
print msg
evlog(">>>>>>>>>>>>>>> UNMOUNT <<<<<<<<<<<<<<<<<<<<<")
msg = "unmount() Unmounting %s" % (sampleAddress,)
evlog(msg)
is_aux = (segment == AUX_SEGMENT)
@@ -58,7 +58,14 @@ def unmount(segment = None, puck = None, sample = None, force=True, auto_unmount
assert_mount_position()
set_status("Unmounting: " + str(segment) + str(puck) + str(sample))
evlog("Unmount Sample", str(segment) + str(puck) + str(sample))
hasSample = robot.gripper_has_sample()
if hasSample:
msg = "unmount() CRITICAL GRIPPER-TEST - the gripper has a sample already!!!"
evlog(msg)
raise Exception("CRITICAL ERROR: the gripper has a sample stuck to it, call local contact.")
try:
if smart_magnet.get_supress() == True:
@@ -78,7 +85,7 @@ def unmount(segment = None, puck = None, sample = None, force=True, auto_unmount
enable_motion()
if is_normal:
evlog("UNMOUNT() set_hexiposi(%s)" % (segment,))
evlog("unmount() set_hexiposi(%s)" % (segment,))
set_hexiposi(segment)
if not force:
@@ -100,10 +107,8 @@ def unmount(segment = None, puck = None, sample = None, force=True, auto_unmount
curpos = cryopos.getPosition()
if is_room_temperature_enabled():
if curpos < 50:
print "%4.1f s moving cryo out to 50mm" % (tg() - t1,)
cryopos.move(50.)
else:
print "%4.1f s moving cryo out to 15mm" % (tg() - t1,)
speed = cryopos.getSpeed() / 1000.
movetime = int(round(3000 + (15. - curpos) / speed))
cryopos.move(15.0, movetime)
@@ -124,16 +129,17 @@ def unmount(segment = None, puck = None, sample = None, force=True, auto_unmount
robot.move_dewar()
robot.put_dewar(segment, puck, sample, mounting_in_same_segment=mounting_in_same_segment)
robot.close_tool() # closes gripper
has_sample_after_get = robot.gripper_has_sample()
evlog("Sample Detection - unmount after get_gonio: ", str(has_sample_after_get))
evlog("unmount() sample detections after put_(dewar,rt,aux):")
evlog(" GRIPPER: ", str(has_sample_after_get))
smart_magnet.apply_reverse()
smart_magnet.apply_resting()
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
evlog("Sample Detection", str(mount_sample_detected))
evlog(" SMC: ", str(mount_sample_detected))
robot.close_tool() # closes gripper
if not was_cold:
robot.move_park()
@@ -145,28 +151,16 @@ def unmount(segment = None, puck = None, sample = None, force=True, auto_unmount
reallyEmpty = is_gripper_really_empty(0.8)
if not reallyEmpty:
msg = "WARNING GRIPPER-TEST gripper still has a sample {} after mount attempt".format(sampleAddress)
msg = "unmount() CRITICAL gripper still has a sample {} after puck delivery attempt, call local contact!".format(sampleAddress)
evlog(msg)
print msg
if is_aux or is_rt:
robot.move_park()
# raise Exception(msg)
raise Exception(msg)
robot.open_tool() # open gripper
if has_sample_after_get == mount_sample_detected:
msg = "WARNING GRIPPER-TEST Sample Detection Error - unmount from SM:" + str(mount_sample_detected) + " gripper:" + str(has_sample_after_get) + sampleAddress
print msg
evlog(msg)
#has_sample_after_put = robot.gripper_has_sample()
#log("Sample Detection - unmount after put: " + str(has_sample_after_put), False)
#if has_sample_after_put:
# log("Sample Detection Error - unm put", False)
set_setting("mounted_sample_position", None)
return mount_sample_detected
finally:
if not auto_unmount:
smart_magnet.set_default_current()
smart_magnet.set_supress(True)
evlog("############### UNMOUNT-FINISHED ####################")