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
Prev Previous commit
Next Next commit
Change default values for min_height
  • Loading branch information
aaron-kulkarni committed Jun 21, 2024
commit f498b755623eb622d57fcdae9b32a9ea9f01f2e7
6 changes: 4 additions & 2 deletions api/src/opentrons/protocol_engine/execution/pipetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,11 @@ 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)
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-well_min_height
mount=hw_pipette.mount, max_z_dist=well_depth - well_min_height
)
return float(z_pos)

Expand Down
24 changes: 9 additions & 15 deletions api/src/opentrons/protocol_engine/state/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,8 @@ 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:

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.

Expand All @@ -427,27 +425,23 @@ def get_well_min_height(
A single float representing the distance, in millimeters.
"""
well_definition = self.get_definition(labware_id)
default_val = 0
try:
height_reqs = well_definition.liquidProbeParameters.minimumHeight
if len(height_reqs) == 0:
#TODO: find out what to actually do here
return 0.5
return default_val
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 == []:
if (
entry.applicableWells == []
): # A "custom" default value will have "applicableWells" set to []
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
except AttributeError as e: # will occur when well does not have liquidProbeParameters
return default_val

def get_well_definition(
self,
Expand Down
Loading