Skip to content

Commit bde213a

Browse files
authored
fix(hardware-testing, api): FIx issues with the QC diagnostics script of the Flex Stacker. (#18931)
1 parent 10d73f8 commit bde213a

File tree

6 files changed

+41
-113
lines changed

6 files changed

+41
-113
lines changed

api/src/opentrons/drivers/flex_stacker/types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ def __str__(self) -> str:
136136
"""Convert to tag for clear logging."""
137137
return self.name.lower()
138138

139+
def polarity(self) -> str:
140+
"""Convert to polarity tag for testing."""
141+
return "positive" if self == Direction.EXTEND else "negative"
142+
139143
def opposite(self) -> "Direction":
140144
"""Get opposite direction."""
141145
return Direction.EXTEND if self == Direction.RETRACT else Direction.RETRACT

api/src/opentrons/hardware_control/modules/flex_stacker.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@
8484
# Should put the bottom of the plate this mm below the latch when storing.
8585
LATCH_CLEARANCE = 2.5
8686

87-
88-
# Configs
87+
# TOF Baseline Configs
88+
# These are generated manually with the help of the tof_analysis.py tool
89+
# Which can be found in `hardware_testing/tools/tof-analysis/README.md` where
90+
# it goes over using use the tool.
8991
TOF_DETECTION_CONFIG = {
9092
TOFSensor.X: {
9193
Direction.EXTEND: TOFDetection(
@@ -124,10 +126,11 @@
124126
StackerAxis.Z: StallGuardParams(StackerAxis.Z, True, 0),
125127
}
126128

129+
# Motion Parameter defaults
127130
STACKER_MOTION_CONFIG = {
128131
StackerAxis.X: {
129132
"home": AxisParams(
130-
run_current=1.5, # mAmps
133+
run_current=1.5, # Amps RMS
131134
hold_current=0.75,
132135
move_params=MoveParams(
133136
max_speed=10.0, # mm/s

hardware-testing/hardware_testing/modules/flex_stacker/flex_stacker_qc/test_tof_basic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ async def test_get_tof_sensor_histogram(
8484
async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
8585
"""Run."""
8686
if not stacker.is_simulated:
87-
ui.get_user_ready("Make sure both TOF sensors are installed.")
88-
ui.get_user_ready("Make sure there is no labware in the stacker.")
87+
ui.get_user_ready("Make sure there is no labware in the stacker")
8988

9089
print("Homing stacker X and Z axis.")
9190
await stacker.home_axis(StackerAxis.X, Direction.EXTEND)

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
CSVResult,
1111
)
1212

13+
from .utils import verify_platform_location
14+
1315
from opentrons.hardware_control.modules.flex_stacker import FlexStacker
1416
from opentrons.drivers.flex_stacker.types import (
1517
Direction,
@@ -95,12 +97,8 @@ async def test_tof_sensors_labware_detection(
9597

9698
async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
9799
"""Run."""
98-
if not stacker.is_simulated:
99-
ui.get_user_ready("Make sure both TOF sensors are installed.")
100-
101100
print("Homing stacker X and Z axis.")
102-
await stacker.home_axis(StackerAxis.X, Direction.EXTEND)
103-
await stacker.home_axis(StackerAxis.Z, Direction.RETRACT)
101+
await verify_platform_location(stacker)
104102

105103
print("Test that we have no labware on the X")
106104
ui.get_user_ready("Make sure there is no labware on the stacker gripper position")

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
CSVResult,
99
)
1010

11-
from .utils import test_limit_switches_per_direction
11+
from .utils import test_limit_switches_per_direction, verify_platform_location
1212
from opentrons.hardware_control.modules.flex_stacker import FlexStacker
1313
from opentrons.drivers.flex_stacker.types import StackerAxis, Direction
1414

@@ -39,14 +39,16 @@ async def test_platform_sensors_for_direction(
3939
"""Test platform sensors for a given direction."""
4040
ui.print_header(f"Platform Sensor - {direction} direction")
4141
sensor_result = await stacker._driver.get_platform_sensor(direction)
42+
polarity = direction.polarity()
43+
opposite_polarity = direction.opposite().polarity()
4244
opposite_result = not await stacker._driver.get_platform_sensor(
4345
direction.opposite()
4446
)
45-
print(f"{direction} sensor triggered: {sensor_result}")
46-
print(f"{direction.opposite()} sensor untriggered: {opposite_result}")
47+
print(f"{polarity} sensor triggered: {sensor_result}")
48+
print(f"{opposite_polarity} sensor untriggered: {opposite_result}")
4749
report(
4850
section,
49-
f"platform-sensor-trigger-{direction}-untrigger-{direction.opposite()}",
51+
f"platform-sensor-trigger-{polarity}-untrigger-{opposite_polarity}",
5052
[
5153
sensor_result,
5254
opposite_result,
@@ -57,6 +59,8 @@ async def test_platform_sensors_for_direction(
5759

5860
async def run(stacker: FlexStacker, report: CSVReport, section: str) -> None:
5961
"""Run."""
62+
await verify_platform_location(stacker)
63+
6064
await test_limit_switches_per_direction(
6165
stacker, StackerAxis.X, Direction.EXTEND, report, section
6266
)

0 commit comments

Comments
 (0)