Skip to content

Commit b211e10

Browse files
author
andy
committed
add test slot
1 parent 889e0fe commit b211e10

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed

ot3_testing/test_config/pipette_leveling_config.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,39 @@ class CalibrateMethod(enum.Enum):
77
Dichotomy = "dichotomy"
88

99

10-
SlotLocationCH96 = {"C1-Y": {"Point": Point(223, 203, 318), "compensation": {"left_rear": 0.038, "left_front": 0}},
11-
"C3-Y": {"Point": Point(207, 203, 318), "compensation": {"right_rear": 0, "right_front": 0}},
12-
"A2-Y": {"Point": Point(387, 421, 318), "compensation": {"left_rear": 0, "left_front": 0}},
13-
"C1-X": {"Point": Point(50, 91, 300), "compensation": {"left": 0, "right": 0}},
14-
"C3-X": {"Point": Point(382, 91, 300), "compensation": {"left": 0, "right": 0}},
15-
"A2-X": {"Point": Point(213, 305, 300), "compensation": {"left": 0, "right": 0}},
10+
SlotLocationCH96 = {"C1-Y": {"Point": Point(223, 203, 318), "compensation": {"left_rear": 0.038, "left_front": 0},
11+
"definition": ["left_front", "left_rear"]},
12+
"C3-Y": {"Point": Point(207, 203, 318), "compensation": {"right_rear": 0, "right_front": 0},
13+
"definition": ["left_front", "left_rear"]},
14+
"A2-Y": {"Point": Point(387, 421, 318), "compensation": {"left_rear": 0, "left_front": 0},
15+
"definition": ["left_front", "left_rear"]},
16+
"C1-X": {"Point": Point(50, 91, 300), "compensation": {"left": 0, "right": 0},
17+
"definition": ["rear_left", "rear_right"]},
18+
"C3-X": {"Point": Point(382, 91, 300), "compensation": {"left": 0, "right": 0},
19+
"definition": ["rear_left", "rear_right"]},
20+
"A2-X": {"Point": Point(213, 305, 300), "compensation": {"left": 0, "right": 0},
21+
"definition": ["rear_left", "rear_right"]},
1622
"D1-Z": {"Point": Point(51, 99, 318),
1723
"compensation": {"rear_left": 0.001, "rear_right": -0.005, "front_left": 0.018,
18-
"front_right": 0}},
19-
# "B2-Z": Point(213, 324, 317),
24+
"front_right": 0}, "definition": ["below_rear_left", "below_rear_right",
25+
"below_front_left",
26+
"below_front_right"]},
27+
2028
"D3-Z": {"Point": Point(377, 99, 318),
2129
"compensation": {"rear_left": 0.003, "rear_right": -0.021, "front_left": -0.037,
22-
"front_right": 0}},
30+
"front_right": 0}, "definition": ["below_rear_left", "below_rear_right",
31+
"below_front_left",
32+
"below_front_right"]},
2333
"C2-Z": {"Point": Point(214, 210, 318),
2434
"compensation": {"rear_left": 0.025, "rear_right": -0.007, "front_left": 0.046,
25-
"front_right": 0}},
35+
"front_right": 0}, "definition": ["below_rear_left", "below_rear_right",
36+
"below_front_left",
37+
"below_front_right"]},
2638
"A2-Z": {"Point": Point(218, 424, 390.5),
2739
"compensation": {"rear_left": 0, "rear_right": 0, "front_left": 0,
28-
"front_right": 0}},
40+
"front_right": 0}, "definition": ["below_rear_left", "below_rear_right",
41+
"below_front_left",
42+
"below_front_right"]},
2943
"UninstallPos": {"Point": Point(223, 203, 500)}
3044
}
3145

ot3_testing/tests/pipette_leveling.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,14 @@ async def apply_offset_by_slot_name(self, read_value, slot_value: str):
199199
return compensation + read_value
200200

201201
async def run_test_slot(self, test_slot_name: str, test_slot_value: str, read_definition: List[str],
202-
with_cal=False):
202+
with_cal=False, keep_reading=False):
203203
"""
204204
test slot
205205
:param test_slot_name:
206206
:param test_slot_value:
207207
:param read_definition:
208208
:param with_cal:
209+
:param keep_reading:
209210
:return:
210211
"""
211212
if RequestReadyFlag:
@@ -214,12 +215,14 @@ async def run_test_slot(self, test_slot_name: str, test_slot_value: str, read_de
214215
await self.move_to_test_slot(test_slot_value) # FIXME : maybe need to adjust to suitable position (FIXED)
215216
if with_cal:
216217
await self.calibrate_to_zero(test_slot_value, 0.1, read_definition, method=CalibrateMethod.Approach)
217-
218-
ret_dict = await self._read_definition_distance(read_definition)
219-
for key, value in ret_dict.items():
220-
print(f"{test_slot_value}-{key}: {value}")
221-
222-
return {test_slot_value: ret_dict}
218+
while True:
219+
ret_dict = await self._read_definition_distance(read_definition)
220+
for key, value in ret_dict.items():
221+
print(f"{test_slot_value}-{key}: {value}")
222+
_value_list = list(ret_dict.values())
223+
print(f"Difference: {round(max(_value_list) - min(_value_list), 3)}")
224+
if keep_reading is False:
225+
return {test_slot_value: ret_dict}
223226

224227
async def run_8ch_test(self, flex_name: str, project_path=None):
225228
"""
@@ -414,6 +417,21 @@ async def run_96ch_test(self, flex_name: str, project_path=None):
414417
self.save_csv(file_path, csv_title, csv_list)
415418
self.laser_sensor.close()
416419

420+
async def test_96ch_slot(self, slot_name: str):
421+
"""
422+
test special slot
423+
"""
424+
if self.robot_ip is None:
425+
addr = self.get_address().strip()
426+
else:
427+
addr = self.robot_ip
428+
self.initial_api(addr, hc=True)
429+
await self.api.home()
430+
self.init_laser_sensor(send=False)
431+
432+
await self.run_test_slot(slot_name, slot_name, SlotLocationCH96[slot_name]["definition"],
433+
with_cal=DoCalibrate, keep_reading=True)
434+
417435

418436
if __name__ == '__main__':
419437
import asyncio
@@ -422,6 +440,10 @@ async def run_96ch_test(self, flex_name: str, project_path=None):
422440
# pipette_leveling.test_name = '96ch'
423441
# asyncio.run(pipette_leveling.run_96ch_test("0527001"))
424442

425-
pipette_leveling = PipetteLeveling(SlotLocationCH8, ChannelDefinitionCH8, )
426-
pipette_leveling.test_name = '8ch'
427-
asyncio.run(pipette_leveling.run_8ch_test("0527001"))
443+
# pipette_leveling = PipetteLeveling(SlotLocationCH8, ChannelDefinitionCH8, )
444+
# pipette_leveling.test_name = '8ch'
445+
# asyncio.run(pipette_leveling.run_8ch_test("0527001"))
446+
447+
pipette_leveling = PipetteLeveling(SlotLocationCH96, ChannelDefinitionCH96, robot_ip="192.168.6.24")
448+
pipette_leveling.test_name = '96ch'
449+
asyncio.run(pipette_leveling.test_96ch_slot("C2-Z"))

0 commit comments

Comments
 (0)