9
9
CSVLineRepeating ,
10
10
CSVResult ,
11
11
)
12
- from hardware_testing .modules .flex_stacker_dvt_qc .utils import labware_detected
13
12
14
13
from opentrons .hardware_control .modules .flex_stacker import FlexStacker
15
- from .utils import NUMBER_OF_BINS , NUMBER_OF_ZONES
16
14
from opentrons .drivers .flex_stacker .types import (
17
15
Direction ,
18
16
StackerAxis ,
@@ -56,6 +54,8 @@ async def test_tof_sensors_labware_detection(
56
54
section : str ,
57
55
sensor : TOFSensor ,
58
56
labware : str ,
57
+ axis : StackerAxis ,
58
+ direction : Direction = Direction .EXTEND ,
59
59
) -> None :
60
60
"""Test that we can detect labware with the TOF sensor."""
61
61
open = not await stacker ._driver .get_hopper_door_closed ()
@@ -74,12 +74,13 @@ async def test_tof_sensors_labware_detection(
74
74
return
75
75
76
76
print (f"Getting histogram for { sensor } ." )
77
- bins = list (range (NUMBER_OF_BINS ))
78
- zones = list (range (NUMBER_OF_ZONES ))
79
77
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 } ." )
81
80
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
+
83
84
report (
84
85
section ,
85
86
f"tof-{ sensor .name } -histogram-{ labware } " ,
@@ -105,15 +106,21 @@ async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
105
106
ui .get_user_ready ("Make sure there is no labware on the stacker gripper position" )
106
107
await stacker .home_axis (StackerAxis .X , Direction .RETRACT )
107
108
await test_tof_sensors_labware_detection (
108
- stacker , report , section , TOFSensor .X , "empty"
109
+ stacker , report , section , TOFSensor .X , "empty" , StackerAxis . X , Direction . RETRACT
109
110
)
110
111
111
112
print ("Test that we detect tiprack on the X home position" )
112
113
await stacker .home_axis (StackerAxis .X , Direction .EXTEND )
113
114
ui .get_user_ready ("Add 1 tiprack to the stacker X" )
114
115
await stacker .home_axis (StackerAxis .X , Direction .RETRACT )
115
116
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 ,
117
124
)
118
125
await stacker .home_axis (StackerAxis .X , Direction .EXTEND )
119
126
@@ -123,12 +130,12 @@ async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
123
130
)
124
131
await stacker .close_latch ()
125
132
await test_tof_sensors_labware_detection (
126
- stacker , report , section , TOFSensor .Z , "empty"
133
+ stacker , report , section , TOFSensor .Z , "empty" , StackerAxis . Z
127
134
)
128
135
129
136
print ("Test that we detect tiprack on the Z" )
130
137
ui .get_user_ready ("Add 1 tiprack to the stacker Z and close the hopper door" )
131
138
await test_tof_sensors_labware_detection (
132
- stacker , report , section , TOFSensor .Z , "tiprack"
139
+ stacker , report , section , TOFSensor .Z , "tiprack" , StackerAxis . Z
133
140
)
134
141
ui .get_user_ready ("Please remove all labware from the stacker." )
0 commit comments