|
5 | 5 | from dataclasses import replace
|
6 | 6 | import logging
|
7 | 7 | from collections import OrderedDict
|
| 8 | +from math import isclose |
8 | 9 | from typing import (
|
9 | 10 | AsyncIterator,
|
10 | 11 | cast,
|
@@ -2709,7 +2710,11 @@ async def liquid_probe(
|
2709 | 2710 | error: Optional[PipetteLiquidNotFoundError] = None
|
2710 | 2711 | pos = await self.gantry_position(checked_mount, refresh=True)
|
2711 | 2712 | # probe_start_pos.z + z_distance of pass - pos.z should be < max_z_dist
|
2712 |
| - while (probe_start_pos.z - pos.z) < max_z_dist: |
| 2713 | + # due to rounding errors this can get caught in an infinite loop when the distance is almost equal |
| 2714 | + # so we check to see if they're within 0.01 which is 1/5th the minimum movement distance from move_utils.py |
| 2715 | + while (probe_start_pos.z - pos.z) < max_z_dist and not isclose( |
| 2716 | + (probe_start_pos.z - pos.z), max_z_dist, rel_tol=0.01 |
| 2717 | + ): |
2713 | 2718 | # safe distance so we don't accidentally aspirate liquid if we're already close to liquid
|
2714 | 2719 | safe_plunger_pos = top_types.Point(
|
2715 | 2720 | pos.x, pos.y, pos.z + probe_safe_reset_mm
|
@@ -2749,9 +2754,9 @@ async def liquid_probe(
|
2749 | 2754 | except PipetteLiquidNotFoundError as lnfe:
|
2750 | 2755 | error = lnfe
|
2751 | 2756 | pos = await self.gantry_position(checked_mount, refresh=True)
|
2752 |
| - #await self.move_to(checked_mount, probe_start_pos + top_types.Point(z=2)) |
2753 |
| - #await self.prepare_for_aspirate(checked_mount) |
2754 |
| - #await self.move_to(checked_mount, probe_start_pos) |
| 2757 | + # await self.move_to(checked_mount, probe_start_pos + top_types.Point(z=2)) |
| 2758 | + # await self.prepare_for_aspirate(checked_mount) |
| 2759 | + # await self.move_to(checked_mount, probe_start_pos) |
2755 | 2760 | if error is not None:
|
2756 | 2761 | # if we never found liquid raise an error
|
2757 | 2762 | raise error
|
|
0 commit comments