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

feat(api): change liquid_probe to respect min well height #15488

Merged
merged 12 commits into from
Jun 26, 2024
Next Next commit
feat(api): change liquid_probe to respect min well height
Add logic to liquid_probe_in_place that will not go to the very bottom of the well, but stop
slightly above it(as specified by the well's minimum height)

fix EXEC-576
  • Loading branch information
aaron-kulkarni committed Jun 21, 2024
commit 53b3131c7cb1144d08999c8a4cabf56d4b3b51b3
3 changes: 2 additions & 1 deletion api/src/opentrons/protocol_engine/execution/pipetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ async def liquid_probe_in_place(
)
well_def = self._state_view.labware.get_well_definition(labware_id, well_name)
well_depth = well_def.depth
well_min_height = self._state_view.labware.get_well_min_height(labware_id, well_name)
z_pos = await self._hardware_api.liquid_probe(
mount=hw_pipette.mount, max_z_dist=well_depth
mount=hw_pipette.mount, max_z_dist=well_depth-well_min_height
)
return float(z_pos)

Expand Down
36 changes: 36 additions & 0 deletions api/src/opentrons/protocol_engine/state/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,42 @@ def get_should_center_pipette_on_target_well(self, labware_id: str) -> bool:
len(self.get_definition(labware_id).wells) == 1
or len(self.get_definition(labware_id).wells) >= 96
)

def get_well_min_height(
self, labware_id: str, well_name: str
) -> float:
"""Get's the minimum distance that a liquid probe must stop
away from the bottom of a well.

Args:
labware_id: Labware identifier.
well_name: Name of well in labware.

Returns:
A single float representing the distance, in millimeters.
"""
well_definition = self.get_definition(labware_id)
try:
height_reqs = well_definition.liquidProbeParameters.minimumHeight
if len(height_reqs) == 0:
#TODO: find out what to actually do here
return 0.5
if len(height_reqs) == 1:
return height_reqs[0].value
default_val = 0.5
for entry in height_reqs:
if well_name in entry.applicableWells:
return entry.value
if entry.applicableWells == []:
default_val = entry.value
#No explicit height for this well, return default
return default_val
except AttributeError as e: #No liquidProbeParameters defined for this labware
#TODO: find out what to actually do here
return 0
# raise errors.HardwareNotSupportedError(
# f"Labware {labware_id} does not have specifications for minimum height."
# ) from e

def get_well_definition(
self,
Expand Down
Loading