def tip_probe(self, instrument): inst = instrument._instrument log.info('Probing tip with {}'.format(instrument.name)) self._set_state('probing') if ff.use_protocol_api_v2(): mount = Mount[instrument._instrument.mount.upper()] assert instrument.tip_racks,\ 'No known tipracks for {}'.format(instrument) tip_length = inst._tip_length_for( instrument.tip_racks[0]._container) # TODO (tm, 2019-04-22): This warns "coroutine not awaited" in # TODO: test. The test fixture probably needs to be modified to get # TODO: a synchronous adapter instead of a raw hardware_control API measured_center = self._hardware.locate_tip_probe_center( mount, tip_length) else: measured_center = calibration_functions.probe_instrument( instrument=inst, robot=inst.robot) log.info('Measured probe top center: {0}'.format(measured_center)) if ff.use_protocol_api_v2(): self._hardware.update_instrument_offset( Mount[instrument._instrument.mount.upper()], from_tip_probe=measured_center) config = self._hardware.config else: config = calibration_functions.update_instrument_config( instrument=inst, measured_center=measured_center) log.info('New config: {0}'.format(config)) self.move_to_front(instrument) self._set_state('ready')
def tip_probe(self, instrument): inst = instrument._instrument log.info('Probing tip with {}'.format(instrument.name)) self._set_state('probing') measured_center = calibration_functions.probe_instrument( instrument=inst, robot=inst.robot) log.debug('Measured probe top center: {0}'.format(measured_center)) config = calibration_functions.update_instrument_config( instrument=inst, measured_center=measured_center) log.info('New config: {0}'.format(config)) calibration_functions.move_instrument_for_probing_prep( inst, inst.robot) self._set_state('ready')
def test_update_instrument_config(fixture): from opentrons.trackers.pose_tracker import change_base from numpy import array import json robot = fixture.robot inst = fixture.instrument inst_offset = robot.config.instrument_offset[inst.mount][inst.type] cfg = update_instrument_config(instrument=inst, measured_center=(0.0, 0.0, 105.0)) new_tip_length = cfg.tip_length[inst.name] new_instrument_offset = cfg.instrument_offset[inst.mount][inst.type] assert new_tip_length == 55.0 assert new_instrument_offset == tuple(array(inst_offset) + (5.0, 5.0, 0.0)) assert tuple(change_base( robot.poses, src=inst, dst=inst.instrument_mover)) == (5.0, 5.0, 0), \ "Expected instrument position to update relative to mover in pose tree" filename = get_config_index().get('robotSettingsFile') expected = dict(robot_configs._build_config({}, {})._asdict()) expected.pop('gantry_calibration') expected['instrument_offset']['right']['single'] = [5.0, 5.0, 0.0] expected['tip_length']['Pipette'] = 55.0 with open(filename, 'r') as file: actual = json.load(file) # from pprint import pprint # print('=------> <------=') # print("Expected:") # pprint(expected) # print() # print("Actual:") # pprint(actual) # print() assert actual == expected