diff --git a/api/src/opentrons/protocol_api/protocol_context.py b/api/src/opentrons/protocol_api/protocol_context.py index 26f2ab1a1619..88be8a8ced43 100644 --- a/api/src/opentrons/protocol_api/protocol_context.py +++ b/api/src/opentrons/protocol_api/protocol_context.py @@ -218,14 +218,14 @@ def api_version(self) -> APIVersion: return self._api_version @property - @requires_version(2, 21) + @requires_version(2, 22) def robot(self) -> RobotContext: """The :py:class:`.RobotContext` for the protocol. :meta private: """ if self._core.robot_type != "OT-3 Standard" or not self._robot: - raise RobotTypeError("The RobotContext is only available on Flex robot.") + raise RobotTypeError("The RobotContext is only available on Flex robots.") return self._robot @property diff --git a/api/src/opentrons/protocol_api/robot_context.py b/api/src/opentrons/protocol_api/robot_context.py index 8447cb4217d5..272330e16647 100644 --- a/api/src/opentrons/protocol_api/robot_context.py +++ b/api/src/opentrons/protocol_api/robot_context.py @@ -56,7 +56,7 @@ def __init__( self._api_version = api_version @property - @requires_version(2, 21) + @requires_version(2, 22) def api_version(self) -> APIVersion: return self._api_version @@ -67,7 +67,7 @@ def hardware(self) -> HardwareManager: # context commands. return self._hardware - @requires_version(2, 21) + @requires_version(2, 22) def move_to( self, mount: Union[Mount, str], @@ -88,7 +88,7 @@ def move_to( mount = validation.ensure_instrument_mount(mount) self._core.move_to(mount, destination.point, speed) - @requires_version(2, 21) + @requires_version(2, 22) def move_axes_to( self, axis_map: Union[AxisMapType, StringAxisMap], @@ -120,7 +120,7 @@ def move_axes_to( critical_point = None self._core.move_axes_to(axis_map, critical_point, speed) - @requires_version(2, 21) + @requires_version(2, 22) def move_axes_relative( self, axis_map: Union[AxisMapType, StringAxisMap], diff --git a/api/src/opentrons/protocol_engine/execution/gantry_mover.py b/api/src/opentrons/protocol_engine/execution/gantry_mover.py index 1cb50f21418d..05680ca46b97 100644 --- a/api/src/opentrons/protocol_engine/execution/gantry_mover.py +++ b/api/src/opentrons/protocol_engine/execution/gantry_mover.py @@ -33,7 +33,7 @@ MotorAxis.RIGHT_PLUNGER: HardwareAxis.C, MotorAxis.EXTENSION_Z: HardwareAxis.Z_G, MotorAxis.EXTENSION_JAW: HardwareAxis.G, - MotorAxis.CLAMP_JAW_96_CHANNEL: HardwareAxis.Q, + MotorAxis.AXIS_96_CHANNEL_CAM: HardwareAxis.Q, } _MOTOR_AXIS_TO_HARDWARE_MOUNT: Dict[MotorAxis, Mount] = { @@ -61,7 +61,7 @@ HardwareAxis.Z_R: MotorAxis.RIGHT_Z, HardwareAxis.Z_G: MotorAxis.EXTENSION_Z, HardwareAxis.G: MotorAxis.EXTENSION_JAW, - HardwareAxis.Q: MotorAxis.CLAMP_JAW_96_CHANNEL, + HardwareAxis.Q: MotorAxis.AXIS_96_CHANNEL_CAM, } # The height of the bottom of the pipette nozzle at home position without any tips. @@ -328,7 +328,7 @@ async def move_axes( axis_map: The mapping of axes to command. critical_point: A critical point override for axes speed: Optional speed parameter for the move. - relative_move: Specifying whether a relative move needs to be handled or not. + relative_move: Whether the axis map needs to be converted from a relative to absolute move. """ try: pos_hw = self._convert_axis_map_for_hw(axis_map) @@ -544,10 +544,8 @@ def get_max_travel_z_from_mount(self, mount: MountType) -> float: """Get the maximum allowed z-height for mount.""" pipette = self._state_view.pipettes.get_by_mount(mount) if self._state_view.config.robot_type == "OT-2 Standard": - instrument_height = ( - self._state_view.pipettes.get_instrument_max_height_ot2(pipette.id) - if pipette - else VIRTUAL_MAX_OT3_HEIGHT + instrument_height = self._state_view.pipettes.get_instrument_max_height_ot2( + pipette.id ) else: instrument_height = VIRTUAL_MAX_OT3_HEIGHT diff --git a/api/src/opentrons/protocol_engine/execution/movement.py b/api/src/opentrons/protocol_engine/execution/movement.py index d05bc3851e79..9e391160a25a 100644 --- a/api/src/opentrons/protocol_engine/execution/movement.py +++ b/api/src/opentrons/protocol_engine/execution/movement.py @@ -147,6 +147,7 @@ async def move_to_well( async def move_mount_to( self, mount: MountType, destination: DeckPoint, speed: Optional[float] = None ) -> Point: + """Move mount to a specific location on the deck.""" hw_mount = mount.to_hw_mount() await self._gantry_mover.prepare_for_mount_movement(hw_mount) origin = await self._gantry_mover.get_position_from_mount(mount=hw_mount) diff --git a/api/src/opentrons/protocol_engine/types.py b/api/src/opentrons/protocol_engine/types.py index 425735515cd1..24a3b9863e0e 100644 --- a/api/src/opentrons/protocol_engine/types.py +++ b/api/src/opentrons/protocol_engine/types.py @@ -442,7 +442,7 @@ class MotorAxis(str, Enum): RIGHT_PLUNGER = "rightPlunger" EXTENSION_Z = "extensionZ" EXTENSION_JAW = "extensionJaw" - CLAMP_JAW_96_CHANNEL = "clampJaw96Channel" + AXIS_96_CHANNEL_CAM = "axis96ChannelCam" # TODO(mc, 2022-01-18): use opentrons_shared_data.module.types.ModuleModel diff --git a/api/src/opentrons/types.py b/api/src/opentrons/types.py index b61d42849306..29b4cb7ef8e0 100644 --- a/api/src/opentrons/types.py +++ b/api/src/opentrons/types.py @@ -294,7 +294,7 @@ def ot2_axes(cls) -> List["AxisType"]: ] @classmethod - def ot3_gantry_axes(cls) -> List["AxisType"]: + def flex_gantry_axes(cls) -> List["AxisType"]: return [ AxisType.X, AxisType.Y, @@ -316,6 +316,7 @@ def ot2_gantry_axes(cls) -> List["AxisType"]: AxisMapType = Dict[AxisType, float] StringAxisMap = Dict[str, float] + # TODO(mc, 2020-11-09): this makes sense in shared-data or other common # model library # https://github.com/Opentrons/opentrons/pull/6943#discussion_r519029833 diff --git a/api/tests/opentrons/protocol_api/test_robot_context.py b/api/tests/opentrons/protocol_api/test_robot_context.py index f60869c3813e..3e0be14b865d 100644 --- a/api/tests/opentrons/protocol_api/test_robot_context.py +++ b/api/tests/opentrons/protocol_api/test_robot_context.py @@ -1,3 +1,4 @@ +"""Test the functionality of the `RobotContext`.""" import pytest from decoy import Decoy from typing import Union, Optional @@ -32,6 +33,7 @@ def api_version() -> APIVersion: @pytest.fixture def mock_deck(decoy: Decoy) -> Deck: + """Get a mocked deck object.""" deck = decoy.mock(cls=Deck) decoy.when(deck.get_slot_center(DeckSlotName.SLOT_D1.value)).then_return( Point(3, 3, 3) diff --git a/api/tests/opentrons/protocol_api/test_validation.py b/api/tests/opentrons/protocol_api/test_validation.py index 56453e09fd09..c7f35a1519ee 100644 --- a/api/tests/opentrons/protocol_api/test_validation.py +++ b/api/tests/opentrons/protocol_api/test_validation.py @@ -595,6 +595,7 @@ def test_ensure_axis_map_type_success( is_96_channel: bool, expected_axis_map: AxisMapType, ) -> None: + """Check that axis map type validation returns the correct shape.""" res = subject.ensure_axis_map_type(axis_map, robot_type, is_96_channel) assert res == expected_axis_map @@ -634,6 +635,7 @@ def test_ensure_axis_map_type_failure( is_96_channel: bool, error_message: str, ) -> None: + """Check that axis_map validation occurs for the given scenarios.""" with pytest.raises(subject.IncorrectAxisError, match=error_message): subject.ensure_axis_map_type(axis_map, robot_type, is_96_channel) @@ -656,5 +658,6 @@ def test_ensure_axis_map_type_failure( def test_ensure_only_gantry_axis_map_type( axis_map: AxisMapType, robot_type: RobotType, error_message: str ) -> None: + """Check that gantry axis_map validation occurs for the given scenarios.""" with pytest.raises(subject.IncorrectAxisError, match=error_message): subject.ensure_only_gantry_axis_map_type(axis_map, robot_type) diff --git a/api/tests/opentrons/protocol_engine/commands/robot/__init__.py b/api/tests/opentrons/protocol_engine/commands/robot/__init__.py index e69de29bb2d1..36375876456f 100644 --- a/api/tests/opentrons/protocol_engine/commands/robot/__init__.py +++ b/api/tests/opentrons/protocol_engine/commands/robot/__init__.py @@ -0,0 +1 @@ +"""Tests for Robot Module commands.""" diff --git a/api/tests/opentrons/protocol_engine/execution/test_gantry_mover.py b/api/tests/opentrons/protocol_engine/execution/test_gantry_mover.py index 7baaf4df4810..2c872c003d1e 100644 --- a/api/tests/opentrons/protocol_engine/execution/test_gantry_mover.py +++ b/api/tests/opentrons/protocol_engine/execution/test_gantry_mover.py @@ -501,7 +501,7 @@ async def test_home_z( }, ], [ - {MotorAxis.CLAMP_JAW_96_CHANNEL: 10.0}, + {MotorAxis.AXIS_96_CHANNEL_CAM: 10.0}, None, False, Mount.LEFT, @@ -522,6 +522,7 @@ async def test_move_axes( call_to_hw: "OrderedDict[HardwareAxis, float]", final_position: Dict[HardwareAxis, float], ) -> None: + """Test the move axes function.""" subject = HardwareGantryMover( state_view=mock_state_view, hardware_api=ot3_hardware_api ) @@ -690,10 +691,10 @@ async def test_virtual_move_to( {MotorAxis.X: 0.0, MotorAxis.Y: 0.0, MotorAxis.RIGHT_Z: 20}, ], [ - {MotorAxis.CLAMP_JAW_96_CHANNEL: 10}, + {MotorAxis.AXIS_96_CHANNEL_CAM: 10}, None, False, - {MotorAxis.CLAMP_JAW_96_CHANNEL: 10}, + {MotorAxis.AXIS_96_CHANNEL_CAM: 10}, ], ], ) diff --git a/hardware-testing/hardware_testing/opentrons_api/helpers_ot3.py b/hardware-testing/hardware_testing/opentrons_api/helpers_ot3.py index 4f06b7597ce4..6c4e05f1ba85 100644 --- a/hardware-testing/hardware_testing/opentrons_api/helpers_ot3.py +++ b/hardware-testing/hardware_testing/opentrons_api/helpers_ot3.py @@ -620,14 +620,12 @@ async def move_tip_motor_relative_ot3( raise RuntimeError("No pipette found on LEFT mount") current_gear_pos = api._backend.gear_motor_position or 0.0 - target_pos = {Axis.Q: current_gear_pos + distance} + target_pos = current_gear_pos + distance if speed is not None and distance < 0: speed *= -1 - _move_coro = api._backend.tip_action( - current_gear_pos, [(target_pos, speed or 400)] - ) + _move_coro = api._backend.tip_action(current_gear_pos, [(target_pos, speed or 400)]) if motor_current is None: await _move_coro else: