Skip to content

Commit

Permalink
1232131233
Browse files Browse the repository at this point in the history
  • Loading branch information
wweiye committed Nov 19, 2024
1 parent 82dbb95 commit 11147b6
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 41 deletions.
13 changes: 11 additions & 2 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ async def _move(
except ZeroLengthMoveError as zero_length_error:
self._log.info(f"{str(zero_length_error)}, ignoring")
return
self._log.info(
self._log.info(
f"move: deck {target_position} becomes machine {machine_pos} from {origin} "
f"requiring {moves}"
)
Expand Down Expand Up @@ -1990,6 +1990,7 @@ async def _force_pick_up_tip(
target_down = target_position_from_relative(
mount, top_types.Point(z=press.distance), self._current_position
)
#input("5-1111")
await self._move(target_down, speed=press.speed, expect_stalls=True)
if press.distance < 0:
# we expect a stall has happened during a downward movement into the tiprack, so
Expand Down Expand Up @@ -2049,38 +2050,46 @@ def add_tip_to_instr() -> None:
and instrument.nozzle_manager.current_configuration.configuration
== NozzleConfigurationType.FULL
):
#input("11111")
spec = self._pipette_handler.plan_ht_pick_up_tip(
instrument.nozzle_manager.current_configuration.tip_count
)
#input("22222")
if spec.z_distance_to_tiprack:
await self.move_rel(
realmount, top_types.Point(z=spec.z_distance_to_tiprack)
)
#input("3333")
await self._tip_motor_action(realmount, spec.tip_action_moves)
else:
#input("44444")
spec = self._pipette_handler.plan_lt_pick_up_tip(
realmount,
instrument.nozzle_manager.current_configuration.tip_count,
presses,
increment,
)
#input("55555")
await self._force_pick_up_tip(realmount, spec)

# neighboring tips tend to get stuck in the space between
# the volume chamber and the drop-tip sleeve on p1000.
# This extra shake ensures those tips are removed
#input("6666")
for rel_point, speed in spec.shake_off_moves:
await self.move_rel(realmount, rel_point, speed=speed)

# fixme: really only need this during labware position check so user
# can verify if a tip is properly attached
#input("7777")
if spec.ending_z_retract_distance:
await self.move_rel(
realmount, top_types.Point(z=spec.ending_z_retract_distance)
)

#input("8888")
add_tip_to_instr()

#input("9999")
if prep_after:
await self.prepare_for_aspirate(realmount)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,11 @@ def _get_ideal_labware_locations(
fixture_slot_pos = helpers_ot3.get_slot_bottom_left_position_ot3(
test_config.slot_fixture
)
# fixture_loc_ideal = fixture_slot_pos + pressure_fixture_a1_location(
# test_config.fixture_side
# )
fixture_loc_ideal = fixture_slot_pos
fixture_loc = fixture_slot_pos + pressure_fixture_a1_location(
test_config.fixture_side
)
fixture_loc_ideal =Point(x=fixture_loc.x, y=fixture_loc.y, z=fixture_loc.z-8)
#fixture_loc_ideal = fixture_slot_pos
if pipette_channels == 8:
reservoir_loc_ideal += MULTI_CHANNEL_1_OFFSET
trash_loc_ideal += MULTI_CHANNEL_1_OFFSET
Expand Down Expand Up @@ -353,17 +354,18 @@ async def _pick_up_tip_newfixture(
expected: Optional[Point],
actual: Optional[Point],
tip_volume: Optional[float] = None,
movezval:float=1
) -> Point:
# actual = await _move_to_or_calibrate(api, mount, expected, actual)
# tip_offset = _tip_name_to_xy_offset(tip)
# tip_pos = actual + tip_offset
# await helpers_ot3.move_to_arched_ot3(
# api, mount, tip_pos, safe_height=tip_pos.z + SAFE_HEIGHT_TRAVEL
# )
# if not tip_volume:
# pip = api.hardware_pipettes[mount.to_mount()]
# assert pip
# tip_volume = pip.working_volume
actual = await _move_to_or_calibrate(api, mount, expected, actual)
tip_offset = _tip_name_to_xy_offset(tip)
tip_pos = actual + tip_offset
await helpers_ot3.move_to_arched_ot3(
api, mount, tip_pos, safe_height=tip_pos.z + SAFE_HEIGHT_TRAVEL
)
if not tip_volume:
pip = api.hardware_pipettes[mount.to_mount()]
assert pip
tip_volume = pip.working_volume
tip_length = helpers_ot3.get_default_tip_length(int(tip_volume))
try:
await api.pick_up_tip(mount, tip_length=tip_length)
Expand All @@ -374,8 +376,9 @@ async def _pick_up_tip_newfixture(
LOG_GING.error(prinval)
FINAL_TEST_FAIL_INFOR.append(prinval)
ui.print_fail(prinval)

await api.move_rel(mount, Point(z=tip_length))
if movezval ==1:
await api.move_rel(mount, Point(z=int(tip_length*0.2)))
print("movez")
return actual

async def _pick_up_tip_for_tip_volume(
Expand Down Expand Up @@ -417,21 +420,23 @@ async def _pick_up_tip_for_tip_volume(
raise ValueError(f"unexpected tip volume: {tip_volume}")

async def _pick_up_tip_for_fixture(
api: OT3API, mount: OT3Mount, tip_volume: int
api: OT3API, mount: OT3Mount, tip_volume: int,movez:float=1
) -> None:
pip = api.hardware_pipettes[mount.to_mount()]
assert pip
pip_channels = pip.channels.value
tip = _available_tips[tip_volume][0]
_available_tips[tip_volume] = _available_tips[tip_volume][pip_channels:]
tip = _available_tips[tip_volume][0]
await _pick_up_tip_newfixture(
print("1",IDEAL_LABWARE_LOCATIONS.fixture)
print("2",CALIBRATED_LABWARE_LOCATIONS.fixture)
CALIBRATED_LABWARE_LOCATIONS.fixture = await _pick_up_tip_newfixture(
api,
mount,
tip,
IDEAL_LABWARE_LOCATIONS.fixture,
CALIBRATED_LABWARE_LOCATIONS.fixture,
tip_volume=tip_volume,
movezval=movez
)

async def _move_to_reservoir_liquid(api: OT3API, mount: OT3Mount) -> None:
Expand Down Expand Up @@ -711,7 +716,7 @@ async def _fixture_check_pressure(
pip_vol = int(pip.working_volume)
pip_channels = int(pip.channels)

await _pick_up_tip_for_fixture(api, mount, tip_volume=tip_volume)
await _pick_up_tip_for_fixture(api, mount, tip_volume=tip_volume,movez=False)
# above the fixture
r, _ = await _read_pressure_and_check_results(
api,
Expand All @@ -725,18 +730,15 @@ async def _fixture_check_pressure(
)
results.append(r)
# insert into the fixture
# NOTE: unknown amount of pressure here (depends on where Z was calibrated)
fixture_depth = PRESSURE_FIXTURE_INSERT_DEPTH[pip_vol]
#await api.move_rel(mount, Point(z=-fixture_depth))
# : unknown amount of pressure here (depends on where Z was calibrated)
fixture_depth = 80
await api.move_rel(mount, Point(z=fixture_depth))
#input("JX")
await _drop_tip_in_trash(api, mount)



await _move_to_fixture(api, mount)

input("继续")
await _pick_up_tip_for_fixture(api, mount, tip_volume=tip_volume)
await asyncio.sleep(1)
#await _move_to_fixture(api, mount)
await api.move_rel(mount, Point(z=fixture_depth))
await _pick_up_tip_for_fixture(api, mount, tip_volume=tip_volume,movez=False)
await asyncio.sleep(10)
r, inserted_pressure_data = await _read_pressure_and_check_results(
api,
pip_channels,
Expand All @@ -749,8 +751,9 @@ async def _fixture_check_pressure(
)
results.append(r)
# aspirate 50uL
print(111)
await api.aspirate(mount, PRESSURE_FIXTURE_ASPIRATE_VOLUME[pip_vol])
await asyncio.sleep(1)
await asyncio.sleep(2)
if pip_vol == 50:
asp_evt = PressureEvent.ASPIRATE_P50
else:
Expand All @@ -768,8 +771,10 @@ async def _fixture_check_pressure(
)
results.append(r)
# dispense
await api.dispense(mount, PRESSURE_FIXTURE_ASPIRATE_VOLUME[pip_vol])
await asyncio.sleep(1)
print(1)
await api.dispense(mount, PRESSURE_FIXTURE_ASPIRATE_VOLUME[pip_vol],0.5)
input("jxxx")
await asyncio.sleep(2)
r, _ = await _read_pressure_and_check_results(
api,
pip_channels,
Expand All @@ -781,9 +786,13 @@ async def _fixture_check_pressure(
pip_channels,
)
results.append(r)
print(2)
# retract out of fixture
await api.move_rel(mount, Point(z=fixture_depth))
await asyncio.sleep(1)
#await api.move_rel(mount, Point(z=fixture_depth))
await api.drop_tip(mount, home_after=False)
tip_length2 = helpers_ot3.get_default_tip_length(int(tip_volume))
await api.move_rel(mount, Point(z=int(tip_length2*0.1)))
await asyncio.sleep(2)
r, _ = await _read_pressure_and_check_results(
api,
pip_channels,
Expand All @@ -795,6 +804,14 @@ async def _fixture_check_pressure(
pip_channels,
)
results.append(r)
print(3)
#drop tip fixture
#input("tuzg1")
#await api.drop_tip(mount, home_after=False)
#input("tuzg2")
await api.move_rel(mount, Point(z=fixture_depth))
#input("JX")
print("results",results)
return False not in results


Expand Down Expand Up @@ -825,7 +842,7 @@ async def _test_for_leak(
# LOG_GING.info(f"current_val:{current_val}")
# await helpers_ot3.update_pick_up_current(api,mount,current_val)
if fixture:
await _move_to_fixture(api, mount)
#await _move_to_fixture(api, mount)
assert write_cb, "pressure fixture requires recording data to disk"
assert (
accumulate_raw_data_cb
Expand All @@ -839,7 +856,7 @@ async def _test_for_leak(
test_passed = await _aspirate_and_look_for_droplets(
api, mount, droplet_wait_seconds
)
await _drop_tip_in_trash(api, mount)
await _drop_tip_in_trash(api, mount)
return test_passed


Expand Down Expand Up @@ -1445,7 +1462,7 @@ async def _test_diagnostics(api: OT3API, mount: OT3Mount, write_cb: Callable) ->
#print(f"pressure: {_bool_to_pass_fail(pressure_pass)}")
LOG_GING.info(f"pressure: {_bool_to_pass_fail(pressure_pass)}")
write_cb(["diagnostics-pressure", _bool_to_pass_fail(pressure_pass)])
return environment_pass and pressure_pass and encoder_pass and capacitance_pass
#return environment_pass and pressure_pass and encoder_pass and capacitance_pass


async def _test_plunger_positions(
Expand Down Expand Up @@ -1975,6 +1992,7 @@ async def _main(test_config: TestConfig) -> None: # noqa: C901
IDEAL_LABWARE_LOCATIONS = _get_ideal_labware_locations(
test_config, pipette_channels
)
print("IDEAL_LABWARE_LOCATIONS:",IDEAL_LABWARE_LOCATIONS)
CALIBRATED_LABWARE_LOCATIONS = LabwareLocations(
trash=None,
tip_rack_1000=None,
Expand Down Expand Up @@ -2225,6 +2243,7 @@ async def _main(test_config: TestConfig) -> None: # noqa: C901
write_cb=csv_cb.write,
accumulate_raw_data_cb=csv_cb.pressure,
)
print("test_passed",test_passed)
csv_cb.results("pressure", test_passed)

if not test_config.skip_tip_presence:
Expand Down

0 comments on commit 11147b6

Please sign in to comment.