Skip to content

Commit d0896c3

Browse files
removed requirement to start test without labware platform, modifed platform check in x basic test, changed TOF functional test to use module labware detection method
1 parent 5e44598 commit d0896c3

File tree

3 files changed

+24
-32
lines changed

3 files changed

+24
-32
lines changed

hardware-testing/hardware_testing/modules/flex_stacker_qc/__main__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from .utils import find_stacker_port, get_estop
1919
from opentrons.drivers.rpi_drivers.types import USBPort
2020
from opentrons.hardware_control.modules.flex_stacker import FlexStacker
21-
from opentrons.hardware_control.modules.types import PlatformState
2221

2322

2423
async def build_stacker_report(
@@ -60,16 +59,8 @@ async def _main(cfg: TestConfig) -> None:
6059
ui.print_error("ESTOP is still pressed, cannot start tests")
6160
return
6261

63-
# TODO: This check should be in the basic axes tests
6462
await stacker.home_all()
6563
await stacker._reader.read()
66-
if stacker.platform_state is not PlatformState.UNKNOWN:
67-
ui.print_error("Platform must be removed from the carrier before starting")
68-
ui.get_user_ready(f"Remove platform from {stacker.platform_state.value}")
69-
await stacker._reader.get_platform_sensor_state()
70-
if stacker.platform_state is not PlatformState.UNKNOWN:
71-
ui.print_error("Platform is still detected, cannot start tests")
72-
return
7364

7465
device_info = await stacker._driver.get_device_info()
7566
report.set_tag(device_info.sn if device_info.sn else "UNKNOWN")

hardware-testing/hardware_testing/modules/flex_stacker_qc/test_tof_functional.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
CSVLineRepeating,
1010
CSVResult,
1111
)
12-
from hardware_testing.modules.flex_stacker_dvt_qc.utils import labware_detected
1312

1413
from opentrons.hardware_control.modules.flex_stacker import FlexStacker
15-
from .utils import NUMBER_OF_BINS, NUMBER_OF_ZONES
1614
from opentrons.drivers.flex_stacker.types import (
1715
Direction,
1816
StackerAxis,
@@ -56,6 +54,8 @@ async def test_tof_sensors_labware_detection(
5654
section: str,
5755
sensor: TOFSensor,
5856
labware: str,
57+
axis: StackerAxis,
58+
direction: Direction = Direction.EXTEND,
5959
) -> None:
6060
"""Test that we can detect labware with the TOF sensor."""
6161
open = not await stacker._driver.get_hopper_door_closed()
@@ -74,12 +74,13 @@ async def test_tof_sensors_labware_detection(
7474
return
7575

7676
print(f"Getting histogram for {sensor}.")
77-
bins = list(range(NUMBER_OF_BINS))
78-
zones = list(range(NUMBER_OF_ZONES))
7977
histogram = await stacker._driver.get_tof_histogram(sensor)
80-
diff = labware_detected(histogram.bins, sensor, bins, zones)
78+
79+
print(f"Verifying Labware Presence for {sensor}.")
8180
labware_expected = labware != "empty"
82-
result = labware_expected == bool(diff)
81+
lbw_detected = await stacker.labware_detected(axis, direction)
82+
result = labware_expected == bool(lbw_detected)
83+
8384
report(
8485
section,
8586
f"tof-{sensor.name}-histogram-{labware}",
@@ -105,15 +106,21 @@ async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
105106
ui.get_user_ready("Make sure there is no labware on the stacker gripper position")
106107
await stacker.home_axis(StackerAxis.X, Direction.RETRACT)
107108
await test_tof_sensors_labware_detection(
108-
stacker, report, section, TOFSensor.X, "empty"
109+
stacker, report, section, TOFSensor.X, "empty", StackerAxis.X, Direction.RETRACT
109110
)
110111

111112
print("Test that we detect tiprack on the X home position")
112113
await stacker.home_axis(StackerAxis.X, Direction.EXTEND)
113114
ui.get_user_ready("Add 1 tiprack to the stacker X")
114115
await stacker.home_axis(StackerAxis.X, Direction.RETRACT)
115116
await test_tof_sensors_labware_detection(
116-
stacker, report, section, TOFSensor.X, "tiprack"
117+
stacker,
118+
report,
119+
section,
120+
TOFSensor.X,
121+
"tiprack",
122+
StackerAxis.X,
123+
Direction.RETRACT,
117124
)
118125
await stacker.home_axis(StackerAxis.X, Direction.EXTEND)
119126

@@ -123,12 +130,12 @@ async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
123130
)
124131
await stacker.close_latch()
125132
await test_tof_sensors_labware_detection(
126-
stacker, report, section, TOFSensor.Z, "empty"
133+
stacker, report, section, TOFSensor.Z, "empty", StackerAxis.Z
127134
)
128135

129136
print("Test that we detect tiprack on the Z")
130137
ui.get_user_ready("Add 1 tiprack to the stacker Z and close the hopper door")
131138
await test_tof_sensors_labware_detection(
132-
stacker, report, section, TOFSensor.Z, "tiprack"
139+
stacker, report, section, TOFSensor.Z, "tiprack", StackerAxis.Z
133140
)
134141
ui.get_user_ready("Please remove all labware from the stacker.")

hardware-testing/hardware_testing/modules/flex_stacker_qc/test_x_axis_basic.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .utils import test_limit_switches_per_direction
1212
from opentrons.hardware_control.modules.flex_stacker import FlexStacker
1313
from opentrons.drivers.flex_stacker.types import StackerAxis, Direction
14+
from opentrons.hardware_control.modules.types import PlatformState
1415

1516

1617
def build_csv_lines() -> List[Union[CSVLine, CSVLineRepeating]]:
@@ -55,25 +56,18 @@ async def test_platform_sensors_for_direction(
5556
)
5657

5758

58-
async def platform_is_removed(stacker: FlexStacker) -> bool:
59-
"""Check if the platform is removed from the carrier."""
60-
plus_side = await stacker._driver.get_platform_sensor(Direction.EXTEND)
61-
minus_side = await stacker._driver.get_platform_sensor(Direction.RETRACT)
62-
return not plus_side and not minus_side
63-
64-
6559
async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
6660
"""Run."""
67-
if not stacker.is_simulated and not await platform_is_removed(stacker):
68-
print("FAILURE - Cannot start tests with platform on the carrier")
69-
return
70-
7161
await test_limit_switches_per_direction(
7262
stacker, StackerAxis.X, Direction.EXTEND, report, section
7363
)
7464

75-
if not stacker.is_simulated:
76-
ui.get_user_ready("Place the platform on the X carrier")
65+
await stacker._reader.read()
66+
if not stacker.is_simulated and (
67+
stacker.platform_state is PlatformState.UNKNOWN
68+
or stacker.platform_state is PlatformState.MISSING
69+
):
70+
ui.get_user_ready("Place Platform on X axis carrier")
7771

7872
await test_platform_sensors_for_direction(
7973
stacker, Direction.EXTEND, report, section

0 commit comments

Comments
 (0)