3 Commits

Author SHA1 Message Date
gac-S_Changer
f946fce081 trash sample improvement 2021-05-27 18:03:21 +02:00
gac-S_Changer
cf285feb0c updates to handle AUX tools 2021-05-12 16:46:05 +02:00
gac-S_Changer
923d1b1d7b settings/timestamps update 2021-05-12 08:56:11 +02:00
8 changed files with 114 additions and 65 deletions

View File

@@ -1,11 +1,11 @@
#Wed May 05 09:44:20 CEST 2021
#Thu May 27 18:01:34 CEST 2021
dry_mount_counter=0
mounted_sample_position=F21
mounted_sample_position=X18
room_temperature_enabled=false
pin_offset=-0.0
puck_types=true
imaging_enabled=false
dry_timestamp=1.620127409487E9
dry_timestamp=1.621263350745E9
roi_h=1000
led_level=0.0
beamline_status_enabled=false

View File

@@ -1,8 +1,8 @@
#Tue Apr 13 11:01:31 CEST 2021
#Wed May 19 08:00:41 CEST 2021
minValue=0.0
unit=V
offset=0.0
maxValue=1.0
maxValue=0.4
precision=2
sign_bit=0
scale=3.0E-4

View File

@@ -1,8 +1,8 @@
#Tue Apr 13 11:01:31 CEST 2021
#Wed May 19 08:00:41 CEST 2021
minValue=0.0
unit=V
offset=0.0
maxValue=1.0
maxValue=0.4
precision=2
sign_bit=0
scale=3.0E-4

View File

@@ -1,8 +1,8 @@
#Tue Apr 13 11:01:31 CEST 2021
#Wed May 19 08:00:41 CEST 2021
minValue=0.0
unit=V
offset=0.0
maxValue=1.0
maxValue=0.4
precision=2
sign_bit=0
scale=3.0E-4

View File

@@ -10,7 +10,8 @@ DESC_SCAN = "mScan"
DESC_DEFAULT = DESC_FAST
AUX_SEGMENT = "X"
RT_SEGMENT = "R"
COLD_SEGMENTS = "ABCDEF"
DEFAULT_ROBOT_POLLING = 500
TASK_WAIT_ROBOT_POLLING = 50

View File

@@ -7,13 +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 robot.is_cold())
needs_drying = is_aux 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
# 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:
@@ -44,30 +56,34 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
hexiposi.assert_homed()
assert_mount_position()
do_unmount = 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:
# 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))
try:
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):
#auto_unmount set to true so detection remains enabled
sample_det = unmount(force = True, auto_unmount = True)
sample_det = unmount(force = True, auto_unmount = True, next_segment=segment)
do_unmount = True
if sample_det == True:
raise Exception("Pin detected on gonio")
if is_normal and not robot.is_cold():
print "mount():83 needs_chilling"
robot.move_cold()
time.sleep(30.0)
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()
@@ -76,26 +92,26 @@ 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:
# TODO: implement room temperature for X06SA
pass
else:
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
set_hexiposi(segment)
if not force:
visual_check_hexiposi(segment)
if not robot.is_dewar():
robot.move_dewar()
robot.move_dewar()
robot.get_dewar(segment, puck, sample)
@@ -115,18 +131,32 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
robot.put_gonio()
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:
robot.move_home()
else:
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 park in RT"
robot.move_park()
elif is_normal:
print "mount/moving cold in cold"
robot.move_cold()
elif is_aux:
if was_cold:
print "mount/moving park in AUX"
robot.move_cold()
else:
robot.move_park()
else:
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)

View File

@@ -14,9 +14,13 @@ def trash():
robot.assert_cleared()
#robot.assert_in_known_point()
was_cold = robot.is_cold()
#Enabling
enable_motion()
robot.move_gonio()
robot.get_gonio()
robot.move_heater(to_bottom = False)
robot.move_heater(to_bottom = True)
@@ -31,6 +35,9 @@ def trash():
robot.move_heater(to_bottom = False)
robot.move_cold()
if was_cold:
robot.move_cold()
else:
robot.move_home()

View File

@@ -1,4 +1,4 @@
def unmount(segment = None, puck = None, sample = None, force=False, auto_unmount = False):
def unmount(segment = None, puck = None, sample = None, force=False, auto_unmount = False, next_segment="-*-"):
"""
"""
print "unmount: ", segment, puck, sample, force, auto_unmount
@@ -10,10 +10,17 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2:])
print "Mounted sample position: ", segment, puck , sample
#ZACH: these need to happen after defining segment, puck, sample
# ZAC: these need to happen after defining segment, puck, sample
is_aux = (segment == AUX_SEGMENT)
needs_chilling = not is_aux and (not robot.is_cold())
needs_drying = is_aux and robot.is_cold()
is_rt = (segment == RT_SEGMENT)
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
if not auto_unmount:
@@ -68,6 +75,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
if not force:
visual_check_hexiposi(segment)
if needs_chilling:
print "umount():78 chilling"
robot.move_cold()
time.sleep(30.)
else:
@@ -88,13 +96,16 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
Controller.getInstance().logEvent("Sample Detection", str(mount_sample_detected))
if is_aux:
robot.move_aux()
robot.put_aux( sample)
robot.move_aux()
robot.put_aux(sample)
elif is_rt:
pass # TODO: implement RT at x06sa
else:
#TODO: Should check if smart magnet detection is off?
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
robot.move_dewar()
print "unmount():100 move_dewar & put_dewar"
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
set_setting("mounted_sample_position", None)
return mount_sample_detected
finally: