mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-18 05:21:19 +00:00
支持Biomek创建
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import requests
|
import requests
|
||||||
from typing import List, Sequence, Optional, Union, Literal
|
from typing import List, Sequence, Optional, Union, Literal
|
||||||
from geometry_msgs.msg import Point
|
from geometry_msgs.msg import Point
|
||||||
#from unilabos_msgs.msg import Resource
|
from pylabrobot.liquid_handling import LiquidHandler
|
||||||
|
from unilabos_msgs.msg import Resource
|
||||||
|
|
||||||
from pylabrobot.resources import (
|
from pylabrobot.resources import (
|
||||||
TipRack,
|
TipRack,
|
||||||
@@ -22,8 +23,8 @@ class LiquidHandlerBiomek(LiquidHandlerAbstract):
|
|||||||
该类用于处理Biomek液体处理器的特定操作。
|
该类用于处理Biomek液体处理器的特定操作。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, backend=None, deck=None, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(backend, deck, *args, **kwargs)
|
||||||
self._status = "Idle" # 初始状态为 Idle
|
self._status = "Idle" # 初始状态为 Idle
|
||||||
self._success = False # 初始成功状态为 False
|
self._success = False # 初始成功状态为 False
|
||||||
self._status_queue = kwargs.get("status_queue", None) # 状态队列
|
self._status_queue = kwargs.get("status_queue", None) # 状态队列
|
||||||
@@ -71,6 +72,10 @@ class LiquidHandlerBiomek(LiquidHandlerAbstract):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def deserialize(cls, data: dict, allow_marshal: bool = False) -> LiquidHandler:
|
||||||
|
return LiquidHandler.deserialize(data, allow_marshal)
|
||||||
|
|
||||||
|
|
||||||
def create_protocol(
|
def create_protocol(
|
||||||
self,
|
self,
|
||||||
@@ -259,7 +264,7 @@ class LiquidHandlerBiomek(LiquidHandlerAbstract):
|
|||||||
}
|
}
|
||||||
transfer_params["items"] = items
|
transfer_params["items"] = items
|
||||||
|
|
||||||
transfer_params["Solvent"] = solvent if solvent else "Water"
|
transfer_params["Solvent"] = "Water"
|
||||||
TipLocation = tip_racks[0].name
|
TipLocation = tip_racks[0].name
|
||||||
transfer_params["TipLocation"] = TipLocation
|
transfer_params["TipLocation"] = TipLocation
|
||||||
|
|
||||||
@@ -340,8 +345,11 @@ class LiquidHandlerBiomek(LiquidHandlerAbstract):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
steps_info = '''
|
|
||||||
{
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
steps_info = '''
|
||||||
|
{
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"step_number": 1,
|
"step_number": 1,
|
||||||
@@ -600,12 +608,12 @@ steps_info = '''
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
labware_with_liquid = '''
|
labware_with_liquid = '''
|
||||||
[ {
|
[ {
|
||||||
"id": "stock plate on P1",
|
"id": "stock plate on P1",
|
||||||
"parent": "deck",
|
"parent": "deck",
|
||||||
"slot_on_deck": "P1",
|
"slot_on_deck": "P1",
|
||||||
@@ -801,21 +809,21 @@ labware_with_liquid = '''
|
|||||||
"liquid_input_wells": [
|
"liquid_input_wells": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
handler = LiquidHandlerBiomek()
|
handler = LiquidHandlerBiomek()
|
||||||
handler.temp_protocol = {
|
handler.temp_protocol = {
|
||||||
"meta": {},
|
"meta": {},
|
||||||
"labwares": [],
|
"labwares": [],
|
||||||
"steps": []
|
"steps": []
|
||||||
}
|
}
|
||||||
|
|
||||||
input_steps = json.loads(steps_info)
|
input_steps = json.loads(steps_info)
|
||||||
labwares = json.loads(labware_with_liquid)
|
labwares = json.loads(labware_with_liquid)
|
||||||
|
|
||||||
for step in input_steps['steps']:
|
for step in input_steps['steps']:
|
||||||
if step['operation'] != 'transfer':
|
if step['operation'] != 'transfer':
|
||||||
continue
|
continue
|
||||||
parameters = step['parameters']
|
parameters = step['parameters']
|
||||||
@@ -830,5 +838,5 @@ for step in input_steps['steps']:
|
|||||||
aspirate_techniques='MC P300 high',
|
aspirate_techniques='MC P300 high',
|
||||||
dispense_techniques='MC P300 high'
|
dispense_techniques='MC P300 high'
|
||||||
)
|
)
|
||||||
print(json.dumps(handler.temp_protocol['steps'],indent=4, ensure_ascii=False))
|
print(json.dumps(handler.temp_protocol['steps'],indent=4, ensure_ascii=False))
|
||||||
|
|
||||||
|
|||||||
@@ -805,7 +805,9 @@ class ROS2DeviceNode:
|
|||||||
self.resource_tracker = DeviceNodeResourceTracker()
|
self.resource_tracker = DeviceNodeResourceTracker()
|
||||||
|
|
||||||
# use_pylabrobot_creator 使用 cls的包路径检测
|
# use_pylabrobot_creator 使用 cls的包路径检测
|
||||||
use_pylabrobot_creator = driver_class.__module__.startswith("pylabrobot") or driver_class.__name__ == "LiquidHandlerAbstract"
|
use_pylabrobot_creator = (driver_class.__module__.startswith("pylabrobot")
|
||||||
|
or driver_class.__name__ == "LiquidHandlerAbstract"
|
||||||
|
or driver_class.__name__ == "LiquidHandlerBiomek")
|
||||||
|
|
||||||
# TODO: 要在创建之前预先请求服务器是否有当前id的物料,放到resource_tracker中,让pylabrobot进行创建
|
# TODO: 要在创建之前预先请求服务器是否有当前id的物料,放到resource_tracker中,让pylabrobot进行创建
|
||||||
# 创建设备类实例
|
# 创建设备类实例
|
||||||
|
|||||||
Reference in New Issue
Block a user