Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app, api): expose failOnNotHomed parameter for save_position command #14139

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading