From 629867beace6ab170f3548db32cd37ce462dcf53 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Wed, 15 May 2024 12:30:39 -0400 Subject: [PATCH 1/4] remove minimum z distance --- api/src/opentrons/config/defaults_ot3.py | 2 -- api/src/opentrons/config/types.py | 1 - api/tests/opentrons/config/ot3_settings.py | 1 - .../hardware_control/backends/test_ot3_controller.py | 1 - api/tests/opentrons/hardware_control/test_ot3_api.py | 2 -- .../hardware_testing/gravimetric/config.py | 12 ------------ .../hardware_testing/liquid_sense/execute.py | 1 - .../pipette_assembly_qc_ot3/__main__.py | 1 - 8 files changed, 21 deletions(-) diff --git a/api/src/opentrons/config/defaults_ot3.py b/api/src/opentrons/config/defaults_ot3.py index 0b2499feaab..9dccb1566d8 100644 --- a/api/src/opentrons/config/defaults_ot3.py +++ b/api/src/opentrons/config/defaults_ot3.py @@ -25,7 +25,6 @@ DEFAULT_LIQUID_PROBE_SETTINGS: Final[LiquidProbeSettings] = LiquidProbeSettings( starting_mount_height=100, max_z_distance=40, - min_z_distance=5, mount_speed=10, plunger_speed=5, sensor_threshold_pascals=40, @@ -337,7 +336,6 @@ def _build_default_liquid_probe( "starting_mount_height", default.starting_mount_height ), max_z_distance=from_conf.get("max_z_distance", default.max_z_distance), - min_z_distance=from_conf.get("min_z_distance", default.min_z_distance), mount_speed=from_conf.get("mount_speed", default.mount_speed), plunger_speed=from_conf.get("plunger_speed", default.plunger_speed), sensor_threshold_pascals=from_conf.get( diff --git a/api/src/opentrons/config/types.py b/api/src/opentrons/config/types.py index f13d5a5e6e3..476c3181dc2 100644 --- a/api/src/opentrons/config/types.py +++ b/api/src/opentrons/config/types.py @@ -130,7 +130,6 @@ class OutputOptions(int, Enum): class LiquidProbeSettings: starting_mount_height: float max_z_distance: float - min_z_distance: float mount_speed: float plunger_speed: float sensor_threshold_pascals: float diff --git a/api/tests/opentrons/config/ot3_settings.py b/api/tests/opentrons/config/ot3_settings.py index 3cfa9b7c34c..eb15cb8efe3 100644 --- a/api/tests/opentrons/config/ot3_settings.py +++ b/api/tests/opentrons/config/ot3_settings.py @@ -120,7 +120,6 @@ "liquid_sense": { "starting_mount_height": 80, "max_z_distance": 20, - "min_z_distance": 3, "mount_speed": 10, "plunger_speed": 10, "sensor_threshold_pascals": 17, diff --git a/api/tests/opentrons/hardware_control/backends/test_ot3_controller.py b/api/tests/opentrons/hardware_control/backends/test_ot3_controller.py index fd2d0469954..b57a4b2ab4b 100644 --- a/api/tests/opentrons/hardware_control/backends/test_ot3_controller.py +++ b/api/tests/opentrons/hardware_control/backends/test_ot3_controller.py @@ -178,7 +178,6 @@ def fake_liquid_settings() -> LiquidProbeSettings: return LiquidProbeSettings( starting_mount_height=100, max_z_distance=15, - min_z_distance=5, mount_speed=40, plunger_speed=10, sensor_threshold_pascals=15, diff --git a/api/tests/opentrons/hardware_control/test_ot3_api.py b/api/tests/opentrons/hardware_control/test_ot3_api.py index 7ab0a2f1c00..718756d5a89 100644 --- a/api/tests/opentrons/hardware_control/test_ot3_api.py +++ b/api/tests/opentrons/hardware_control/test_ot3_api.py @@ -115,7 +115,6 @@ def fake_liquid_settings() -> LiquidProbeSettings: return LiquidProbeSettings( starting_mount_height=100, max_z_distance=15, - min_z_distance=10, mount_speed=40, plunger_speed=10, sensor_threshold_pascals=15, @@ -800,7 +799,6 @@ async def test_liquid_probe( fake_settings_aspirate = LiquidProbeSettings( starting_mount_height=100, max_z_distance=15, - min_z_distance=5, mount_speed=40, plunger_speed=10, sensor_threshold_pascals=15, diff --git a/hardware-testing/hardware_testing/gravimetric/config.py b/hardware-testing/hardware_testing/gravimetric/config.py index f80d87d7124..394309b43f4 100644 --- a/hardware-testing/hardware_testing/gravimetric/config.py +++ b/hardware-testing/hardware_testing/gravimetric/config.py @@ -90,7 +90,6 @@ class PhotometricConfig(VolumetricConfig): 1: { 50: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 11, "plunger_speed": 21, "sensor_threshold_pascals": 150, @@ -99,7 +98,6 @@ class PhotometricConfig(VolumetricConfig): 8: { 50: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 11, "plunger_speed": 21, "sensor_threshold_pascals": 150, @@ -110,21 +108,18 @@ class PhotometricConfig(VolumetricConfig): 1: { 50: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 10, "sensor_threshold_pascals": 200, }, 200: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 10, "sensor_threshold_pascals": 200, }, 1000: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 11, "sensor_threshold_pascals": 150, @@ -133,21 +128,18 @@ class PhotometricConfig(VolumetricConfig): 8: { 50: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 10, "sensor_threshold_pascals": 200, }, 200: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 10, "sensor_threshold_pascals": 200, }, 1000: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 11, "sensor_threshold_pascals": 150, @@ -156,21 +148,18 @@ class PhotometricConfig(VolumetricConfig): 96: { 50: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 10, "sensor_threshold_pascals": 200, }, 200: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 10, "sensor_threshold_pascals": 200, }, 1000: { "max_z_distance": 20, - "min_z_distance": 5, "mount_speed": 5, "plunger_speed": 11, "sensor_threshold_pascals": 150, @@ -189,7 +178,6 @@ def _get_liquid_probe_settings( return LiquidProbeSettings( starting_mount_height=well.top().point.z, max_z_distance=min(well.depth, lqid_cfg["max_z_distance"]), - min_z_distance=lqid_cfg["min_z_distance"], mount_speed=lqid_cfg["mount_speed"], plunger_speed=lqid_cfg["plunger_speed"], sensor_threshold_pascals=lqid_cfg["sensor_threshold_pascals"], diff --git a/hardware-testing/hardware_testing/liquid_sense/execute.py b/hardware-testing/hardware_testing/liquid_sense/execute.py index 9a61c172c8e..05be865015f 100644 --- a/hardware-testing/hardware_testing/liquid_sense/execute.py +++ b/hardware-testing/hardware_testing/liquid_sense/execute.py @@ -355,7 +355,6 @@ def _run_trial(run_args: RunArgs, tip: int, well: Well, trial: int) -> float: lps = LiquidProbeSettings( starting_mount_height=start_height, max_z_distance=z_dist, - min_z_distance=lqid_cfg["min_z_distance"], mount_speed=run_args.z_speed, plunger_speed=plunger_speed, sensor_threshold_pascals=lqid_cfg["sensor_threshold_pascals"], diff --git a/hardware-testing/hardware_testing/production_qc/pipette_assembly_qc_ot3/__main__.py b/hardware-testing/hardware_testing/production_qc/pipette_assembly_qc_ot3/__main__.py index 5e482afa6e7..fabdb101256 100644 --- a/hardware-testing/hardware_testing/production_qc/pipette_assembly_qc_ot3/__main__.py +++ b/hardware-testing/hardware_testing/production_qc/pipette_assembly_qc_ot3/__main__.py @@ -1377,7 +1377,6 @@ async def _test_liquid_probe( probe_settings = LiquidProbeSettings( starting_mount_height=start_pos.z, max_z_distance=max_z_distance_machine_coords, # FIXME: deck coords - min_z_distance=0, # FIXME: remove mount_speed=probe_cfg.mount_speed, plunger_speed=probe_cfg.plunger_speed, sensor_threshold_pascals=probe_cfg.sensor_threshold_pascals, From 9a45d82fbdecdd2e3869a1280abeebf32aa4287a Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Thu, 16 May 2024 13:33:08 -0400 Subject: [PATCH 2/4] don't move the plunger more than we need to --- api/src/opentrons/hardware_control/ot3api.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/api/src/opentrons/hardware_control/ot3api.py b/api/src/opentrons/hardware_control/ot3api.py index c50dc08aebb..8e4698f629e 100644 --- a/api/src/opentrons/hardware_control/ot3api.py +++ b/api/src/opentrons/hardware_control/ot3api.py @@ -2580,13 +2580,22 @@ async def liquid_probe( if probe_settings.aspirate_while_sensing: await self._move_to_plunger_bottom(mount, rate=1.0) else: - # TODO: shorten this distance by only moving just far enough - # to account for the specified "max-z-distance" + # find the ideal travel distance by multiplying the plunger speed + # by the time it will take to complete the z move. + ideal_travel = probe_settings.plunger_speed * ( + probe_settings.max_z_distance / probe_settings.mount_speed + ) + + # TODO limit the z distance to the max allowed by the plunger travel at this speed. + # or here is probably the ideal place to implement multi-probe + assert ( + instrument.plunger_positions.bottom - ideal_travel + >= instrument.plunger_positions.top + ) + target_point = instrument.plunger_positions.bottom - ideal_travel target_pos = target_position_from_plunger( - checked_mount, instrument.plunger_positions.top, self._current_position + checked_mount, target_point, self._current_position ) - # FIXME: this should really be the slower "aspirate" speed, - # but this is still in testing phase so let's bias towards speed max_speeds = self.config.motion_settings.default_max_speed speed = max_speeds[self.gantry_load][OT3AxisKind.P] await self._move(target_pos, speed=speed, acquire_lock=True) From 7a05d17e74ea219e0c3183780f4e3490bfb7dfd0 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Thu, 23 May 2024 12:37:15 -0400 Subject: [PATCH 3/4] raise a hardware error instead of an assert --- .../opentrons/hardware_control/backends/ot3controller.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/opentrons/hardware_control/backends/ot3controller.py b/api/src/opentrons/hardware_control/backends/ot3controller.py index 1b90e086dca..62d44ae7aea 100644 --- a/api/src/opentrons/hardware_control/backends/ot3controller.py +++ b/api/src/opentrons/hardware_control/backends/ot3controller.py @@ -194,6 +194,7 @@ LiquidNotFoundError, CommunicationError, PythonException, + UnsupportedHardwareCommand, ) from .subsystem_manager import SubsystemManager @@ -1367,12 +1368,16 @@ async def liquid_probe( probe: InstrumentProbeType = InstrumentProbeType.PRIMARY, ) -> float: if output_option == OutputOptions.sync_buffer_to_csv: - assert ( + if ( self._subsystem_manager.device_info[ SubSystem.of_mount(mount) ].revision.tertiary == "1" - ) + ): + raise UnsupportedHardwareCommand( + "Liquid Probe not supported on this pipette firmware" + ) + head_node = axis_to_node(Axis.by_mount(mount)) tool = sensor_node_for_pipette(OT3Mount(mount.value)) csv_output = bool(output_option.value & OutputOptions.stream_to_csv.value) From 90b9f7c59639245d43463af447d0cf499ff30f83 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Thu, 23 May 2024 14:19:20 -0400 Subject: [PATCH 4/4] fix api tests --- .../opentrons/hardware_control/test_ot3_api.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/tests/opentrons/hardware_control/test_ot3_api.py b/api/tests/opentrons/hardware_control/test_ot3_api.py index 718756d5a89..7a57978bc14 100644 --- a/api/tests/opentrons/hardware_control/test_ot3_api.py +++ b/api/tests/opentrons/hardware_control/test_ot3_api.py @@ -775,12 +775,19 @@ async def test_liquid_probe( pipette_node: Axis, mount: OT3Mount, fake_liquid_settings: LiquidProbeSettings, - mock_instrument_handlers: Tuple[MagicMock], mock_current_position_ot3: AsyncMock, - mock_ungrip: AsyncMock, mock_move_to_plunger_bottom: AsyncMock, ) -> None: - mock_ungrip.return_value = None + instr_data = AttachedPipette( + config=load_pipette_data.load_definition( + PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + ), + id="fakepip", + ) + await ot3_hardware.cache_pipette(mount, instr_data, None) + pipette = ot3_hardware.hardware_pipettes[mount.to_mount()] + assert pipette + await ot3_hardware.add_tip(mount, 100) await ot3_hardware.home() mock_move_to.return_value = None