Skip to content

Commit

Permalink
removed extra code
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Dec 7, 2023
1 parent badd9af commit def1bd2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
5 changes: 0 additions & 5 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,13 +1044,10 @@ async def encoder_current_position_ot3(
mount: Union[top_types.Mount, OT3Mount],
critical_point: Optional[CriticalPoint] = None,
refresh: bool = False,
msg: Optional[str] = None,
) -> Dict[Axis, float]:
"""
Return the encoder position in absolute deck coords specified mount.
"""
if msg:
print(msg)
if refresh:
await self.refresh_positions()
elif not self._encoder_position:
Expand Down Expand Up @@ -1132,7 +1129,6 @@ async def move_to(
max_speeds: Union[None, Dict[Axis, float], OT3AxisMap[float]] = None,
_expect_stalls: bool = False,
) -> None:
print("in move to")
"""Move the critical point of the specified mount to a location
relative to the deck, at the specified speed."""
realmount = OT3Mount.from_mount(mount)
Expand Down Expand Up @@ -1697,7 +1693,6 @@ async def _hold_jaw_width(self, jaw_width_mm: float) -> None:
async def grip(
self, force_newtons: Optional[float] = None, stay_engaged: bool = True
) -> None:
print("in grip")
self._gripper_handler.check_ready_for_jaw_move("grip")
dc = self._gripper_handler.get_duty_cycle_by_grip_force(
force_newtons or self._gripper_handler.get_gripper().default_grip_force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ async def check_labware_pickup() -> None:
# and prevents the axis from spuriously dropping when e.g. the notch
# on the side of a falling tiprack catches the jaw.
await ot3api.disengage_axes([Axis.Z_G])

await ot3api.ungrip()
gripper_opened = True
if waypoint_data.dropping:
Expand All @@ -176,7 +175,6 @@ async def check_labware_pickup() -> None:
await ot3api.grip(force_newtons=labware_grip_force)
if gripper_opened:
await check_labware_pickup()

await ot3api.move_to(
mount=gripper_mount, abs_position=waypoint_data.position
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest
from decoy import Decoy, matchers
from typing import TYPE_CHECKING, Union, Optional, Any
from typing import TYPE_CHECKING, Union, Optional, Any, Tuple
from contextlib import nullcontext

from opentrons.protocol_engine.execution import EquipmentHandler, MovementHandler
Expand Down Expand Up @@ -88,6 +88,22 @@ def heater_shaker_movement_flagger(decoy: Decoy) -> HeaterShakerMovementFlagger:
return decoy.mock(cls=HeaterShakerMovementFlagger)


@pytest.fixture
def hardware_gripper_offset_data() -> Tuple[
LabwareMovementOffsetData, LabwareMovementOffsetData
]:
"""Get a set of mocked labware offset data."""
user_offset_data = LabwareMovementOffsetData(
pickUpOffset=LabwareOffsetVector(x=123, y=234, z=345),
dropOffset=LabwareOffsetVector(x=111, y=222, z=333),
)
final_offset_data = LabwareMovementOffsetData(
pickUpOffset=LabwareOffsetVector(x=-1, y=-2, z=-3),
dropOffset=LabwareOffsetVector(x=1, y=2, z=3),
)
return user_offset_data, final_offset_data


def default_experimental_movement_data() -> LabwareMovementOffsetData:
"""Experimental movement data with default values."""
return LabwareMovementOffsetData(
Expand Down Expand Up @@ -180,21 +196,17 @@ async def test_failed_gripper_pickup_error(
subject: LabwareMovementHandler,
jaw_width: float,
error_context: Any,
hardware_gripper_offset_data: Tuple[
LabwareMovementOffsetData, LabwareMovementOffsetData
],
) -> None:
"""Test that FailedGripperPickupError is raised correctly."""
# This should only be triggered when the difference between the
# gripper jaw labware widths is greater than the max allowed error.
await set_up_decoy_hardware_gripper(decoy, ot3_hardware_api, state_store)
assert ot3_hardware_api.hardware_gripper

user_offset_data = LabwareMovementOffsetData(
pickUpOffset=LabwareOffsetVector(x=123, y=234, z=345),
dropOffset=LabwareOffsetVector(x=111, y=222, z=333),
)
final_offset_data = LabwareMovementOffsetData(
pickUpOffset=LabwareOffsetVector(x=-1, y=-2, z=-3),
dropOffset=LabwareOffsetVector(x=1, y=2, z=3),
)
user_offset_data, final_offset_data = hardware_gripper_offset_data

starting_location = DeckSlotLocation(slotName=DeckSlotName.SLOT_1)
to_location = DeckSlotLocation(slotName=DeckSlotName.SLOT_2)
Expand Down Expand Up @@ -276,22 +288,17 @@ async def test_move_labware_with_gripper(
from_location: Union[DeckSlotLocation, ModuleLocation, OnLabwareLocation],
to_location: Union[DeckSlotLocation, ModuleLocation, OnLabwareLocation],
slide_offset: Optional[Point],
hardware_gripper_offset_data: Tuple[
LabwareMovementOffsetData, LabwareMovementOffsetData
],
) -> None:
"""It should perform a labware movement with gripper by delegating to OT3API."""
# TODO (spp, 2023-07-26): this test does NOT stub out movement waypoints in order to
# keep this as the semi-smoke test that it previously was. We should add a proper
# smoke test for gripper labware movement with actual labware and make this a unit test.
await set_up_decoy_hardware_gripper(decoy, ot3_hardware_api, state_store)
assert ot3_hardware_api.hardware_gripper

user_offset_data = LabwareMovementOffsetData(
pickUpOffset=LabwareOffsetVector(x=123, y=234, z=345),
dropOffset=LabwareOffsetVector(x=111, y=222, z=333),
)
final_offset_data = LabwareMovementOffsetData(
pickUpOffset=LabwareOffsetVector(x=-1, y=-2, z=-3),
dropOffset=LabwareOffsetVector(x=1, y=2, z=3),
)
user_offset_data, final_offset_data = hardware_gripper_offset_data

decoy.when(
state_store.geometry.get_final_labware_movement_offset_vectors(
Expand All @@ -306,21 +313,18 @@ async def test_move_labware_with_gripper(
labware_id="my-teleporting-labware", location=from_location
)
).then_return(Point(101, 102, 119.5))

decoy.when(
state_store.geometry.get_labware_grip_point(
labware_id="my-teleporting-labware", location=to_location
)
).then_return(Point(201, 202, 219.5))

decoy.when(ot3_hardware_api.hardware_gripper.jaw_width).then_return(89.0)

mock_tc_context_manager = decoy.mock()
decoy.when(
thermocycler_plate_lifter.lift_plate_for_labware_movement(
labware_location=from_location
)
).then_return(mock_tc_context_manager)
decoy.when(ot3_hardware_api.hardware_gripper.jaw_width).then_return(89)

expected_waypoints = [
Point(100, 100, 999), # move to above slot 1
Expand Down

0 comments on commit def1bd2

Please sign in to comment.