From b5eeb4ed10a8e5c8b5eec4a753b3095088a746a8 Mon Sep 17 00:00:00 2001 From: Jamey H Date: Thu, 7 Dec 2023 14:42:28 -0500 Subject: [PATCH] fix(app, api): expose failOnNotHomed parameter for save_position command Drop tip flows require saving pipette positions without homing the plunger axis (we definitely do not want to home the plunger). The save_position command should optionally expose a failOnNotHomed parameter to prevent an error from being thrown when the plunger is not homed. --- api/src/opentrons/protocol_engine/commands/save_position.py | 5 ++++- .../opentrons/protocol_engine/commands/test_save_position.py | 5 +---- app/src/organisms/DropTipWizard/index.tsx | 1 + shared-data/command/types/gantry.ts | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/src/opentrons/protocol_engine/commands/save_position.py b/api/src/opentrons/protocol_engine/commands/save_position.py index 5e38b902058b..a351a677aec3 100644 --- a/api/src/opentrons/protocol_engine/commands/save_position.py +++ b/api/src/opentrons/protocol_engine/commands/save_position.py @@ -26,6 +26,9 @@ class SavePositionParams(BaseModel): description="An optional ID to assign to this command instance. " "Auto-assigned if not defined.", ) + failOnNotHomed: bool = Field( + True, descrption="Require all axes to be homed before saving position." + ) class SavePositionResult(BaseModel): @@ -59,7 +62,7 @@ async def execute(self, params: SavePositionParams) -> SavePositionResult: """Check the requested pipette's current position.""" position_id = self._model_utils.ensure_id(params.positionId) x, y, z = await self._gantry_mover.get_position( - pipette_id=params.pipetteId, fail_on_not_homed=True + pipette_id=params.pipetteId, fail_on_not_homed=params.failOnNotHomed ) return SavePositionResult( diff --git a/api/tests/opentrons/protocol_engine/commands/test_save_position.py b/api/tests/opentrons/protocol_engine/commands/test_save_position.py index e31f44c779cf..99b52a4cd423 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_save_position.py +++ b/api/tests/opentrons/protocol_engine/commands/test_save_position.py @@ -35,10 +35,7 @@ async def test_save_position_implementation( subject = SavePositionImplementation( model_utils=mock_model_utils, gantry_mover=mock_gantry_mover ) - params = SavePositionParams( - pipetteId="abc", - positionId="123", - ) + params = SavePositionParams(pipetteId="abc", positionId="123", failOnNotHomed=True) decoy.when(mock_model_utils.ensure_id("123")).then_return("456") diff --git a/app/src/organisms/DropTipWizard/index.tsx b/app/src/organisms/DropTipWizard/index.tsx index d533c82ea8fd..29a9e755a4a9 100644 --- a/app/src/organisms/DropTipWizard/index.tsx +++ b/app/src/organisms/DropTipWizard/index.tsx @@ -292,6 +292,7 @@ export const DropTipWizardComponent = ( commandType: 'savePosition' as const, params: { pipetteId: MANAGED_PIPETTE_ID, + failOnNotHomed: false, }, }, ] diff --git a/shared-data/command/types/gantry.ts b/shared-data/command/types/gantry.ts index c119b63dd39c..435188d948d5 100644 --- a/shared-data/command/types/gantry.ts +++ b/shared-data/command/types/gantry.ts @@ -156,6 +156,7 @@ interface MoveRelativeParams { interface SavePositionParams { pipetteId: string // pipette to use in measurement positionId?: string // position ID, auto-assigned if left blank + failOnNotHomed?: boolean // Defaults to true if blank. Require every possible axis to be homed to save. } interface HomeParams {