auxtools implementation
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#Fri May 28 13:11:56 CEST 2021
|
||||
dry_mount_counter=1
|
||||
#Wed Jun 16 11:03:52 CEST 2021
|
||||
dry_mount_counter=0
|
||||
mounted_sample_position=X11
|
||||
room_temperature_enabled=true
|
||||
pin_offset=-0.0
|
||||
puck_types=true
|
||||
imaging_enabled=false
|
||||
dry_timestamp=1.622109289176E9
|
||||
dry_timestamp=1.623598457599E9
|
||||
roi_h=1000
|
||||
led_level=0.0
|
||||
beamline_status_enabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Tue Aug 27 11:23:51 CEST 2019
|
||||
#Wed Jun 02 10:32:23 CEST 2021
|
||||
detection=Mechanical
|
||||
disabled=false
|
||||
disabled=true
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Tue Sep 10 08:18:31 CEST 2019
|
||||
#Wed Jun 02 10:36:29 CEST 2021
|
||||
detection=Mechanical
|
||||
disabled=false
|
||||
disabled=true
|
||||
|
||||
@@ -12,7 +12,7 @@ DESC_DEFAULT = DESC_FAST
|
||||
|
||||
AUX_SEGMENT = "X"
|
||||
RT_SEGMENT = "R"
|
||||
|
||||
COLD_SEGMENTS = "ABCDEF"
|
||||
|
||||
DEFAULT_ROBOT_POLLING = 500
|
||||
TASK_WAIT_ROBOT_POLLING = 50
|
||||
|
||||
+65
-48
@@ -7,15 +7,25 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
global mount_sample_id, mount_sample_detected
|
||||
print "mount: ", segment, puck, sample, force
|
||||
|
||||
start = time.time()
|
||||
#time.sleep(2)
|
||||
start = time.time()
|
||||
is_aux = (segment == AUX_SEGMENT)
|
||||
is_rt = (segment == RT_SEGMENT)
|
||||
|
||||
is_normal = not (is_aux or is_rt)
|
||||
|
||||
#ZACH
|
||||
needs_chilling = (not is_aux) and (not is_rt) and (not robot.is_cold())
|
||||
needs_drying = (is_aux or is_rt ) and robot.is_cold()
|
||||
previous_mounted = get_setting("mounted_sample_position")
|
||||
if previous_mounted is not None:
|
||||
previous_segment, previous_puck, previous_sample = previous_mounted[0], int(previous_mounted[1]), int(previous_mounted[2:])
|
||||
else:
|
||||
previous_segment, previous_puck, previous_sample = "-", 0, 0
|
||||
mounting_in_same_segment = (previous_segment == segment)
|
||||
|
||||
# ZAC
|
||||
was_cold = robot.is_cold()
|
||||
was_warm = not was_cold
|
||||
needs_chilling = not is_rt and was_warm
|
||||
needs_drying = is_rt and was_cold
|
||||
count_mount = is_normal or (is_aux and was_cold)
|
||||
zero_counts = (is_aux and not was_cold) or (is_rt and was_cold)
|
||||
|
||||
puck_address = get_puck_address(puck)
|
||||
if puck_address is None:
|
||||
@@ -46,36 +56,32 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
hexiposi.assert_homed()
|
||||
assert_mount_position()
|
||||
do_unmount = False
|
||||
|
||||
# detect sample before moving to cold
|
||||
if smart_magnet.get_supress() == True:
|
||||
smart_magnet.set_supress(False)
|
||||
time.sleep(0.2)
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(sample_det))
|
||||
|
||||
mounting_in_same_segment = False
|
||||
|
||||
try:
|
||||
#ZACH
|
||||
if needs_chilling:
|
||||
robot.move_cold()
|
||||
time.sleep(30.0)
|
||||
|
||||
if smart_magnet.get_supress() == True:
|
||||
smart_magnet.set_supress(False)
|
||||
time.sleep(0.2)
|
||||
#To better dectect sample
|
||||
#smart_magnet.apply_reverse()
|
||||
#smart_magnet.apply_resting()
|
||||
#time.sleep(0.5)
|
||||
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(sample_det))
|
||||
if sample_det == True:
|
||||
if was_warm and previous_segment in COLD_SEGMENTS:
|
||||
print "was warm previous %s %s $s" % (previous_segment, COLD_SEGMENTS, previous_mounted)
|
||||
robot.move_cold()
|
||||
time.sleep(30.0)
|
||||
|
||||
if auto_unmount and (get_setting("mounted_sample_position") is not None):
|
||||
pos = get_setting("mounted_sample_position")
|
||||
former_segment = pos[0:1]
|
||||
mounting_in_same_segment = (former_segment == segment)
|
||||
if mounting_in_same_segment:
|
||||
print "Mounting from the same segment"
|
||||
#auto_unmount set to true so detection remains enabled
|
||||
sample_det = unmount(force = True, auto_unmount = True, mounting_in_same_segment=mounting_in_same_segment)
|
||||
sample_det = unmount(force = True, auto_unmount = True, mounting_in_same_segment=mounting_in_same_segment, next_segment=segment)
|
||||
do_unmount = True
|
||||
if sample_det == True:
|
||||
raise Exception("Pin detected on gonio")
|
||||
|
||||
set_status("Mounting: " + str(segment) + str(puck) + str(sample))
|
||||
Controller.getInstance().logEvent("Mount Sample", str(segment) + str(puck) + str(sample))
|
||||
#location = robot.get_current_point()
|
||||
@@ -84,31 +90,27 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
if not do_unmount:
|
||||
enable_motion()
|
||||
|
||||
#ZACH
|
||||
# ZAC
|
||||
# a room temp pin is being mounted but the gripper is cold
|
||||
if needs_drying:
|
||||
dry(wait_cold=-1) # move to park after dry
|
||||
|
||||
if is_aux:
|
||||
if not robot.is_aux():
|
||||
robot.move_aux()
|
||||
|
||||
robot.move_aux()
|
||||
robot.get_aux(sample)
|
||||
|
||||
|
||||
elif is_rt:
|
||||
if not robot.is_rt():
|
||||
robot.move_rt()
|
||||
|
||||
robot.move_rt()
|
||||
robot.get_rt(puck, sample)
|
||||
|
||||
else:
|
||||
set_hexiposi(segment)
|
||||
|
||||
if not force:
|
||||
visual_check_hexiposi(segment)
|
||||
|
||||
visual_check_hexiposi(segment)
|
||||
if (not robot.is_dewar()) and (not mounting_in_same_segment):
|
||||
robot.move_dewar()
|
||||
|
||||
robot.move_dewar()
|
||||
robot.get_dewar(segment, puck, sample, mounting_in_same_segment=mounting_in_same_segment)
|
||||
|
||||
piked_sample = robot.gripper_has_sample()
|
||||
@@ -131,18 +133,34 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
robot.put_gonio()
|
||||
#has_sample_after_put = robot.gripper_has_sample()
|
||||
#log("Sample Detection - mount after put: " + str(has_sample_after_put), False)
|
||||
|
||||
try:
|
||||
dry_mount_count = int(get_setting("dry_mount_counter"))
|
||||
except:
|
||||
dry_mount_count = 0
|
||||
set_setting("dry_mount_counter", dry_mount_count+1)
|
||||
|
||||
if is_aux or is_rt:
|
||||
robot.move_home()
|
||||
|
||||
if count_mount:
|
||||
try:
|
||||
dry_mount_count = int(get_setting("dry_mount_counter"))
|
||||
except:
|
||||
dry_mount_count = 0
|
||||
finally:
|
||||
set_setting("dry_mount_counter", dry_mount_count+1)
|
||||
|
||||
elif zero_counts:
|
||||
set_setting("dry_mount_counter", 0)
|
||||
|
||||
if is_rt:
|
||||
print "mount/moving home in RT"
|
||||
robot.move_home()
|
||||
elif is_normal:
|
||||
print "mount/moving cold in cold"
|
||||
robot.move_cold()
|
||||
elif is_aux:
|
||||
if was_cold:
|
||||
print "mount/moving cold after auxtool mount"
|
||||
robot.move_cold()
|
||||
else:
|
||||
print "mount/moving cold after auxtool mount"
|
||||
robot.move_park()
|
||||
else:
|
||||
robot.move_cold()
|
||||
|
||||
robot.move_cold()
|
||||
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("Sample Detection", str(mount_sample_detected))
|
||||
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
|
||||
@@ -167,4 +185,3 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
finally:
|
||||
smart_magnet.set_default_current()
|
||||
smart_magnet.set_supress(True)
|
||||
|
||||
|
||||
+13
-4
@@ -6,6 +6,9 @@ def trash():
|
||||
if robot.simulated:
|
||||
time.sleep(3.0)
|
||||
return
|
||||
|
||||
was_cold = robot.is_cold()
|
||||
|
||||
|
||||
#Initial checks
|
||||
robot.assert_no_task()
|
||||
@@ -17,8 +20,11 @@ def trash():
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
robot.move_heater(to_bottom = False)
|
||||
robot.move_heater(to_bottom = True)
|
||||
robot.move_gonio()
|
||||
robot.get_gonio()
|
||||
|
||||
#robot.move_heater(to_bottom = False)
|
||||
#robot.move_heater(to_bottom = True)
|
||||
|
||||
try:
|
||||
for i in range(3):
|
||||
@@ -30,7 +36,10 @@ def trash():
|
||||
robot.open_tool()
|
||||
|
||||
|
||||
robot.move_heater(to_bottom = False)
|
||||
robot.move_cold()
|
||||
#robot.move_heater(to_bottom = False)
|
||||
|
||||
if was_cold:
|
||||
robot.move_cold()
|
||||
else:
|
||||
robot.move_aux()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
def unmount(segment = None, puck = None, sample = None, force=False, auto_unmount = False, mounting_in_same_segment=False):
|
||||
def unmount(segment = None, puck = None, sample = None, force=False, auto_unmount = False, next_segment="-*-", mounting_in_same_segment=False):
|
||||
"""
|
||||
"""
|
||||
print "unmount: ", segment, puck, sample, force
|
||||
@@ -13,8 +13,13 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
#ZACH
|
||||
is_aux = (segment == AUX_SEGMENT)
|
||||
is_rt = (segment == RT_SEGMENT)
|
||||
needs_chilling = (not is_aux) and (not is_rt) and (not robot.is_cold())
|
||||
needs_drying = (is_aux or is_rt ) and robot.is_cold()
|
||||
is_normal = not (is_aux or is_rt)
|
||||
|
||||
was_cold = robot.is_cold()
|
||||
was_warm = not was_cold
|
||||
needs_chilling = not is_rt and was_warm
|
||||
needs_drying = is_rt and was_cold
|
||||
move_cold_at_end = str(next_segment) in COLD_SEGMENTS
|
||||
|
||||
|
||||
#Initial checks
|
||||
@@ -64,11 +69,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
if is_aux or is_rt:
|
||||
if needs_drying:
|
||||
dry(wait_cold=-1)
|
||||
|
||||
else:
|
||||
if is_normal:
|
||||
set_hexiposi(segment)
|
||||
|
||||
if not force:
|
||||
@@ -76,6 +77,10 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
if needs_chilling:
|
||||
robot.move_cold()
|
||||
time.sleep(30.)
|
||||
else:
|
||||
if needs_drying:
|
||||
dry(wait_cold=-1)
|
||||
|
||||
#location = robot.get_current_point()
|
||||
|
||||
if not robot.is_gonio():
|
||||
@@ -84,6 +89,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
#smart_magnet.set_unmount_current()
|
||||
|
||||
robot.get_gonio()
|
||||
|
||||
has_sample_after_get = robot.gripper_has_sample()
|
||||
log("Sample Detection - unmount after get_gonio: " + str(has_sample_after_get), False)
|
||||
|
||||
@@ -94,7 +100,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
|
||||
if is_aux:
|
||||
robot.move_aux()
|
||||
robot.put_aux( sample)
|
||||
robot.put_aux(sample)
|
||||
elif is_rt:
|
||||
robot.move_rt()
|
||||
robot.put_rt(puck, sample)
|
||||
|
||||
Reference in New Issue
Block a user