Skip to content

Commit

Permalink
fix(app, api): expose failOnNotHomed parameter for save_position comm…
Browse files Browse the repository at this point in the history
…and (#14139)

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.
  • Loading branch information
mjhuff authored Dec 7, 2023
1 parent bd38336 commit 7677f9a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
8 changes: 7 additions & 1 deletion api/src/opentrons/protocol_engine/commands/save_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class SavePositionParams(BaseModel):
description="An optional ID to assign to this command instance. "
"Auto-assigned if not defined.",
)
failOnNotHomed: Optional[bool] = Field(
True, descrption="Require all axes to be homed before saving position."
)


class SavePositionResult(BaseModel):
Expand Down Expand Up @@ -58,8 +61,11 @@ def __init__(
async def execute(self, params: SavePositionParams) -> SavePositionResult:
"""Check the requested pipette's current position."""
position_id = self._model_utils.ensure_id(params.positionId)
fail_on_not_homed = (
params.failOnNotHomed if params.failOnNotHomed is not None else True
)
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=fail_on_not_homed
)

return SavePositionResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
1 change: 1 addition & 0 deletions app/src/organisms/DropTipWizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export const DropTipWizardComponent = (
commandType: 'savePosition' as const,
params: {
pipetteId: MANAGED_PIPETTE_ID,
failOnNotHomed: false,
},
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ stages:
status: succeeded
params:
pipetteId: pipetteId
failOnNotHomed: true
result:
positionId: !anystr
position:
Expand Down Expand Up @@ -539,6 +540,7 @@ stages:
params:
pipetteId: pipetteId
positionId: positionId
failOnNotHomed: true
result:
positionId: positionId
position:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ stages:
status: succeeded
params:
pipetteId: pipetteId
failOnNotHomed: true
result:
positionId: !anystr
position:
Expand Down Expand Up @@ -574,6 +575,7 @@ stages:
params:
pipetteId: pipetteId
positionId: positionId
failOnNotHomed: true
result:
positionId: positionId
position:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ stages:
status: succeeded
params:
pipetteId: pipetteId
failOnNotHomed: true
result:
positionId: !anystr
position:
Expand Down Expand Up @@ -571,6 +572,7 @@ stages:
params:
pipetteId: pipetteId
positionId: positionId
failOnNotHomed: true
result:
positionId: positionId
position:
Expand Down
6 changes: 6 additions & 0 deletions shared-data/command/schemas/8.json
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,12 @@
"title": "Positionid",
"description": "An optional ID to assign to this command instance. Auto-assigned if not defined.",
"type": "string"
},
"failOnNotHomed": {
"title": "Failonnothomed",
"default": true,
"descrption": "Require all axes to be homed before saving position.",
"type": "boolean"
}
},
"required": ["pipetteId"]
Expand Down
1 change: 1 addition & 0 deletions shared-data/command/types/gantry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7677f9a

Please sign in to comment.