95 lines
2.2 KiB
Python
95 lines
2.2 KiB
Python
def scan_pin(segment, puck, sample, force=False):
|
|
pin_name = get_sample_name(segment, puck, sample)
|
|
|
|
print "scan pin", pin_name
|
|
#Initial checks
|
|
assert_valid_address(segment, puck, sample)
|
|
assert_puck_detected(segment, puck)
|
|
is_aux = (segment == AUX_SEGMENT)
|
|
|
|
if robot.simulated:
|
|
time.sleep(0.5)
|
|
return "Present"
|
|
|
|
robot.assert_no_task()
|
|
robot.reset_motion()
|
|
robot.wait_ready()
|
|
robot.assert_cleared()
|
|
#robot.assert_in_known_point()
|
|
|
|
#Enabling
|
|
|
|
set_status("Scanning pin: " + str(pin_name))
|
|
|
|
enable_motion()
|
|
|
|
if is_aux:
|
|
if not robot.is_aux():
|
|
robot.move_aux()
|
|
|
|
robot.get_aux(sample)
|
|
else:
|
|
set_hexiposi(segment)
|
|
if not force:
|
|
visual_check_hexiposi(segment)
|
|
|
|
if not robot.is_dewar():
|
|
robot.move_dewar()
|
|
|
|
robot.get_dewar(segment, puck, sample)
|
|
|
|
(detected, dm) = move_scanner()
|
|
update_samples_info_sample_scan(get_puck_name(segment, puck), sample, detected, dm)
|
|
|
|
if is_aux:
|
|
robot.move_aux()
|
|
robot.put_aux( sample)
|
|
else:
|
|
robot.move_dewar()
|
|
robot.put_dewar(segment, puck, sample)
|
|
ret = "Empty"
|
|
if detected:
|
|
if (dm is None) or (len(dm.strip())==0):
|
|
ret = "Present"
|
|
else:
|
|
ret = str(dm)
|
|
return ret
|
|
|
|
|
|
def scan_puck(segment, puck, force=False):
|
|
if segment == AUX_SEGMENT:
|
|
raise Exception("Cannot scan auxiliary puck")
|
|
ret = []
|
|
for i in range(16):
|
|
ret.append(scan_pin (segment, puck, i+1, force))
|
|
return ret
|
|
|
|
|
|
def scan_gripper():
|
|
print "scan gripper"
|
|
#Initial checks
|
|
|
|
robot.assert_no_task()
|
|
robot.reset_motion()
|
|
robot.wait_ready()
|
|
robot.assert_cleared()
|
|
#robot.assert_in_known_point()
|
|
|
|
#Enabling
|
|
|
|
set_status("Scanning gripper")
|
|
|
|
enable_motion()
|
|
|
|
(detected, dm) = move_scanner()
|
|
|
|
robot.move_home()
|
|
|
|
ret = "Empty"
|
|
if detected:
|
|
if (dm is None) or (len(dm.strip())==0):
|
|
ret = "Present"
|
|
else:
|
|
ret = str(dm)
|
|
return ret
|