Fix handles

This commit is contained in:
Junhan Chang
2025-06-16 08:03:06 +08:00
parent 7b04f3fa50
commit 5b9e13555c
6 changed files with 76 additions and 79 deletions

View File

@@ -48,14 +48,14 @@ solenoid_valve.mock:
feedback: {}
result: {}
handles:
input:
- handler_key: fluid-input
label: Fluid Input
data_type: fluid
output:
side: NORTH
- handler_key: fluid-output
label: Fluid Output
data_type: fluid
side: SOUTH
init_param_schema:
type: object
properties:

View File

@@ -7,7 +7,7 @@
# 2. virtual_stirrer - 虚拟搅拌器
# 描述:机械连接设备,提供搅拌功能
# 连接特性1个双向连接点bidirectional
# 连接特性1个双向连接点undirected
# 数据类型mechanical机械连接
# 3a. virtual_valve - 虚拟八通阀门
@@ -32,12 +32,12 @@
# 6. virtual_heatchill - 虚拟加热/冷却器
# 描述:温控设备,容器直接放置在设备上进行温度控制
# 连接特性1个双向连接点bidirectional
# 连接特性1个双向连接点undirected
# 数据类型mechanical机械/物理接触连接)
# 7. virtual_transfer_pump - 虚拟转移泵(注射器式)
# 描述:注射器式转移泵,通过同一个口吸入和排出液体
# 连接特性1个双向连接点bidirectional
# 连接特性1个双向连接点undirected
# 数据类型fluid流体连接
# 8. virtual_column - 虚拟色谱柱
@@ -83,7 +83,6 @@ virtual_pump:
success: success
# 虚拟泵节点配置 - 具有多通道阀门特性根据valve_position可连接多个容器
handles:
input:
- handler_key: pump-inlet
label: Pump Inlet
data_type: fluid
@@ -91,14 +90,6 @@ virtual_pump:
data_source: handle
data_key: fluid_in
description: "泵的进液口,连接源容器"
output:
- handler_key: pump-outlet-1
label: Outlet Port 1
data_type: fluid
io_type: source
data_source: executor
data_key: fluid_out_1
description: "阀门位置1的出液口"
schema:
type: object
properties:
@@ -148,11 +139,11 @@ virtual_stirrer:
success: success
# 虚拟搅拌器节点配置 - 机械连接设备,单一双向连接点
handles:
bidirectional:
- handler_key: stirrer-vessel
label: Vessel Connection
data_type: mechanical
io_type: bidirectional
side: SOUTH
io_type: undirected
data_source: handle
data_key: vessel
description: "搅拌器的机械连接口,直接与反应容器连接提供搅拌功能"
@@ -191,7 +182,6 @@ virtual_multiway_valve:
success: success
# 八通阀门节点配置 - 1个输入口8个输出口可切换流向
handles:
input:
- handler_key: multiway-valve-inlet
label: Valve Inlet
data_type: fluid
@@ -199,59 +189,66 @@ virtual_multiway_valve:
data_source: handle
data_key: fluid_in
description: "八通阀门进液口,接收来源流体"
output:
- handler_key: multiway-valve-port-1
label: Port 1
label: 1
data_type: fluid
side: NORTH
io_type: source
data_source: executor
data_key: fluid_port_1
description: "八通阀门端口1position=1时流体从此口流出"
- handler_key: multiway-valve-port-2
label: Port 2
label: 2
data_type: fluid
side: EAST
io_type: source
data_source: executor
data_key: fluid_port_2
description: "八通阀门端口2position=2时流体从此口流出"
- handler_key: multiway-valve-port-3
label: Port 3
label: 3
data_type: fluid
side: EAST
io_type: source
data_source: executor
data_key: fluid_port_3
description: "八通阀门端口3position=3时流体从此口流出"
- handler_key: multiway-valve-port-4
label: Port 4
label: 4
data_type: fluid
side: SOUTH
io_type: source
data_source: executor
data_key: fluid_port_4
description: "八通阀门端口4position=4时流体从此口流出"
- handler_key: multiway-valve-port-5
label: Port 5
label: 5
data_type: fluid
side: SOUTH
io_type: source
data_source: executor
data_key: fluid_port_5
description: "八通阀门端口5position=5时流体从此口流出"
- handler_key: multiway-valve-port-6
label: Port 6
data_type: fluid
io_type: source
data_source: executor
data_key: fluid_port_6
description: "八通阀门端口6position=6时流体从此口流出"
- handler_key: multiway-valve-port-7
label: Port 7
label: 7
data_type: fluid
side: WEST
io_type: source
data_source: executor
data_key: fluid_port_7
description: "八通阀门端口7position=7时流体从此口流出"
- handler_key: multiway-valve-port-8
label: Port 8
- handler_key: multiway-valve-port-6
label: 6
data_type: fluid
side: WEST
io_type: source
data_source: executor
data_key: fluid_port_6
description: "八通阀门端口6position=6时流体从此口流出"
- handler_key: multiway-valve-port-8
label: 8
data_type: fluid
side: NORTH
io_type: source
data_source: executor
data_key: fluid_port_8
@@ -299,11 +296,17 @@ virtual_solenoid_valve:
success: success
# 电磁阀门节点配置 - 双向流通的开关型阀门,流动方向由泵决定
handles:
bidirectional:
- handler_key: solenoid-valve-port
label: Valve Port
- handler_key: solenoid-valve-port-in
label: in
data_type: fluid
io_type: bidirectional
io_type: undirected
data_source: handle
data_key: fluid_port
description: "电磁阀的双向流体口,开启时允许流体双向通过,关闭时完全阻断"
- handler_key: solenoid-valve-port-out
label: out
data_type: fluid
io_type: undirected
data_source: handle
data_key: fluid_port
description: "电磁阀的双向流体口,开启时允许流体双向通过,关闭时完全阻断"
@@ -354,22 +357,13 @@ virtual_centrifuge:
message: message
# 虚拟离心机节点配置 - 单个样品处理设备,输入输出都是同一个样品容器
handles:
input:
- handler_key: centrifuge-sample
label: Sample Input
data_type: resource
io_type: target
label: Sample Input/Output
data_type: transport
io_type: undirected
data_source: handle
data_key: vessel
description: "需要离心的样品容器"
output:
- handler_key: centrifuge-sample-out
label: Centrifuged Sample
data_type: resource
io_type: source
data_source: executor
data_key: vessel
description: "经过离心处理的样品容器"
schema:
type: object
properties:
@@ -424,25 +418,26 @@ virtual_filter:
message: message
# 虚拟过滤器节点配置 - 分离设备1个输入(原始样品)2个输出(滤液和滤渣)
handles:
input:
- handler_key: filter-sample-in
label: Sample Input
data_type: resource
- handler_key: filter-in
label: Input
data_type: fluid
side: NORTH
io_type: target
data_source: handle
data_key: vessel
description: "需要过滤的原始样品容器"
output:
- handler_key: filter-filtrate-out
label: Filtrate Output
data_type: resource
label: Output
data_type: fluid
side: SOUTH
io_type: source
data_source: executor
data_key: filtrate_vessel
description: "过滤后的滤液容器"
- handler_key: filter-residue-out
label: Filter Residue
label: Residue
data_type: resource
side: WEST
io_type: source
data_source: executor
data_key: residue_vessel
@@ -502,11 +497,11 @@ virtual_heatchill:
success: success
# 虚拟加热/冷却器节点配置 - 温控设备,单一双向连接点用于放置容器
handles:
bidirectional:
- handler_key: heatchill-vessel
label: Vessel Connection
label: Connection
data_type: mechanical
io_type: bidirectional
side: NORTH
io_type: undirected
data_source: handle
data_key: vessel
description: "加热/冷却器的物理连接口,容器直接放置在设备上进行温度控制"
@@ -530,7 +525,7 @@ virtual_heatchill:
virtual_transfer_pump:
description: Virtual Transfer Pump for TransferProtocol Testing (Syringe-style)
class:
module: unilabos.devices.virtual.virtual_transferpump:VirtualTransferPump
module: unilabos.devices.virtual.virtual_transferpump:VirtualPump
type: python
status_types:
status: String
@@ -565,11 +560,11 @@ virtual_transfer_pump:
message: message
# 注射器式转移泵节点配置 - 只有一个双向连接口,可吸入和排出液体
handles:
bidirectional:
undirected:
- handler_key: syringe-port
label: Syringe Port
data_type: fluid
io_type: bidirectional
io_type: undirected
data_source: handle
data_key: fluid_port
description: "注射器式转移泵的唯一连接口,通过阀门切换实现吸入和排出"
@@ -617,18 +612,18 @@ virtual_column:
message: message
# 虚拟色谱柱节点配置 - 分离纯化设备1个样品输入口1个纯化产物输出口
handles:
input:
- handler_key: column-sample-inlet
label: Sample Input
data_type: resource
data_type: fluid
side: NORTH
io_type: target
data_source: handle
data_key: from_vessel
description: "需要纯化的样品输入口"
output:
- handler_key: column-product-outlet
label: Purified Product
data_type: resource
data_type: fluid
side: SOUTH
io_type: source
data_source: executor
data_key: to_vessel

View File

@@ -100,7 +100,7 @@ _action_mapping: Dict[Type, Dict[str, Any]] = {
# 添加Protocol action类型到映射
for py_msgtype in imsg.__all__:
if py_msgtype not in _action_mapping and py_msgtype.endswith("Protocol"):
if py_msgtype not in _action_mapping and (py_msgtype.endswith("Protocol") or py_msgtype.startswith("Protocol")):
try:
protocol_class = msg_converter_manager.get_class(f"unilabos.messages.{py_msgtype}")
action_name = py_msgtype.replace("Protocol", "")
@@ -117,6 +117,7 @@ for py_msgtype in imsg.__all__:
"result": {k: k for k in action_type.Result().get_fields_and_field_types().keys()},
}
except Exception:
traceback.print_exc()
logger.debug(f"Failed to load Protocol class: {py_msgtype}")
# Python到ROS消息转换器