###TODO: REMOVE ME def system_check(robot_move=True): pass def scan_pin(segment, puck, sample, force=False): pin_name = get_sample_name(segment, puck, sample) print "scan pin", pin_name cover_info = get_cover_location_mm() #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: if not robot.is_dewar(): robot.move_dewar(*cover_info) 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(*cover_info) 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 mount_pucks(pucks): """mount evry position from the given pucks pucks is a list of puck specification in the format: [segment][puck] Example: mount_pucks(['c4', e3', 'e2', 'f1']) """ for p in pucks: seg, puc = list(p) seg = seg.upper() puc = int(puc) print "Mounting all positions from {} {}".format(seg.upper(), puc) mount_puck_pins(seg, puc) # mount_puck_pins(seg, puc, [1, 2, 3]) # mount only pins 1, 2, 3 for each puck def mount_puck_pins(segment, puck, positions=None): """ Mounts every position from the given segment/puck.""" from time import sleep results = [] if positions is None: positions = range(1, 17) for i in positions: #b = magnet_position.getValue() mount(segment, puck, i, True, False, True) #a = magnet_position.getValue() #results.append((b, a)) #print "{:^8.3f}|{:^8.3f}".format(b, a) sleep(1.0) # print results print "{:^8s}|{:^8s}".format("Before", "After") for b,a in results: print "{:^8.3f}|{:^8.3f}".format(b, a) 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_park() ret = "Empty" if detected: if (dm is None) or (len(dm.strip())==0): ret = "Present" else: ret = str(dm) return ret