99 lines
3.3 KiB
Python
99 lines
3.3 KiB
Python
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
|
|
tg = time.time
|
|
t1 = tg()
|
|
|
|
if (segment is None) or (puck is None) or (sample is None):
|
|
pos = get_setting("mounted_sample_position")
|
|
if pos is None:
|
|
raise Exception("Mounted sample position is not defined")
|
|
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2:])
|
|
print "%4.1f Mounted sample position: %s%s-%s" % (tg() - t1, segment, puck , sample)
|
|
# ZAC: these need to happen after defining segment, puck, sample
|
|
is_aux = (segment == AUX_SEGMENT)
|
|
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:
|
|
print "%4.1f s asserting" % (tg() - t1,)
|
|
print "assert valid address"
|
|
assert_valid_address(segment, puck, sample)
|
|
print " assert puck detected"
|
|
assert_puck_detected(segment, puck)
|
|
|
|
if robot.simulated:
|
|
time.sleep(3.0)
|
|
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
|
|
set_setting("mounted_sample_position", None)
|
|
return False
|
|
|
|
print "assert no task"
|
|
robot.assert_no_task()
|
|
print "reset motion"
|
|
robot.reset_motion()
|
|
print "wait ready"
|
|
robot.wait_ready()
|
|
print "assert cleared"
|
|
robot.assert_cleared()
|
|
#robot.assert_in_known_point()
|
|
print "assert homed"
|
|
hexiposi.assert_homed()
|
|
print "assert mount pos"
|
|
assert_mount_position()
|
|
|
|
set_status("Unmounting: " + str(segment) + str(puck) + str(sample))
|
|
Controller.getInstance().logEvent("Unmount Sample", str(segment) + str(puck) + str(sample))
|
|
|
|
try:
|
|
enable_motion()
|
|
|
|
if is_normal:
|
|
set_hexiposi(segment)
|
|
|
|
if not force:
|
|
visual_check_hexiposi(segment)
|
|
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():
|
|
robot.move_gonio()
|
|
|
|
curpos = cryopos.getPosition()
|
|
speed = cryopos.getSpeed() / 1000.
|
|
movetime = int(round(1000 + abs(15. - curpos) / speed))
|
|
cryopos.move(15.0, movetime)
|
|
cryopos.waitValueInRange(15.0, 1.0, movetime)
|
|
|
|
robot.get_gonio()
|
|
|
|
if is_aux:
|
|
robot.move_aux()
|
|
robot.put_aux(sample)
|
|
elif is_rt:
|
|
pass # TODO: implement RT at x06sa
|
|
else:
|
|
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 False
|
|
finally:
|
|
pass |