From 53b87052e4bfb3d0f3090f593709de0e863d593e Mon Sep 17 00:00:00 2001 From: Alise Au <20424172+ahiuchingau@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:14:41 -0500 Subject: [PATCH] fix(api): fix left mount being disengaged when moving to maintenance position (#14341) * RQA-2235 if z_L is disengaged before moving to maintenance pos, home z_l --- api/src/opentrons/hardware_control/ot3api.py | 6 ++++++ api/src/opentrons/hardware_control/protocols/__init__.py | 8 ++++++++ .../commands/calibration/move_to_maintenance_position.py | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/api/src/opentrons/hardware_control/ot3api.py b/api/src/opentrons/hardware_control/ot3api.py index a795d12f270..5da50e41c55 100644 --- a/api/src/opentrons/hardware_control/ot3api.py +++ b/api/src/opentrons/hardware_control/ot3api.py @@ -1001,6 +1001,12 @@ def _assert_encoder_ok(self, axes: Sequence[Axis]) -> None: detail={"axes": axes_str}, ) + def motor_status_ok(self, axis: Axis) -> bool: + return self._backend.check_motor_status([axis]) + + def encoder_status_ok(self, axis: Axis) -> bool: + return self._backend.check_encoder_status([axis]) + async def encoder_current_position( self, mount: Union[top_types.Mount, OT3Mount], diff --git a/api/src/opentrons/hardware_control/protocols/__init__.py b/api/src/opentrons/hardware_control/protocols/__init__.py index 4b85140f9ba..e47b54dba2c 100644 --- a/api/src/opentrons/hardware_control/protocols/__init__.py +++ b/api/src/opentrons/hardware_control/protocols/__init__.py @@ -1,6 +1,8 @@ """Typing protocols describing a hardware controller.""" from typing_extensions import Protocol, Type +from opentrons.hardware_control.types import Axis + from .module_provider import ModuleProvider from .hardware_manager import HardwareManager from .chassis_accessory_manager import ChassisAccessoryManager @@ -82,6 +84,12 @@ class FlexHardwareControlInterface( def get_robot_type(self) -> Type[FlexRobotType]: return FlexRobotType + def motor_status_ok(self, axis: Axis) -> bool: + ... + + def encoder_status_ok(self, axis: Axis) -> bool: + ... + __all__ = [ "HardwareControlAPI", diff --git a/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py b/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py index 464b177e980..b610eefe86c 100644 --- a/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py +++ b/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py @@ -80,6 +80,12 @@ async def execute( ot3_api = ensure_ot3_hardware( self._hardware_api, ) + # the 96-channel mount is disengaged during gripper calibration and + # must be homed before the gantry position can be called + if ot3_api.encoder_status_ok(Axis.Z_L) and not ot3_api.motor_status_ok( + Axis.Z_L + ): + await ot3_api.home([Axis.Z_L]) current_position_mount = await ot3_api.gantry_position( Mount.LEFT, critical_point=CriticalPoint.MOUNT )