PRCXI Reset Error Correction (#166)

* change 9320 desk row number to 4

* Updated 9320 host address

* Updated 9320 host address

* Add **kwargs in classes: PRCXI9300Deck and PRCXI9300Container

* Removed all sample_id in prcxi_9320.json to avoid KeyError

* 9320 machine testing settings

* Typo

* Rewrite setup logic to clear error code

* 初始化 step_mode 属性
This commit is contained in:
Harry Liu
2025-11-15 02:48:46 +08:00
committed by Xuwznln
parent 813400f2b4
commit 872b3d781f
2 changed files with 1002 additions and 983 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -65,7 +65,7 @@ class PRCXI9300Deck(Deck):
该类定义了 PRCXI 9300 的工作台布局和槽位信息。
"""
def __init__(self, name: str, size_x: float, size_y: float, size_z: float):
def __init__(self, name: str, size_x: float, size_y: float, size_z: float, **kwargs):
super().__init__(name, size_x, size_y, size_z)
self.slots = [None] * 6 # PRCXI 9300 有 6 个槽位
@@ -85,6 +85,7 @@ class PRCXI9300Container(Plate, TipRack):
category: str,
ordering: collections.OrderedDict,
model: Optional[str] = None,
**kwargs,
):
super().__init__(name, size_x, size_y, size_z, category=category, ordering=ordering, model=model)
self._unilabos_state = {}
@@ -159,6 +160,8 @@ class PRCXI9300Handler(LiquidHandlerAbstract):
)
if is_9320:
print("当前设备是9320")
# 始终初始化 step_mode 属性
self.step_mode = False
if step_mode:
if is_9320:
self.step_mode = step_mode
@@ -516,10 +519,26 @@ class PRCXI9300Backend(LiquidHandlerBackend):
await super().setup()
try:
if self._execute_setup:
# 先获取错误代码
error_code = self.api_client.get_error_code()
if error_code:
print(f"PRCXI9300 error code detected: {error_code}")
# 清除错误代码
self.api_client.clear_error_code()
print("PRCXI9300 error code cleared.")
# 执行重置
print("Starting PRCXI9300 reset...")
self.api_client.call("IAutomation", "Reset")
# 检查重置状态并等待完成
while not self.is_reset_ok:
print("Waiting for PRCXI9300 to reset...")
await self._ros_node.sleep(1)
if hasattr(self, '_ros_node') and self._ros_node is not None:
await self._ros_node.sleep(1)
else:
await asyncio.sleep(1)
print("PRCXI9300 reset successfully.")
except ConnectionRefusedError as e:
raise RuntimeError(
@@ -1148,7 +1167,7 @@ class DefaultLayout:
self.waste_liquid_slot = 6
elif product_name == "PRCXI9320":
self.rows = 3
self.rows = 4
self.columns = 4
self.layout = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
self.trash_slot = 16
@@ -1744,7 +1763,7 @@ if __name__ == "__main__":
handler = PRCXI9300Handler(
deck=deck,
host="192.168.0.121",
host="192.168.1.201",
port=9999,
timeout=10.0,
setup=True,