Compare commits

..

13 Commits

Author SHA1 Message Date
ZiWei
b61c818f7f Merge remote-tracking branch 'origin/dev' into feature/organic-extraction 2026-03-09 09:39:17 +08:00
ZiWei
47a29a0c2f add:skill&agent 2026-03-06 16:54:31 +08:00
ZiWei
9c6f7c7505 Merge branch 'dev' into feature/organic-extraction 2026-03-02 15:32:36 +08:00
ZiWei
e4e4bfbe20 Merge branch 'dev' into feature/organic-extraction 2026-02-04 15:47:47 +08:00
ZiWei
64c748d921 Merge branch 'vibe/dev' into feature/organic-extraction 2026-02-03 10:39:44 +08:00
ZiWei
15ff0e9d30 feat: add Bioyond deck imports to resource registration 2026-02-03 10:28:51 +08:00
ZiWei
f8a52860ad Add BIOYOND deck imports and update JSON configurations with new UUIDs for various components 2026-02-03 10:25:47 +08:00
Xuwznln
e30c01d54e Dev backward (#228)
* Workbench example, adjust log level, and ci check (#220)

* TestLatency Return Value Example & gitignore update

* Adjust log level & Add workbench virtual example & Add not action decorator & Add check_mode &

* Add CI Check

* CI Check Fix 1

* CI Check Fix 2

* CI Check Fix 3

* CI Check Fix 4

* CI Check Fix 5

* Upgrade to py 3.11.14; ros 0.7; unilabos 0.10.16

* Update to ROS2 Humble 0.7

* Fix Build 1

* Fix Build 2

* Fix Build 3

* Fix Build 4

* Fix Build 5

* Fix Build 6

* Fix Build 7

* ci(deps): bump actions/configure-pages from 4 to 5 (#222)

Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 4 to 5.
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](https://github.com/actions/configure-pages/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/configure-pages
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(deps): bump actions/upload-artifact from 4 to 6 (#224)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(deps): bump actions/upload-pages-artifact from 3 to 4 (#225)

Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](https://github.com/actions/upload-pages-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci(deps): bump actions/checkout from 4 to 6 (#223)

Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix Build 8

* Fix Build 9

* Fix Build 10

* Fix Build 11

* Fix Build 12

* Fix Build 13

* v0.10.17

(cherry picked from commit 176de521b4)

* CI Check use production mode

* Fix OT2 & ReAdd Virtual Devices

* add msg goal

* transfer liquid handles

* gather query

* add unilabos_class

* Support root node change pos

* save class name when deserialize & protocol execute test

* fix upload workflow json

* workflow upload & set liquid fix & add set liquid with plate

* speed up registry load

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: hanhua@dp.tech <2509856570@qq.com>
2026-02-02 23:57:13 +08:00
ZiWei
37ec49f318 Refactor Bioyond resource handling: update warehouse mapping retrieval, add TipBox support, and improve liquid tracking logic. Migrate TipBox creation to bottle_carriers.py for better structure. 2026-01-29 16:31:14 +08:00
ZiWei
6bf57f18c1 Collaboration With Cursor 2026-01-29 11:29:38 +08:00
ZiWei
c4a3be1498 feat: enhance separation_step logic with polling thread management and error handling 2026-01-27 12:37:09 +08:00
ZiWei
e11070315d feat: add separation_step with sensor-motor linkage 2026-01-26 23:34:47 +08:00
ZiWei
50ebcad9d7 feat: add ZDT_X42 motor and XKC sensor drivers 2026-01-22 15:07:32 +08:00
131 changed files with 14989 additions and 10941 deletions

View File

@@ -3,7 +3,7 @@
package: package:
name: unilabos name: unilabos
version: 0.10.19 version: 0.10.18
source: source:
path: ../../unilabos path: ../../unilabos
@@ -54,7 +54,7 @@ requirements:
- pymodbus - pymodbus
- matplotlib - matplotlib
- pylibftdi - pylibftdi
- uni-lab::unilabos-env ==0.10.19 - uni-lab::unilabos-env ==0.10.18
about: about:
repository: https://github.com/deepmodeling/Uni-Lab-OS repository: https://github.com/deepmodeling/Uni-Lab-OS

View File

@@ -2,7 +2,7 @@
package: package:
name: unilabos-env name: unilabos-env
version: 0.10.19 version: 0.10.18
build: build:
noarch: generic noarch: generic

View File

@@ -3,7 +3,7 @@
package: package:
name: unilabos-full name: unilabos-full
version: 0.10.19 version: 0.10.18
build: build:
noarch: generic noarch: generic
@@ -11,7 +11,7 @@ build:
requirements: requirements:
run: run:
# Base unilabos package (includes unilabos-env) # Base unilabos package (includes unilabos-env)
- uni-lab::unilabos ==0.10.19 - uni-lab::unilabos ==0.10.18
# Documentation tools # Documentation tools
- sphinx - sphinx
- sphinx_rtd_theme - sphinx_rtd_theme

View File

@@ -0,0 +1,328 @@
---
description: 设备驱动开发规范
globs: ["unilabos/devices/**/*.py"]
---
# 设备驱动开发规范
## 目录结构
```
unilabos/devices/
├── virtual/ # 虚拟设备(用于测试)
│ ├── virtual_stirrer.py
│ └── virtual_centrifuge.py
├── liquid_handling/ # 液体处理设备
├── balance/ # 天平设备
├── hplc/ # HPLC设备
├── pump_and_valve/ # 泵和阀门
├── temperature/ # 温度控制设备
├── workstation/ # 工作站(组合设备)
└── ...
```
## 设备类完整模板
```python
import asyncio
import logging
import time as time_module
from typing import Dict, Any, Optional
from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode
class MyDevice:
"""
设备类描述
Attributes:
device_id: 设备唯一标识
config: 设备配置字典
data: 设备状态数据
"""
_ros_node: BaseROS2DeviceNode
def __init__(
self,
device_id: str = None,
config: Dict[str, Any] = None,
**kwargs
):
"""
初始化设备
Args:
device_id: 设备ID
config: 配置字典
**kwargs: 其他参数
"""
# 兼容不同调用方式
if device_id is None and 'id' in kwargs:
device_id = kwargs.pop('id')
if config is None and 'config' in kwargs:
config = kwargs.pop('config')
self.device_id = device_id or "unknown_device"
self.config = config or {}
self.data = {}
# 从config读取参数
self.port = self.config.get('port') or kwargs.get('port', 'COM1')
self._max_value = self.config.get('max_value', 1000.0)
# 初始化日志
self.logger = logging.getLogger(f"MyDevice.{self.device_id}")
self.logger.info(f"设备 {self.device_id} 已创建")
def post_init(self, ros_node: BaseROS2DeviceNode):
"""
ROS节点注入 - 在ROS节点创建后调用
Args:
ros_node: ROS2设备节点实例
"""
self._ros_node = ros_node
async def initialize(self) -> bool:
"""
初始化设备 - 连接硬件、设置初始状态
Returns:
bool: 初始化是否成功
"""
self.logger.info(f"初始化设备 {self.device_id}")
try:
# 执行硬件初始化
# await self._connect_hardware()
# 设置初始状态
self.data.update({
"status": "待机",
"is_running": False,
"current_value": 0.0,
})
self.logger.info(f"设备 {self.device_id} 初始化完成")
return True
except Exception as e:
self.logger.error(f"初始化失败: {e}")
self.data["status"] = f"错误: {e}"
return False
async def cleanup(self) -> bool:
"""
清理设备 - 断开连接、释放资源
Returns:
bool: 清理是否成功
"""
self.logger.info(f"清理设备 {self.device_id}")
self.data.update({
"status": "离线",
"is_running": False,
})
return True
# ==================== 设备动作 ====================
async def execute_action(
self,
param1: float,
param2: str = "",
**kwargs
) -> bool:
"""
执行设备动作
Args:
param1: 参数1
param2: 参数2可选
Returns:
bool: 动作是否成功
"""
# 类型转换和验证
try:
param1 = float(param1)
except (ValueError, TypeError) as e:
self.logger.error(f"参数类型错误: {e}")
return False
# 参数验证
if param1 > self._max_value:
self.logger.error(f"参数超出范围: {param1} > {self._max_value}")
return False
self.logger.info(f"执行动作: param1={param1}, param2={param2}")
# 更新状态
self.data.update({
"status": "运行中",
"is_running": True,
})
# 执行动作(带进度反馈)
duration = 10.0 # 秒
start_time = time_module.time()
while True:
elapsed = time_module.time() - start_time
remaining = max(0, duration - elapsed)
progress = min(100, (elapsed / duration) * 100)
self.data.update({
"status": f"运行中: {progress:.0f}%",
"remaining_time": remaining,
})
if remaining <= 0:
break
await self._ros_node.sleep(1.0)
# 完成
self.data.update({
"status": "完成",
"is_running": False,
})
self.logger.info("动作执行完成")
return True
# ==================== 状态属性 ====================
@property
def status(self) -> str:
"""设备状态 - 自动发布为ROS Topic"""
return self.data.get("status", "未知")
@property
def is_running(self) -> bool:
"""是否正在运行"""
return self.data.get("is_running", False)
@property
def current_value(self) -> float:
"""当前值"""
return self.data.get("current_value", 0.0)
# ==================== 辅助方法 ====================
def get_device_info(self) -> Dict[str, Any]:
"""获取设备信息"""
return {
"device_id": self.device_id,
"status": self.status,
"is_running": self.is_running,
"current_value": self.current_value,
}
def __str__(self) -> str:
return f"MyDevice({self.device_id}: {self.status})"
```
## 关键规则
### 1. 参数处理
所有动作方法的参数都可能以字符串形式传入,必须进行类型转换:
```python
async def my_action(self, value: float, **kwargs) -> bool:
# 始终进行类型转换
try:
value = float(value)
except (ValueError, TypeError) as e:
self.logger.error(f"参数类型错误: {e}")
return False
```
### 2. vessel 参数处理
vessel 参数可能是字符串ID或字典
```python
def extract_vessel_id(vessel: Union[str, dict]) -> str:
if isinstance(vessel, dict):
return vessel.get("id", "")
return str(vessel) if vessel else ""
```
### 3. 状态更新
使用 `self.data` 字典存储状态,属性读取状态:
```python
# 更新状态
self.data["status"] = "运行中"
self.data["current_speed"] = 300.0
# 读取状态(通过属性)
@property
def status(self) -> str:
return self.data.get("status", "待机")
```
### 4. 异步等待
使用 ROS 节点的 sleep 方法:
```python
# 正确
await self._ros_node.sleep(1.0)
# 避免(除非在纯 Python 测试环境)
await asyncio.sleep(1.0)
```
### 5. 进度反馈
长时间运行的操作需要提供进度反馈:
```python
while remaining > 0:
progress = (elapsed / total_time) * 100
self.data["status"] = f"运行中: {progress:.0f}%"
self.data["remaining_time"] = remaining
await self._ros_node.sleep(1.0)
```
## 虚拟设备
虚拟设备用于测试和演示,放在 `unilabos/devices/virtual/` 目录:
- 类名以 `Virtual` 开头
- 文件名以 `virtual_` 开头
- 模拟真实设备的行为和时序
- 使用表情符号增强日志可读性(可选)
## 工作站设备
工作站是组合多个设备的复杂设备:
```python
from unilabos.devices.workstation.workstation_base import WorkstationBase
class MyWorkstation(WorkstationBase):
"""组合工作站"""
async def execute_workflow(self, workflow: Dict[str, Any]) -> bool:
"""执行工作流"""
pass
```
## 设备注册
设备类开发完成后,需要在注册表中注册:
1. 创建/编辑 `unilabos/registry/devices/my_category.yaml`
2. 添加设备配置(参考 `virtual_device.yaml`
3. 运行 `--complete_registry` 自动生成 schema

View File

@@ -0,0 +1,240 @@
---
description: 协议编译器开发规范
globs: ["unilabos/compile/**/*.py"]
---
# 协议编译器开发规范
## 概述
协议编译器负责将高级实验操作(如 Stir、Add、Filter编译为设备可执行的动作序列。
## 文件命名
- 位置: `unilabos/compile/`
- 命名: `{operation}_protocol.py`
- 示例: `stir_protocol.py`, `add_protocol.py`, `filter_protocol.py`
## 协议函数模板
```python
from typing import List, Dict, Any, Union
import networkx as nx
import logging
from .utils.unit_parser import parse_time_input
from .utils.vessel_parser import extract_vessel_id
logger = logging.getLogger(__name__)
def generate_{operation}_protocol(
G: nx.DiGraph,
vessel: Union[str, dict],
param1: Union[str, float] = "0",
param2: float = 0.0,
**kwargs
) -> List[Dict[str, Any]]:
"""
生成{操作}协议序列
Args:
G: 物理拓扑图 (NetworkX DiGraph)
vessel: 容器ID或Resource字典
param1: 参数1支持字符串单位如 "5 min"
param2: 参数2
**kwargs: 其他参数
Returns:
List[Dict]: 动作序列
Raises:
ValueError: 参数无效时
"""
# 1. 提取 vessel_id
vessel_id = extract_vessel_id(vessel)
# 2. 验证参数
if not vessel_id:
raise ValueError("vessel 参数不能为空")
if vessel_id not in G.nodes():
raise ValueError(f"容器 '{vessel_id}' 不存在于系统中")
# 3. 解析参数(支持单位)
parsed_param1 = parse_time_input(param1) # "5 min" -> 300.0
# 4. 查找设备
device_id = find_connected_device(G, vessel_id, device_type="my_device")
# 5. 生成动作序列
action_sequence = []
action = {
"device_id": device_id,
"action_name": "my_action",
"action_kwargs": {
"vessel": {"id": vessel_id}, # 始终使用字典格式
"param1": float(parsed_param1),
"param2": float(param2),
}
}
action_sequence.append(action)
logger.info(f"生成协议: {len(action_sequence)} 个动作")
return action_sequence
def find_connected_device(
G: nx.DiGraph,
vessel_id: str,
device_type: str = ""
) -> str:
"""
查找与容器相连的设备
Args:
G: 拓扑图
vessel_id: 容器ID
device_type: 设备类型关键字
Returns:
str: 设备ID
"""
# 查找所有匹配类型的设备
device_nodes = []
for node in G.nodes():
node_class = G.nodes[node].get('class', '') or ''
if device_type.lower() in node_class.lower():
device_nodes.append(node)
# 检查连接
if vessel_id and device_nodes:
for device in device_nodes:
if G.has_edge(device, vessel_id) or G.has_edge(vessel_id, device):
return device
# 返回第一个可用设备
if device_nodes:
return device_nodes[0]
# 默认设备
return f"{device_type}_1"
```
## 关键规则
### 1. vessel 参数处理
vessel 参数可能是字符串或字典,需要统一处理:
```python
def extract_vessel_id(vessel: Union[str, dict]) -> str:
"""提取vessel_id"""
if isinstance(vessel, dict):
# 可能是 {"id": "xxx"} 或完整 Resource 对象
return vessel.get("id", list(vessel.values())[0].get("id", ""))
return str(vessel) if vessel else ""
```
### 2. action_kwargs 中的 vessel
始终使用 `{"id": vessel_id}` 格式传递 vessel
```python
# 正确
"action_kwargs": {
"vessel": {"id": vessel_id}, # 字符串ID包装为字典
}
# 避免
"action_kwargs": {
"vessel": vessel_resource, # 不要传递完整 Resource 对象
}
```
### 3. 单位解析
使用 `parse_time_input` 解析时间参数:
```python
from .utils.unit_parser import parse_time_input
# 支持格式: "5 min", "1 h", "300", "1.5 hours"
time_seconds = parse_time_input("5 min") # -> 300.0
time_seconds = parse_time_input(120) # -> 120.0
time_seconds = parse_time_input("1 h") # -> 3600.0
```
### 4. 参数验证
所有参数必须进行验证和类型转换:
```python
# 验证范围
if speed < 10.0 or speed > 1500.0:
logger.warning(f"速度 {speed} 超出范围,修正为 300")
speed = 300.0
# 类型转换
param = float(param) if not isinstance(param, (int, float)) else param
```
### 5. 日志记录
使用项目日志记录器:
```python
logger = logging.getLogger(__name__)
def generate_protocol(...):
logger.info(f"开始生成协议...")
logger.debug(f"参数: vessel={vessel_id}, time={time}")
logger.warning(f"参数修正: {old_value} -> {new_value}")
```
## 便捷函数
为常用操作提供便捷函数:
```python
def stir_briefly(G: nx.DiGraph, vessel: Union[str, dict],
speed: float = 300.0) -> List[Dict[str, Any]]:
"""短时间搅拌30秒"""
return generate_stir_protocol(G, vessel, time="30", stir_speed=speed)
def stir_vigorously(G: nx.DiGraph, vessel: Union[str, dict],
time: str = "5 min") -> List[Dict[str, Any]]:
"""剧烈搅拌"""
return generate_stir_protocol(G, vessel, time=time, stir_speed=800.0)
```
## 测试函数
每个协议文件应包含测试函数:
```python
def test_{operation}_protocol():
"""测试协议生成"""
# 测试参数处理
vessel_dict = {"id": "flask_1", "name": "反应瓶1"}
vessel_id = extract_vessel_id(vessel_dict)
assert vessel_id == "flask_1"
# 测试单位解析
time_s = parse_time_input("5 min")
assert time_s == 300.0
if __name__ == "__main__":
test_{operation}_protocol()
```
## 现有协议参考
- `stir_protocol.py` - 搅拌操作
- `add_protocol.py` - 添加物料
- `filter_protocol.py` - 过滤操作
- `heatchill_protocol.py` - 加热/冷却
- `separate_protocol.py` - 分离操作
- `evaporate_protocol.py` - 蒸发操作

View File

@@ -0,0 +1,319 @@
---
description: 注册表配置规范 (YAML)
globs: ["unilabos/registry/**/*.yaml"]
---
# 注册表配置规范
## 概述
注册表使用 YAML 格式定义设备和资源类型,是 Uni-Lab-OS 的核心配置系统。
## 目录结构
```
unilabos/registry/
├── devices/ # 设备类型注册
│ ├── virtual_device.yaml
│ ├── liquid_handler.yaml
│ └── ...
├── device_comms/ # 通信设备配置
│ ├── communication_devices.yaml
│ └── modbus_ioboard.yaml
└── resources/ # 资源类型注册
├── bioyond/
├── organic/
├── opentrons/
└── ...
```
## 设备注册表格式
### 基本结构
```yaml
device_type_id:
# 基本信息
description: "设备描述"
version: "1.0.0"
category:
- category_name
icon: "icon_device.webp"
# 类配置
class:
module: "unilabos.devices.my_module:MyClass"
type: python
# 状态类型(属性 -> ROS消息类型
status_types:
status: String
temperature: Float64
is_running: Bool
# 动作映射
action_value_mappings:
action_name:
type: UniLabJsonCommand # 或 UniLabJsonCommandAsync
goal: {}
feedback: {}
result: {}
schema: {...}
handles: {}
```
### action_value_mappings 详细格式
```yaml
action_value_mappings:
# 同步动作
my_sync_action:
type: UniLabJsonCommand
goal:
param1: param1
param2: param2
feedback: {}
result:
success: success
message: message
goal_default:
param1: 0.0
param2: ""
handles: {}
placeholder_keys:
device_param: unilabos_devices # 设备选择器
resource_param: unilabos_resources # 资源选择器
schema:
title: "动作名称参数"
description: "动作描述"
type: object
properties:
goal:
type: object
properties:
param1:
type: number
param2:
type: string
required:
- param1
feedback: {}
result:
type: object
properties:
success:
type: boolean
message:
type: string
required:
- goal
# 异步动作
my_async_action:
type: UniLabJsonCommandAsync
goal: {}
feedback:
progress: progress
current_status: status
result:
success: success
schema: {...}
```
### 自动生成的动作
以 `auto-` 开头的动作由系统自动生成:
```yaml
action_value_mappings:
auto-initialize:
type: UniLabJsonCommandAsync
goal: {}
feedback: {}
result: {}
schema: {...}
auto-cleanup:
type: UniLabJsonCommandAsync
goal: {}
feedback: {}
result: {}
schema: {...}
```
### handles 配置
用于工作流编辑器中的数据流连接:
```yaml
handles:
input:
- handler_key: "input_resource"
data_type: "resource"
label: "输入资源"
data_source: "handle"
data_key: "resources"
output:
- handler_key: "output_labware"
data_type: "resource"
label: "输出器皿"
data_source: "executor"
data_key: "created_resource.@flatten"
```
## 资源注册表格式
```yaml
resource_type_id:
description: "资源描述"
version: "1.0.0"
category:
- category_name
icon: ""
handles: []
init_param_schema: {}
class:
module: "unilabos.resources.my_module:MyResource"
type: pylabrobot # 或 python
```
### PyLabRobot 资源示例
```yaml
BIOYOND_Electrolyte_6VialCarrier:
category:
- bottle_carriers
- bioyond
class:
module: "unilabos.resources.bioyond.bottle_carriers:BIOYOND_Electrolyte_6VialCarrier"
type: pylabrobot
version: "1.0.0"
```
## 状态类型映射
Python 类型到 ROS 消息类型的映射:
| Python 类型 | ROS 消息类型 |
|------------|-------------|
| `str` | `String` |
| `bool` | `Bool` |
| `int` | `Int64` |
| `float` | `Float64` |
| `list` | `String` (序列化) |
| `dict` | `String` (序列化) |
## 自动完善注册表
使用 `--complete_registry` 参数自动生成 schema
```bash
python -m unilabos.app.main --complete_registry
```
这会:
1. 扫描设备类的方法签名
2. 自动生成 `auto-` 前缀的动作
3. 生成 JSON Schema
4. 更新 YAML 文件
## 验证规则
1. **device_type_id** 必须唯一
2. **module** 路径必须正确可导入
3. **status_types** 的类型必须是有效的 ROS 消息类型
4. **schema** 必须是有效的 JSON Schema
## 示例:完整设备配置
```yaml
virtual_stirrer:
category:
- virtual_device
description: "虚拟搅拌器设备"
version: "1.0.0"
icon: "icon_stirrer.webp"
handles: []
init_param_schema: {}
class:
module: "unilabos.devices.virtual.virtual_stirrer:VirtualStirrer"
type: python
status_types:
status: String
operation_mode: String
current_speed: Float64
is_stirring: Bool
remaining_time: Float64
action_value_mappings:
auto-initialize:
type: UniLabJsonCommandAsync
goal: {}
feedback: {}
result: {}
schema:
title: "initialize参数"
type: object
properties:
goal:
type: object
properties: {}
feedback: {}
result: {}
required:
- goal
stir:
type: UniLabJsonCommandAsync
goal:
stir_time: stir_time
stir_speed: stir_speed
settling_time: settling_time
feedback:
current_speed: current_speed
remaining_time: remaining_time
result:
success: success
goal_default:
stir_time: 60.0
stir_speed: 300.0
settling_time: 30.0
handles: {}
schema:
title: "stir参数"
description: "搅拌操作"
type: object
properties:
goal:
type: object
properties:
stir_time:
type: number
description: "搅拌时间(秒)"
stir_speed:
type: number
description: "搅拌速度RPM"
settling_time:
type: number
description: "沉降时间(秒)"
required:
- stir_time
- stir_speed
feedback:
type: object
properties:
current_speed:
type: number
remaining_time:
type: number
result:
type: object
properties:
success:
type: boolean
required:
- goal
```

View File

@@ -0,0 +1,233 @@
---
description: ROS 2 集成开发规范
globs: ["unilabos/ros/**/*.py", "**/*_node.py"]
---
# ROS 2 集成开发规范
## 概述
Uni-Lab-OS 使用 ROS 2 作为设备通信中间件,基于 rclpy 实现。
## 核心组件
### BaseROS2DeviceNode
设备节点基类,提供:
- ROS Topic 自动发布(状态属性)
- Action Server 自动创建(设备动作)
- 资源管理服务
- 异步任务调度
```python
from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode
```
### 消息转换器
```python
from unilabos.ros.msgs.message_converter import (
convert_to_ros_msg,
convert_from_ros_msg_with_mapping,
msg_converter_manager,
ros_action_to_json_schema,
ros_message_to_json_schema,
)
```
## 设备与 ROS 集成
### post_init 方法
设备类必须实现 `post_init` 方法接收 ROS 节点:
```python
class MyDevice:
_ros_node: BaseROS2DeviceNode
def post_init(self, ros_node: BaseROS2DeviceNode):
"""ROS节点注入"""
self._ros_node = ros_node
```
### 状态属性发布
设备的 `@property` 属性会自动发布为 ROS Topic
```python
class MyDevice:
@property
def temperature(self) -> float:
return self._temperature
# 自动发布到 /{namespace}/temperature Topic
```
### Topic 配置装饰器
```python
from unilabos.utils.decorator import topic_config
class MyDevice:
@property
@topic_config(period=1.0, print_publish=False, qos=10)
def fast_data(self) -> float:
"""高频数据 - 每秒发布一次"""
return self._fast_data
@property
@topic_config(period=5.0)
def slow_data(self) -> str:
"""低频数据 - 每5秒发布一次"""
return self._slow_data
```
### 订阅装饰器
```python
from unilabos.utils.decorator import subscribe
class MyDevice:
@subscribe(topic="/external/sensor_data", qos=10)
def on_sensor_data(self, msg):
"""订阅外部Topic"""
self._sensor_value = msg.data
```
## 异步操作
### 使用 ROS 节点睡眠
```python
# 推荐使用ROS节点的睡眠方法
await self._ros_node.sleep(1.0)
# 不推荐直接使用asyncio可能导致回调阻塞
await asyncio.sleep(1.0)
```
### 获取事件循环
```python
from unilabos.ros.x.rclpyx import get_event_loop
loop = get_event_loop()
```
## 消息类型
### unilabos_msgs 包
```python
from unilabos_msgs.msg import Resource
from unilabos_msgs.srv import (
ResourceAdd,
ResourceDelete,
ResourceUpdate,
ResourceList,
SerialCommand,
)
from unilabos_msgs.action import SendCmd
```
### Resource 消息结构
```python
Resource:
id: str
name: str
category: str
type: str
parent: str
children: List[str]
config: str # JSON字符串
data: str # JSON字符串
sample_id: str
pose: Pose
```
## 日志适配器
```python
from unilabos.utils.log import info, debug, warning, error, trace
class MyDevice:
def __init__(self):
# 创建设备专属日志器
self.logger = logging.getLogger(f"MyDevice.{self.device_id}")
```
ROSLoggerAdapter 同时向自定义日志和 ROS 日志发送消息。
## Action Server
设备动作自动创建为 ROS Action Server
```yaml
# 在注册表中配置
action_value_mappings:
my_action:
type: UniLabJsonCommandAsync # 异步Action
goal: {...}
feedback: {...}
result: {...}
```
### Action 类型
- **UniLabJsonCommand**: 同步动作
- **UniLabJsonCommandAsync**: 异步动作支持feedback
## 服务客户端
```python
from rclpy.client import Client
# 调用其他节点的服务
response = await self._ros_node.call_service(
service_name="/other_node/service",
request=MyServiceRequest(...)
)
```
## 命名空间
设备节点使用命名空间隔离:
```
/{device_id}/ # 设备命名空间
/{device_id}/status # 状态Topic
/{device_id}/temperature # 温度Topic
/{device_id}/my_action # 动作Server
```
## 调试
### 查看 Topic
```bash
ros2 topic list
ros2 topic echo /{device_id}/status
```
### 查看 Action
```bash
ros2 action list
ros2 action info /{device_id}/my_action
```
### 查看 Service
```bash
ros2 service list
ros2 service call /{device_id}/resource_list unilabos_msgs/srv/ResourceList
```
## 最佳实践
1. **状态属性命名**: 使用蛇形命名法snake_case
2. **Topic 频率**: 根据数据变化频率调整,避免过高频率
3. **Action 反馈**: 长时间操作提供进度反馈
4. **错误处理**: 使用 try-except 捕获并记录错误
5. **资源清理**: 在 cleanup 方法中正确清理资源

View File

@@ -0,0 +1,357 @@
---
description: 测试开发规范
globs: ["tests/**/*.py", "**/test_*.py"]
---
# 测试开发规范
## 目录结构
```
tests/
├── __init__.py
├── devices/ # 设备测试
│ └── liquid_handling/
│ └── test_transfer_liquid.py
├── resources/ # 资源测试
│ ├── test_bottle_carrier.py
│ └── test_resourcetreeset.py
├── ros/ # ROS消息测试
│ └── msgs/
│ ├── test_basic.py
│ ├── test_conversion.py
│ └── test_mapping.py
└── workflow/ # 工作流测试
└── merge_workflow.py
```
## 测试框架
使用 pytest 作为测试框架:
```bash
# 运行所有测试
pytest tests/
# 运行特定测试文件
pytest tests/resources/test_bottle_carrier.py
# 运行特定测试函数
pytest tests/resources/test_bottle_carrier.py::test_bottle_carrier
# 显示详细输出
pytest -v tests/
# 显示打印输出
pytest -s tests/
```
## 测试文件模板
```python
import pytest
from typing import List, Dict, Any
# 导入被测试的模块
from unilabos.resources.bioyond.bottle_carriers import (
BIOYOND_Electrolyte_6VialCarrier,
)
from unilabos.resources.bioyond.bottles import (
BIOYOND_PolymerStation_Solid_Vial,
)
class TestBottleCarrier:
"""BottleCarrier 测试类"""
def setup_method(self):
"""每个测试方法前执行"""
self.carrier = BIOYOND_Electrolyte_6VialCarrier("test_carrier")
def teardown_method(self):
"""每个测试方法后执行"""
pass
def test_carrier_creation(self):
"""测试载架创建"""
assert self.carrier.name == "test_carrier"
assert len(self.carrier.sites) == 6
def test_bottle_placement(self):
"""测试瓶子放置"""
bottle = BIOYOND_PolymerStation_Solid_Vial("test_bottle")
# 测试逻辑...
assert bottle.name == "test_bottle"
def test_standalone_function():
"""独立测试函数"""
result = some_function()
assert result is True
# 参数化测试
@pytest.mark.parametrize("input,expected", [
("5 min", 300.0),
("1 h", 3600.0),
("120", 120.0),
(60, 60.0),
])
def test_time_parsing(input, expected):
"""测试时间解析"""
from unilabos.compile.utils.unit_parser import parse_time_input
assert parse_time_input(input) == expected
# 异常测试
def test_invalid_input_raises_error():
"""测试无效输入抛出异常"""
with pytest.raises(ValueError) as exc_info:
invalid_function("bad_input")
assert "invalid" in str(exc_info.value).lower()
# 跳过条件测试
@pytest.mark.skipif(
not os.environ.get("ROS_DISTRO"),
reason="需要ROS环境"
)
def test_ros_feature():
"""需要ROS环境的测试"""
pass
```
## 设备测试
### 虚拟设备测试
```python
import pytest
import asyncio
from unittest.mock import MagicMock, AsyncMock
from unilabos.devices.virtual.virtual_stirrer import VirtualStirrer
class TestVirtualStirrer:
"""VirtualStirrer 测试"""
@pytest.fixture
def stirrer(self):
"""创建测试用搅拌器"""
device = VirtualStirrer(
device_id="test_stirrer",
config={"max_speed": 1500.0, "min_speed": 50.0}
)
# Mock ROS节点
mock_node = MagicMock()
mock_node.sleep = AsyncMock(return_value=None)
device.post_init(mock_node)
return device
@pytest.mark.asyncio
async def test_initialize(self, stirrer):
"""测试初始化"""
result = await stirrer.initialize()
assert result is True
assert stirrer.status == "待机中"
@pytest.mark.asyncio
async def test_stir_action(self, stirrer):
"""测试搅拌动作"""
await stirrer.initialize()
result = await stirrer.stir(
stir_time=5.0,
stir_speed=300.0,
settling_time=2.0
)
assert result is True
assert stirrer.operation_mode == "Completed"
@pytest.mark.asyncio
async def test_stir_invalid_speed(self, stirrer):
"""测试无效速度"""
await stirrer.initialize()
# 速度超出范围
result = await stirrer.stir(
stir_time=5.0,
stir_speed=2000.0, # 超过max_speed
settling_time=0.0
)
assert result is False
assert "错误" in stirrer.status
```
### 异步测试配置
```python
# conftest.py
import pytest
import asyncio
@pytest.fixture(scope="session")
def event_loop():
"""创建事件循环"""
loop = asyncio.get_event_loop_policy().new_event_loop()
yield loop
loop.close()
```
## 资源测试
```python
import pytest
from unilabos.resources.resource_tracker import (
ResourceTreeSet,
ResourceTreeInstance,
)
def test_resource_tree_creation():
"""测试资源树创建"""
tree_set = ResourceTreeSet()
# 添加资源
resource = {"id": "res_1", "name": "Resource 1"}
tree_set.add_resource(resource)
# 验证
assert len(tree_set.all_nodes) == 1
assert tree_set.get_resource("res_1") is not None
def test_resource_tree_merge():
"""测试资源树合并"""
local_set = ResourceTreeSet()
remote_set = ResourceTreeSet()
# 设置数据...
local_set.merge_remote_resources(remote_set)
# 验证合并结果...
```
## ROS 消息测试
```python
import pytest
from unilabos.ros.msgs.message_converter import (
convert_to_ros_msg,
convert_from_ros_msg_with_mapping,
msg_converter_manager,
)
def test_message_conversion():
"""测试消息转换"""
# Python -> ROS
python_data = {"id": "test", "value": 42}
ros_msg = convert_to_ros_msg(python_data, MyMsgType)
assert ros_msg.id == "test"
assert ros_msg.value == 42
# ROS -> Python
result = convert_from_ros_msg_with_mapping(ros_msg, mapping)
assert result["id"] == "test"
```
## 协议测试
```python
import pytest
import networkx as nx
from unilabos.compile.stir_protocol import (
generate_stir_protocol,
extract_vessel_id,
)
@pytest.fixture
def topology_graph():
"""创建测试拓扑图"""
G = nx.DiGraph()
G.add_node("flask_1", **{"class": "flask"})
G.add_node("stirrer_1", **{"class": "virtual_stirrer"})
G.add_edge("stirrer_1", "flask_1")
return G
def test_generate_stir_protocol(topology_graph):
"""测试搅拌协议生成"""
actions = generate_stir_protocol(
G=topology_graph,
vessel="flask_1",
time="5 min",
stir_speed=300.0
)
assert len(actions) == 1
assert actions[0]["device_id"] == "stirrer_1"
assert actions[0]["action_name"] == "stir"
def test_extract_vessel_id():
"""测试vessel_id提取"""
# 字典格式
assert extract_vessel_id({"id": "flask_1"}) == "flask_1"
# 字符串格式
assert extract_vessel_id("flask_2") == "flask_2"
# 空值
assert extract_vessel_id("") == ""
```
## 测试标记
```python
# 慢速测试
@pytest.mark.slow
def test_long_running():
pass
# 需要网络
@pytest.mark.network
def test_network_call():
pass
# 需要ROS
@pytest.mark.ros
def test_ros_feature():
pass
```
运行特定标记的测试:
```bash
pytest -m "not slow" # 排除慢速测试
pytest -m ros # 仅ROS测试
```
## 覆盖率
```bash
# 生成覆盖率报告
pytest --cov=unilabos tests/
# HTML报告
pytest --cov=unilabos --cov-report=html tests/
```
## 最佳实践
1. **测试命名**: `test_{功能}_{场景}_{预期结果}`
2. **独立性**: 每个测试独立运行,不依赖其他测试
3. **Mock外部依赖**: 使用 unittest.mock 模拟外部服务
4. **参数化**: 使用 `@pytest.mark.parametrize` 减少重复代码
5. **fixtures**: 使用 fixtures 共享测试设置
6. **断言清晰**: 每个断言只验证一件事

View File

@@ -0,0 +1,353 @@
---
description: Uni-Lab-OS 实验室自动化平台开发规范 - 核心规则
globs: ["**/*.py", "**/*.yaml", "**/*.json"]
---
# Uni-Lab-OS 项目开发规范
## 项目概述
Uni-Lab-OS 是一个实验室自动化操作系统,用于连接和控制各种实验设备,实现实验工作流的自动化和标准化。
## 技术栈
- **Python 3.11** - 核心开发语言
- **ROS 2** - 设备通信中间件 (rclpy)
- **Conda/Mamba** - 包管理 (robostack-staging, conda-forge)
- **FastAPI** - Web API 服务
- **WebSocket** - 实时通信
- **NetworkX** - 拓扑图管理
- **YAML** - 配置和注册表定义
- **PyLabRobot** - 实验室自动化库集成
- **pytest** - 测试框架
- **asyncio** - 异步编程
## 项目结构
```
unilabos/
├── app/ # 应用入口、Web服务、后端
├── compile/ # 协议编译器 (stir, add, filter 等)
├── config/ # 配置管理
├── devices/ # 设备驱动 (真实/虚拟)
├── device_comms/ # 设备通信协议
├── device_mesh/ # 3D网格和可视化
├── registry/ # 设备和资源类型注册表 (YAML)
├── resources/ # 资源定义
├── ros/ # ROS 2 集成
├── utils/ # 工具函数
└── workflow/ # 工作流管理
```
## 代码规范
### Python 风格
1. **类型注解**:所有函数必须使用类型注解
```python
def transfer_liquid(
source: str,
destination: str,
volume: float,
**kwargs
) -> List[Dict[str, Any]]:
```
2. **Docstring**:使用 Google 风格的文档字符串
```python
def initialize(self) -> bool:
"""
初始化设备
Returns:
bool: 初始化是否成功
"""
```
3. **导入顺序**
- 标准库
- 第三方库
- ROS 相关 (rclpy, unilabos_msgs)
- 项目内部模块
### 异步编程
1. 设备操作方法使用 `async def`
2. 使用 `await self._ros_node.sleep()` 而非 `asyncio.sleep()`
3. 长时间运行操作需提供进度反馈
```python
async def stir(self, stir_time: float, stir_speed: float, **kwargs) -> bool:
"""执行搅拌操作"""
start_time = time_module.time()
while True:
elapsed = time_module.time() - start_time
remaining = max(0, stir_time - elapsed)
self.data.update({
"remaining_time": remaining,
"status": f"搅拌中: {stir_speed} RPM"
})
if remaining <= 0:
break
await self._ros_node.sleep(1.0)
return True
```
### 日志规范
使用项目自定义日志系统:
```python
from unilabos.utils.log import logger, info, debug, warning, error, trace
# 在设备类中使用
self.logger = logging.getLogger(f"DeviceName.{self.device_id}")
self.logger.info("设备初始化完成")
```
## 设备驱动开发
### 设备类结构
```python
from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode
class MyDevice:
"""设备驱动类"""
_ros_node: BaseROS2DeviceNode
def __init__(self, device_id: str = None, config: Dict[str, Any] = None, **kwargs):
self.device_id = device_id or "unknown_device"
self.config = config or {}
self.data = {} # 设备状态数据
def post_init(self, ros_node: BaseROS2DeviceNode):
"""ROS节点注入"""
self._ros_node = ros_node
async def initialize(self) -> bool:
"""初始化设备"""
pass
async def cleanup(self) -> bool:
"""清理设备"""
pass
# 状态属性 - 自动发布为 ROS Topic
@property
def status(self) -> str:
return self.data.get("status", "待机")
```
### 状态属性装饰器
```python
from unilabos.utils.decorator import topic_config
class MyDevice:
@property
@topic_config(period=1.0, qos=10) # 每秒发布一次
def temperature(self) -> float:
return self._temperature
```
### 虚拟设备
虚拟设备放置在 `unilabos/devices/virtual/` 目录下,命名为 `virtual_*.py`
## 注册表配置
### 设备注册表 (YAML)
位置: `unilabos/registry/devices/*.yaml`
```yaml
my_device_type:
category:
- my_category
description: "设备描述"
version: "1.0.0"
class:
module: "unilabos.devices.my_device:MyDevice"
type: python
status_types:
status: String
temperature: Float64
action_value_mappings:
auto-initialize:
type: UniLabJsonCommandAsync
goal: {}
feedback: {}
result: {}
schema: {...}
```
### 资源注册表 (YAML)
位置: `unilabos/registry/resources/**/*.yaml`
```yaml
my_container:
category:
- container
class:
module: "unilabos.resources.my_resource:MyContainer"
type: pylabrobot
version: "1.0.0"
```
## 协议编译器
位置: `unilabos/compile/*_protocol.py`
### 协议生成函数模板
```python
from typing import List, Dict, Any, Union
import networkx as nx
def generate_my_protocol(
G: nx.DiGraph,
vessel: Union[str, dict],
param1: float = 0.0,
**kwargs
) -> List[Dict[str, Any]]:
"""
生成操作协议序列
Args:
G: 物理拓扑图
vessel: 容器ID或字典
param1: 参数1
Returns:
List[Dict]: 动作序列
"""
# 提取vessel_id
vessel_id = vessel if isinstance(vessel, str) else vessel.get("id", "")
# 查找设备
device_id = find_connected_device(G, vessel_id)
# 生成动作
action_sequence = [{
"device_id": device_id,
"action_name": "my_action",
"action_kwargs": {
"vessel": {"id": vessel_id},
"param1": float(param1)
}
}]
return action_sequence
```
## 测试规范
### 测试文件位置
- 单元测试: `tests/` 目录
- 设备测试: `tests/devices/`
- 资源测试: `tests/resources/`
- ROS消息测试: `tests/ros/msgs/`
### 测试命名
```python
# tests/devices/my_device/test_my_device.py
import pytest
def test_device_initialization():
"""测试设备初始化"""
pass
def test_device_action():
"""测试设备动作"""
pass
```
## 错误处理
```python
from unilabos.utils.exception import UniLabException
try:
result = await device.execute_action()
except ValueError as e:
self.logger.error(f"参数错误: {e}")
self.data["status"] = "错误: 参数无效"
return False
except Exception as e:
self.logger.error(f"执行失败: {e}")
raise
```
## 配置管理
```python
from unilabos.config.config import BasicConfig, HTTPConfig
# 读取配置
port = BasicConfig.port
is_host = BasicConfig.is_host_mode
# 配置文件: local_config.py
```
## 常用工具
### 单例模式
```python
from unilabos.utils.decorator import singleton
@singleton
class MyManager:
pass
```
### 类型检查
```python
from unilabos.utils.type_check import NoAliasDumper
yaml.dump(data, f, Dumper=NoAliasDumper)
```
### 导入管理
```python
from unilabos.utils.import_manager import get_class
device_class = get_class("unilabos.devices.my_device:MyDevice")
```
## Git 提交规范
提交信息格式:
```
<type>(<scope>): <subject>
<body>
```
类型:
- `feat`: 新功能
- `fix`: 修复bug
- `docs`: 文档更新
- `refactor`: 重构
- `test`: 测试相关
- `chore`: 构建/工具相关
示例:
```
feat(devices): 添加虚拟搅拌器设备
- 实现VirtualStirrer类
- 支持定时搅拌和持续搅拌模式
- 添加速度验证逻辑
```

View File

@@ -0,0 +1,24 @@
---
name: add-device
description: Guide for adding new devices to Uni-Lab-OS (接入新设备). Walks through device category selection (thing model), communication protocol, command protocol collection, driver creation, registry YAML, and graph file setup. Use when the user wants to add/integrate a new device, create a device driver, write a device class, configure device registry, or mentions 接入设备/添加设备/设备驱动/物模型.
---
# 添加新设备到 Uni-Lab-OS
**第一步:** 使用 Read 工具读取 `docs/ai_guides/add_device.md`,获取完整的设备接入指南并严格遵循。
该指南包含:
- 8 步完整流程(设备类别、通信协议、指令收集、接口对齐、驱动创建、注册表、图文件、验证)
- 所有物模型代码模板(注射泵、电磁阀、蠕动泵、温控、电机等)
- 通信协议代码片段Serial、Modbus、TCP、HTTP、OPC UA
- 现有设备接口快照用于第四步对齐包含参数名、status_types、方法签名
- 常见错误检查清单
**Cursor 工具映射:**
| 指南中的操作 | Cursor 中使用的工具 |
|---|---|
| 向用户确认设备类别、协议等信息 | 使用 AskQuestion 工具 |
| 搜索已有设备注册表 | 使用 Grep 在 `unilabos/registry/devices/` 中搜索 |
| 读取用户提供的协议文档/SDK 代码 | 使用 Read 工具 |
| 第四步对齐:查找同类设备接口 | 优先使用 Grep 搜索仓库中的最新注册表;指南中的「现有设备接口快照」作为兜底参考 |

View File

@@ -0,0 +1,323 @@
---
name: add-protocol
description: Guide for adding new experiment protocols to Uni-Lab-OS (添加新实验操作协议). Walks through ROS Action definition, Pydantic model creation, protocol generator implementation, and registration. Use when the user wants to add a new protocol, create a compile function, implement an experiment operation, or mentions 协议/protocol/编译/compile/实验操作.
---
# 添加新实验操作协议Protocol
Protocol 是对实验有意义的完整动作(如泵转移、过滤、溶解),需要多设备协同。`compile/` 中的生成函数根据设备连接图将抽象操作"编译"为设备指令序列。
添加一个 Protocol 需修改 **6 个文件**,按以下流程执行。
---
## 第一步:确认协议信息
向用户确认:
| 信息 | 示例 |
|------|------|
| 协议英文名 | `MyNewProtocol` |
| 操作描述 | 将固体样品研磨至目标粒径 |
| Goal 参数(必需 + 可选) | `vessel: dict`, `time: float = 300.0` |
| Result 字段 | `success: bool`, `message: str` |
| 需要哪些设备协同 | 研磨器、搅拌器 |
---
## 第二步:创建 ROS Action 定义
路径:`unilabos_msgs/action/<ActionName>.action`
三段式结构Goal / Result / Feedback`---` 分隔:
```
# Goal
Resource vessel
float64 time
string mode
---
# Result
bool success
string return_info
---
# Feedback
string status
string current_device
builtin_interfaces/Duration time_spent
builtin_interfaces/Duration time_remaining
```
**类型映射:**
| Python 类型 | ROS 类型 | 说明 |
|------------|----------|------|
| `dict` | `Resource` | 容器/设备引用,自定义消息类型 |
| `float` | `float64` | |
| `int` | `int32` | |
| `str` | `string` | |
| `bool` | `bool` | |
> `Resource` 是 `unilabos_msgs/msg/Resource.msg` 中定义的自定义消息类型。
---
## 第三步:注册 Action 到 CMakeLists
`unilabos_msgs/CMakeLists.txt``set(action_files ...)` 块中添加:
```cmake
"action/MyNewAction.action"
```
> 调试时需编译:`cd unilabos_msgs && colcon build && source ./install/local_setup.sh && cd ..`
> PR 合并后 CI/CD 自动发布,`mamba update ros-humble-unilabos-msgs` 即可。
---
## 第四步:创建 Pydantic 模型
`unilabos/messages/__init__.py` 中添加(位于 `# Start Protocols``# End Protocols` 之间):
```python
class MyNewProtocol(BaseModel):
# === 必需参数 ===
vessel: dict = Field(..., description="目标容器")
# === 可选参数 ===
time: float = Field(300.0, description="操作时间 (秒)")
mode: str = Field("default", description="操作模式")
def model_post_init(self, __context):
"""参数验证和修正"""
if self.time <= 0:
self.time = 300.0
```
**规则:**
- 参数名必须与 `.action` 文件中 Goal 字段完全一致
- `dict` 类型对应 `.action` 中的 `Resource`
- 将类名加入文件末尾的 `__all__` 列表
---
## 第五步:实现协议生成函数
路径:`unilabos/compile/<protocol_name>_protocol.py`
```python
import networkx as nx
from typing import List, Dict, Any
def generate_my_new_protocol(
G: nx.DiGraph,
vessel: dict,
time: float = 300.0,
mode: str = "default",
**kwargs,
) -> List[Dict[str, Any]]:
"""将 MyNewProtocol 编译为设备动作序列。
Args:
G: 设备连接图NetworkX节点为设备/容器,边为物理连接
vessel: 目标容器 {"id": "reactor_1"}
time: 操作时间(秒)
mode: 操作模式
Returns:
动作列表,每个元素为:
- dict: 单步动作
- list[dict]: 并行动作
"""
from unilabos.compile.utils.vessel_parser import get_vessel
vessel_id, vessel_data = get_vessel(vessel)
actions = []
# 查找相关设备(通过图的连接关系)
# 生成动作序列
actions.append({
"device_id": "target_device_id",
"action_name": "some_action",
"action_kwargs": {"param": "value"}
})
# 等待
actions.append({
"action_name": "wait",
"action_kwargs": {"time": time}
})
return actions
```
### 动作字典格式
```python
# 单步动作(发给子设备)
{"device_id": "pump_1", "action_name": "set_position", "action_kwargs": {"position": 10.0}}
# 发给工作站自身
{"device_id": "self", "action_name": "my_action", "action_kwargs": {...}}
# 等待
{"action_name": "wait", "action_kwargs": {"time": 5.0}}
# 并行动作(列表嵌套)
[
{"device_id": "pump_1", "action_name": "set_position", "action_kwargs": {"position": 10.0}},
{"device_id": "stirrer_1", "action_name": "start_stir", "action_kwargs": {"stir_speed": 300}}
]
```
### 关于 `vessel` 参数类型
现有协议的 `vessel` 参数类型不统一:
- 新协议趋势:使用 `dict`(如 `{"id": "reactor_1"}`
- 旧协议:使用 `str`(如 `"reactor_1"`
- 兼容写法:`Union[str, dict]`
**建议新协议统一使用 `dict` 类型**,通过 `get_vessel()` 兼容两种输入。
### 公共工具函数(`unilabos/compile/utils/`
| 函数 | 用途 |
|------|------|
| `get_vessel(vessel)` | 解析容器参数为 `(vessel_id, vessel_data)`,兼容 dict 和 str |
| `find_solvent_vessel(G, solvent)` | 根据溶剂名查找容器(精确→命名规则→模糊→液体类型) |
| `find_reagent_vessel(G, reagent)` | 根据试剂名查找容器(支持固体和液体) |
| `find_connected_stirrer(G, vessel)` | 查找与容器相连的搅拌器 |
| `find_solid_dispenser(G)` | 查找固体加样器 |
### 协议内专属查找函数
许多协议在自己的文件内定义了专属的 `find_*` 函数(不在 `utils/` 中)。编写新协议时,优先复用 `utils/` 中的公共函数;如需特殊查找逻辑,在协议文件内部定义即可:
```python
def find_my_special_device(G: nx.DiGraph, vessel: str) -> str:
"""查找与容器相关的特殊设备"""
for node in G.nodes():
if 'my_device_type' in G.nodes[node].get('class', '').lower():
return node
raise ValueError("未找到特殊设备")
```
### 复用已有协议
复杂协议通常组合已有协议:
```python
from unilabos.compile.pump_protocol import generate_pump_protocol_with_rinsing
actions.extend(generate_pump_protocol_with_rinsing(
G, from_vessel=solvent_vessel, to_vessel=vessel, volume=volume
))
```
### 图查询模式
```python
# 查找与容器相连的特定类型设备
for neighbor in G.neighbors(vessel_id):
node_data = G.nodes[neighbor]
if "heater" in node_data.get("class", ""):
heater_id = neighbor
break
# 查找最短路径(泵转移)
path = nx.shortest_path(G, source=from_vessel_id, target=to_vessel_id)
```
---
## 第六步:注册协议生成函数
`unilabos/compile/__init__.py` 中:
1. 顶部添加导入:
```python
from .my_new_protocol import generate_my_new_protocol
```
2.`action_protocol_generators` 字典中添加映射:
```python
action_protocol_generators = {
# ... 已有协议
MyNewProtocol: generate_my_new_protocol,
}
```
---
## 第七步:配置图文件
在工作站的图文件中,将协议名加入 `protocol_type`
```json
{
"id": "my_station",
"class": "workstation",
"config": {
"protocol_type": ["PumpTransferProtocol", "MyNewProtocol"]
}
}
```
---
## 第八步:验证
```bash
# 1. 模块可导入
python -c "from unilabos.messages import MyNewProtocol; print(MyNewProtocol.model_fields)"
# 2. 生成函数可导入
python -c "from unilabos.compile import action_protocol_generators; print(list(action_protocol_generators.keys()))"
# 3. 启动测试(可选)
unilab -g <graph>.json --complete_registry
```
---
## 工作流清单
```
协议接入进度:
- [ ] 1. 确认协议名、参数、涉及设备
- [ ] 2. 创建 .action 文件 (unilabos_msgs/action/<Name>.action)
- [ ] 3. 注册到 CMakeLists.txt
- [ ] 4. 创建 Pydantic 模型 (unilabos/messages/__init__.py) + 更新 __all__
- [ ] 5. 实现生成函数 (unilabos/compile/<name>_protocol.py)
- [ ] 6. 注册到 compile/__init__.py
- [ ] 7. 配置图文件 protocol_type
- [ ] 8. 验证
```
---
## 高级模式
实现复杂协议时,详见 [reference.md](reference.md)协议运行时数据流、mock graph 测试模式、单位解析工具(`unit_parser.py`)、复杂协议组合模式(以 dissolve 为例)。
---
## 现有协议速查
| 协议 | Pydantic 类 | 生成函数 | 核心参数 |
|------|-------------|---------|---------|
| 泵转移 | `PumpTransferProtocol` | `generate_pump_protocol_with_rinsing` | `from_vessel, to_vessel, volume` |
| 简单转移 | `TransferProtocol` | `generate_pump_protocol` | `from_vessel, to_vessel, volume` |
| 加样 | `AddProtocol` | `generate_add_protocol` | `vessel, reagent, volume` |
| 过滤 | `FilterProtocol` | `generate_filter_protocol` | `vessel, filtrate_vessel` |
| 溶解 | `DissolveProtocol` | `generate_dissolve_protocol` | `vessel, solvent, volume` |
| 加热/冷却 | `HeatChillProtocol` | `generate_heat_chill_protocol` | `vessel, temp, time` |
| 搅拌 | `StirProtocol` | `generate_stir_protocol` | `vessel, time` |
| 分离 | `SeparateProtocol` | `generate_separate_protocol` | `from_vessel, separation_vessel, solvent` |
| 蒸发 | `EvaporateProtocol` | `generate_evaporate_protocol` | `vessel, pressure, temp, time` |
| 清洗 | `CleanProtocol` | `generate_clean_protocol` | `vessel, solvent, volume` |
| 离心 | `CentrifugeProtocol` | `generate_centrifuge_protocol` | `vessel, speed, time` |
| 抽气充气 | `EvacuateAndRefillProtocol` | `generate_evacuateandrefill_protocol` | `vessel, gas` |

View File

@@ -0,0 +1,207 @@
# 协议高级参考
本文件是 SKILL.md 的补充包含协议运行时数据流、测试模式、单位解析工具和复杂协议组合模式。Agent 在需要实现这些功能时按需阅读。
---
## 1. 协议运行时数据流
从图文件到协议执行的完整链路:
```
实验图 JSON
↓ graphio.read_node_link_json()
physical_setup_graph (NetworkX DiGraph)
↓ ROS2WorkstationNode._setup_protocol_names(protocol_type)
为每个 protocol_name 创建 ActionServer
↓ 收到 Action Goal
_create_protocol_execute_callback()
↓ convert_from_ros_msg_with_mapping(goal, mapping)
protocol_kwargs (Python dict)
↓ 向 Host 查询 Resource 类型参数的当前状态
protocol_kwargs 更新vessel 带上 children、data 等)
↓ protocol_steps_generator(G=physical_setup_graph, **protocol_kwargs)
List[Dict] 动作序列
↓ 逐步 execute_single_action / 并行 create_task
子设备 ActionClient 执行
```
### `_setup_protocol_names` 核心逻辑
```python
def _setup_protocol_names(self, protocol_type):
if isinstance(protocol_type, str):
self.protocol_names = [p.strip() for p in protocol_type.split(",")]
else:
self.protocol_names = protocol_type
self.protocol_action_mappings = {}
for protocol_name in self.protocol_names:
protocol_type = globals()[protocol_name] # 从 messages 模块取 Pydantic 类
self.protocol_action_mappings[protocol_name] = get_action_type(protocol_type)
```
### `_create_protocol_execute_callback` 关键步骤
1. `convert_from_ros_msg_with_mapping(goal, action_value_mapping["goal"])` — ROS Goal → Python dict
2.`Resource` 类型字段,通过 `resource_get` Service 查询 Host 的最新资源状态
3. `protocol_steps_generator(G=physical_setup_graph, **protocol_kwargs)` — 调用编译函数
4. 遍历 steps`dict` 串行执行,`list` 并行执行
5. `execute_single_action` 通过 `_action_clients[device_id]` 向子设备发送 Action Goal
6. 执行完毕后通过 `resource_update` Service 更新资源状态
---
## 2. 测试模式
### 2.1 协议文件内测试函数
许多协议文件末尾有 `test_*` 函数,主要测试参数解析工具:
```python
def test_dissolve_protocol():
"""测试溶解协议的各种参数解析"""
volumes = ["10 mL", "?", 10.0, "1 L", "500 μL"]
for vol in volumes:
result = parse_volume_input(vol)
print(f"体积解析: {vol}{result}mL")
masses = ["2.9 g", "?", 2.5, "500 mg"]
for mass in masses:
result = parse_mass_input(mass)
print(f"质量解析: {mass}{result}g")
```
### 2.2 使用 mock graph 测试协议生成器
推荐的端到端测试模式:
```python
import pytest
import networkx as nx
from unilabos.compile.stir_protocol import generate_stir_protocol
@pytest.fixture
def topology_graph():
"""创建测试拓扑图"""
G = nx.DiGraph()
G.add_node("flask_1", **{"class": "flask", "type": "container"})
G.add_node("stirrer_1", **{"class": "virtual_stirrer", "type": "device"})
G.add_edge("stirrer_1", "flask_1")
return G
def test_generate_stir_protocol(topology_graph):
"""测试搅拌协议生成"""
actions = generate_stir_protocol(
G=topology_graph,
vessel="flask_1",
time="5 min",
stir_speed=300.0
)
assert len(actions) >= 1
assert actions[0]["device_id"] == "stirrer_1"
```
**要点:**
-`nx.DiGraph()` 构建最小拓扑
- `add_node(id, **attrs)` 设置 `class``type``data`
- `add_edge(src, dst)` 建立物理连接
- 协议内的 `find_*` 函数依赖这些节点和边
---
## 3. 单位解析工具
路径:`unilabos/compile/utils/unit_parser.py`
| 函数 | 输入 | 返回 | 默认值 |
|------|------|------|--------|
| `parse_volume_input(input, default_unit)` | `"100 mL"`, `"2.5 L"`, `"500 μL"`, `10.0`, `"?"` | mL (float) | 50.0 |
| `parse_mass_input(input)` | `"19.3 g"`, `"500 mg"`, `2.5`, `"?"` | g (float) | 1.0 |
| `parse_time_input(input)` | `"30 min"`, `"1 h"`, `"300"`, `60.0`, `"?"` | 秒 (float) | 60.0 |
支持的单位:
- **体积**: mL, L, μL/uL, milliliter, liter, microliter
- **质量**: g, mg, kg, gram, milligram, kilogram
- **时间**: s/sec/second, min/minute, h/hr/hour, d/day
特殊值 `"?"``"unknown"``"tbd"` 返回默认值。
---
## 4. 复杂协议组合模式
`dissolve_protocol` 为例,展示如何组合多个子操作:
### 整体流程
```
1. 解析参数 (parse_volume_input, parse_mass_input, parse_time_input)
2. 设备发现 (find_connected_heatchill, find_connected_stirrer, find_solid_dispenser)
3. 判断溶解类型 (液体 vs 固体)
4. 组合动作序列:
a. heat_chill_start / start_stir (启动加热/搅拌)
b. wait (等待温度稳定)
c. pump_protocol_with_rinsing (液体转移, 通过 extend 拼接)
或 add_solid (固体加样)
d. heat_chill / stir / wait (溶解等待)
e. heat_chill_stop (停止加热)
```
### 关键代码模式
**设备发现 → 条件组合:**
```python
heatchill_id = find_connected_heatchill(G, vessel_id)
stirrer_id = find_connected_stirrer(G, vessel_id)
solid_dispenser_id = find_solid_dispenser(G)
actions = []
# 启动阶段
if heatchill_id and temp > 25.0:
actions.append({
"device_id": heatchill_id,
"action_name": "heat_chill_start",
"action_kwargs": {"vessel": {"id": vessel_id}, "temp": temp}
})
actions.append({"action_name": "wait", "action_kwargs": {"time": 30}})
elif stirrer_id:
actions.append({
"device_id": stirrer_id,
"action_name": "start_stir",
"action_kwargs": {"vessel": {"id": vessel_id}, "stir_speed": stir_speed}
})
# 转移阶段(复用已有协议)
pump_actions = generate_pump_protocol_with_rinsing(
G=G, from_vessel=solvent_vessel, to_vessel=vessel_id, volume=volume
)
actions.extend(pump_actions)
# 等待阶段
if heatchill_id:
actions.append({
"device_id": heatchill_id,
"action_name": "heat_chill",
"action_kwargs": {"vessel": {"id": vessel_id}, "temp": temp, "time": time}
})
else:
actions.append({"action_name": "wait", "action_kwargs": {"time": time}})
```
---
## 5. 关键路径
| 内容 | 路径 |
|------|------|
| 协议执行回调 | `unilabos/ros/nodes/presets/workstation.py` |
| ROS 消息映射 | `unilabos/ros/msgs/message_converter.py` |
| 物理拓扑图 | `unilabos/resources/graphio.py` (`physical_setup_graph`) |
| 单位解析 | `unilabos/compile/utils/unit_parser.py` |
| 容器解析 | `unilabos/compile/utils/vessel_parser.py` |
| 溶解协议(组合示例) | `unilabos/compile/dissolve_protocol.py` |

View File

@@ -0,0 +1,371 @@
---
name: add-resource
description: Guide for adding new resources (materials, bottles, carriers, decks, warehouses) to Uni-Lab-OS (添加新物料/资源). Covers Bottle, Carrier, Deck, WareHouse definitions and registry YAML. Use when the user wants to add resources, define materials, create a deck layout, add bottles/carriers/plates, or mentions 物料/资源/resource/bottle/carrier/deck/plate/warehouse.
---
# 添加新物料资源
Uni-Lab-OS 的资源体系基于 PyLabRobot通过扩展实现 Bottle、Carrier、WareHouse、Deck 等实验室物料管理。
---
## 第一步:确认资源类型
向用户确认需要添加的资源类型:
| 类型 | 基类 | 用途 | 示例 |
|------|------|------|------|
| **Bottle** | `Well` (PyLabRobot) | 单个容器(瓶、小瓶、烧杯、反应器) | 试剂瓶、粉末瓶 |
| **BottleCarrier** | `ItemizedCarrier` | 多槽位载架(放多个 Bottle | 6 位试剂架、枪头盒 |
| **WareHouse** | `ItemizedCarrier` | 堆栈/仓库(放多个 Carrier | 4x4 堆栈 |
| **Deck** | `Deck` (PyLabRobot) | 工作站台面(放多个 WareHouse | 反应站 Deck |
**层级关系:** `Deck``WareHouse``BottleCarrier``Bottle`
还需确认:
- 资源所属的项目/场景(如 bioyond、battery、通用
- 尺寸参数(直径、高度、最大容积等)
- 布局参数(行列数、间距等)
---
## 第二步:创建资源定义
### 文件位置
```
unilabos/resources/
├── <project>/ # 按项目分组
│ ├── bottles.py # Bottle 工厂函数
│ ├── bottle_carriers.py # Carrier 工厂函数
│ ├── warehouses.py # WareHouse 工厂函数
│ └── decks.py # Deck 类定义
├── itemized_carrier.py # Bottle, BottleCarrier, ItemizedCarrier 基类
├── warehouse.py # WareHouse 基类
└── container.py # 通用容器
```
### 2A. 添加 Bottle工厂函数
```python
from unilabos.resources.itemized_carrier import Bottle
def My_Reagent_Bottle(
name: str,
diameter: float = 70.0, # 瓶体直径 (mm)
height: float = 120.0, # 瓶体高度 (mm)
max_volume: float = 500000.0, # 最大容积 (μL)
barcode: str = None,
) -> Bottle:
"""创建试剂瓶"""
return Bottle(
name=name,
diameter=diameter,
height=height,
max_volume=max_volume,
barcode=barcode,
model="My_Reagent_Bottle", # 唯一标识,用于注册表和物料映射
)
```
**Bottle 参数:**
- `name`: 实例名称(运行时唯一)
- `diameter`: 瓶体直径 (mm)
- `height`: 瓶体高度 (mm)
- `max_volume`: 最大容积 (**μL**注意单位500mL = 500000)
- `barcode`: 条形码(可选)
- `model`: 模型标识,与注册表 key 一致
### 2B. 添加 BottleCarrier工厂函数
```python
from pylabrobot.resources import ResourceHolder
from pylabrobot.resources.carrier import create_ordered_items_2d
from unilabos.resources.itemized_carrier import BottleCarrier
def My_6SlotCarrier(name: str) -> BottleCarrier:
"""创建 3x2 六槽位载架"""
sites = create_ordered_items_2d(
klass=ResourceHolder,
num_items_x=3, # 列数
num_items_y=2, # 行数
dx=10.0, # X 起始偏移
dy=10.0, # Y 起始偏移
dz=5.0, # Z 偏移
item_dx=42.0, # X 间距
item_dy=35.0, # Y 间距
size_x=20.0, # 槽位宽
size_y=20.0, # 槽位深
size_z=50.0, # 槽位高
)
carrier = BottleCarrier(
name=name,
size_x=146.0, # 载架总宽
size_y=80.0, # 载架总深
size_z=55.0, # 载架总高
sites=sites,
model="My_6SlotCarrier",
)
carrier.num_items_x = 3
carrier.num_items_y = 2
carrier.num_items_z = 1
# 预装 Bottle可选
ordering = ["A01", "A02", "A03", "B01", "B02", "B03"]
for i in range(6):
carrier[i] = My_Reagent_Bottle(f"{ordering[i]}")
return carrier
```
### 2C. 添加 WareHouse工厂函数
```python
from unilabos.resources.warehouse import warehouse_factory
def my_warehouse_4x4(name: str) -> "WareHouse":
"""创建 4行x4列 堆栈仓库"""
return warehouse_factory(
name=name,
num_items_x=4, # 列数
num_items_y=4, # 行数
num_items_z=1, # 层数(通常为 1
dx=137.0, # X 起始偏移
dy=96.0, # Y 起始偏移
dz=120.0, # Z 起始偏移
item_dx=137.0, # X 间距
item_dy=125.0, # Y 间距
item_dz=10.0, # Z 间距(多层时用)
resource_size_x=127.0, # 槽位宽
resource_size_y=85.0, # 槽位深
resource_size_z=100.0, # 槽位高
model="my_warehouse_4x4",
)
```
**`warehouse_factory` 参数说明:**
| 参数 | 说明 |
|------|------|
| `num_items_x/y/z` | 列数/行数/层数 |
| `dx, dy, dz` | 第一个槽位的起始坐标偏移 |
| `item_dx, item_dy, item_dz` | 相邻槽位间距 |
| `resource_size_x/y/z` | 单个槽位的物理尺寸 |
| `col_offset` | 列命名偏移(如设 4 则从 A05 开始) |
| `row_offset` | 行命名偏移(如设 5 则从 F 行开始) |
| `layout` | 排序方式:`"col-major"`(列优先,默认)/ `"row-major"`(行优先) |
| `removed_positions` | 要移除的位置索引列表 |
自动生成 `ResourceHolder` 槽位,命名规则为 `A01, B01, C01, D01, A02, ...`(列优先)或 `A01, A02, A03, A04, B01, ...`(行优先)。
### 2D. 添加 Deck类定义
```python
from pylabrobot.resources import Deck, Coordinate
class MyStation_Deck(Deck):
def __init__(
self,
name: str = "MyStation_Deck",
size_x: float = 2700.0,
size_y: float = 1080.0,
size_z: float = 1500.0,
category: str = "deck",
setup: bool = False,
) -> None:
super().__init__(name=name, size_x=size_x, size_y=size_y, size_z=size_z)
if setup:
self.setup()
def setup(self) -> None:
self.warehouses = {
"仓库A": my_warehouse_4x4("仓库A"),
"仓库B": my_warehouse_4x4("仓库B"),
}
self.warehouse_locations = {
"仓库A": Coordinate(-200.0, 400.0, 0.0),
"仓库B": Coordinate(2350.0, 400.0, 0.0),
}
for wh_name, wh in self.warehouses.items():
self.assign_child_resource(wh, location=self.warehouse_locations[wh_name])
```
**Deck 要点:**
- 继承 `pylabrobot.resources.Deck`
- `setup()` 创建 WareHouse 并通过 `assign_child_resource` 放置到指定坐标
- `setup` 参数控制是否在构造时自动调用 `setup()`(图文件中通过 `config.setup: true` 触发)
---
## 第三步:创建注册表 YAML
路径:`unilabos/registry/resources/<project>/<type>.yaml`
### Bottle 注册
```yaml
My_Reagent_Bottle:
category:
- bottles
class:
module: unilabos.resources.my_project.bottles:My_Reagent_Bottle
type: pylabrobot
description: 我的试剂瓶
handles: []
icon: ''
init_param_schema: {}
version: 1.0.0
```
### Carrier 注册
```yaml
My_6SlotCarrier:
category:
- bottle_carriers
class:
module: unilabos.resources.my_project.bottle_carriers:My_6SlotCarrier
type: pylabrobot
handles: []
icon: ''
init_param_schema: {}
version: 1.0.0
```
### Deck 注册
```yaml
MyStation_Deck:
category:
- deck
class:
module: unilabos.resources.my_project.decks:MyStation_Deck
type: pylabrobot
description: 我的工作站 Deck
handles: []
icon: ''
init_param_schema: {}
registry_type: resource
version: 1.0.0
```
**注册表规则:**
- `class.module` 格式为 `python.module.path:ClassName_or_FunctionName`
- `class.type` 固定为 `pylabrobot`
- Key`My_Reagent_Bottle`)必须与工厂函数名 / 类名一致
- `category` 按类型标注(`bottles`, `bottle_carriers`, `deck` 等)
---
## 第四步:在图文件中引用
### Deck 在工作站中的引用
工作站节点通过 `deck` 字段引用Deck 作为子节点:
```json
{
"id": "my_station",
"children": ["my_deck"],
"deck": {
"data": {
"_resource_child_name": "my_deck",
"_resource_type": "unilabos.resources.my_project.decks:MyStation_Deck"
}
}
},
{
"id": "my_deck",
"parent": "my_station",
"type": "deck",
"class": "MyStation_Deck",
"config": {"type": "MyStation_Deck", "setup": true}
}
```
### 物料类型映射(外部系统对接时)
如果工作站需要与外部系统同步物料,在 config 中配置 `material_type_mappings`
```json
"material_type_mappings": {
"My_Reagent_Bottle": ["试剂瓶", "external-type-uuid"],
"My_6SlotCarrier": ["六槽载架", "external-type-uuid"]
}
```
---
## 第五步:注册 PLR 扩展(如需要)
如果添加了新的 Deck 类,需要在 `unilabos/resources/plr_additional_res_reg.py` 中导入,使 `find_subclass` 能发现它:
```python
def register():
from unilabos.resources.my_project.decks import MyStation_Deck
```
---
## 第六步:验证
```bash
# 1. 资源可导入
python -c "from unilabos.resources.my_project.bottles import My_Reagent_Bottle; print(My_Reagent_Bottle('test'))"
# 2. Deck 可创建
python -c "
from unilabos.resources.my_project.decks import MyStation_Deck
d = MyStation_Deck('test', setup=True)
print(d.children)
"
# 3. 启动测试
unilab -g <graph>.json --complete_registry
```
---
## 工作流清单
```
资源接入进度:
- [ ] 1. 确定资源类型Bottle / Carrier / WareHouse / Deck
- [ ] 2. 创建资源定义(工厂函数/类)
- [ ] 3. 创建注册表 YAML (unilabos/registry/resources/<project>/<type>.yaml)
- [ ] 4. 在图文件中引用(如需要)
- [ ] 5. 注册 PLR 扩展Deck 类需要)
- [ ] 6. 验证
```
---
## 高级模式
实现复杂资源系统时,详见 [reference.md](reference.md):类继承体系完整图、序列化/反序列化流程、Bioyond 物料双向同步、非瓶类资源ElectrodeSheet / Magazine、仓库工厂 layout 模式。
---
## 现有资源参考
| 项目 | Bottles | Carriers | WareHouses | Decks |
|------|---------|----------|------------|-------|
| bioyond | `bioyond/bottles.py` | `bioyond/bottle_carriers.py` | `bioyond/warehouses.py`, `YB_warehouses.py` | `bioyond/decks.py` |
| battery | — | `battery/bottle_carriers.py` | — | — |
| 通用 | — | — | `warehouse.py` | — |
### 关键路径
| 内容 | 路径 |
|------|------|
| Bottle/Carrier 基类 | `unilabos/resources/itemized_carrier.py` |
| WareHouse 基类 + 工厂 | `unilabos/resources/warehouse.py` |
| PLR 注册 | `unilabos/resources/plr_additional_res_reg.py` |
| 资源注册表 | `unilabos/registry/resources/` |
| 图文件加载 | `unilabos/resources/graphio.py` |
| 资源跟踪器 | `unilabos/resources/resource_tracker.py` |

View File

@@ -0,0 +1,292 @@
# 资源高级参考
本文件是 SKILL.md 的补充,包含类继承体系、序列化/反序列化、Bioyond 物料同步、非瓶类资源和仓库工厂模式。Agent 在需要实现这些功能时按需阅读。
---
## 1. 类继承体系
```
PyLabRobot
├── Resource (PLR 基类)
│ ├── Well
│ │ └── Bottle (unilabos) → 瓶/小瓶/烧杯/反应器
│ ├── Deck
│ │ └── 自定义 Deck 类 (unilabos) → 工作站台面
│ ├── ResourceHolder → 槽位占位符
│ └── Container
│ └── Battery (unilabos) → 组装好的电池
├── ItemizedCarrier (unilabos, 继承 Resource)
│ ├── BottleCarrier (unilabos) → 瓶载架
│ └── WareHouse (unilabos) → 堆栈仓库
├── ItemizedResource (PLR)
│ └── MagazineHolder (unilabos) → 子弹夹载架
└── ResourceStack (PLR)
└── Magazine (unilabos) → 子弹夹洞位
```
### Bottle 类细节
```python
class Bottle(Well):
def __init__(self, name, diameter, height, max_volume,
size_x=0.0, size_y=0.0, size_z=0.0,
barcode=None, category="container", model=None, **kwargs):
super().__init__(
name=name,
size_x=diameter, # PLR 用 diameter 作为 size_x/size_y
size_y=diameter,
size_z=height, # PLR 用 height 作为 size_z
max_volume=max_volume,
category=category,
model=model,
bottom_type="flat",
cross_section_type="circle"
)
```
注意 `size_x = size_y = diameter``size_z = height`
### ItemizedCarrier 核心方法
| 方法 | 说明 |
|------|------|
| `__getitem__(identifier)` | 通过索引或 Excel 标识(如 `"A01"`)访问槽位 |
| `__setitem__(identifier, resource)` | 向槽位放入资源 |
| `get_child_identifier(child)` | 获取子资源的标识符 |
| `capacity` | 总槽位数 |
| `sites` | 所有槽位字典 |
---
## 2. 序列化与反序列化
### PLR ↔ UniLab 转换
| 函数 | 位置 | 方向 |
|------|------|------|
| `ResourceTreeSet.from_plr_resources(resources)` | `resource_tracker.py` | PLR → UniLab |
| `ResourceTreeSet.to_plr_resources()` | `resource_tracker.py` | UniLab → PLR |
### `from_plr_resources` 流程
```
PLR Resource
↓ build_uuid_mapping (递归生成 UUID)
↓ resource.serialize() → dict
↓ resource.serialize_all_state() → states
↓ resource_plr_inner (递归构建 ResourceDictInstance)
ResourceTreeSet
```
关键:每个 PLR 资源通过 `unilabos_uuid` 属性携带 UUID`unilabos_extra` 携带扩展数据(如 `class` 名)。
### `to_plr_resources` 流程
```
ResourceTreeSet
↓ collect_node_data (收集 UUID、状态、扩展数据)
↓ node_to_plr_dict (转为 PLR 字典格式)
↓ find_subclass(type_name, PLRResource) (查找 PLR 子类)
↓ sub_cls.deserialize(plr_dict) (反序列化)
↓ loop_set_uuid, loop_set_extra (递归设置 UUID 和扩展)
PLR Resource
```
### Bottle 序列化
```python
class Bottle(Well):
def serialize(self) -> dict:
data = super().serialize()
return {**data, "diameter": self.diameter, "height": self.height}
@classmethod
def deserialize(cls, data: dict, allow_marshal=False):
barcode_data = data.pop("barcode", None)
instance = super().deserialize(data, allow_marshal=allow_marshal)
if barcode_data and isinstance(barcode_data, str):
instance.barcode = barcode_data
return instance
```
---
## 3. Bioyond 物料同步
### 双向转换函数
| 函数 | 位置 | 方向 |
|------|------|------|
| `resource_bioyond_to_plr(materials, type_mapping, deck)` | `graphio.py` | Bioyond → PLR |
| `resource_plr_to_bioyond(resources, type_mapping, warehouse_mapping)` | `graphio.py` | PLR → Bioyond |
### `resource_bioyond_to_plr` 流程
```
Bioyond 物料列表
↓ reverse_type_mapping: {typeName → (model, UUID)}
↓ 对每个物料:
typeName → 查映射 → model (如 "BIOYOND_PolymerStation_Reactor")
initialize_resource({"name": unique_name, "class": model})
↓ 设置 unilabos_extra (material_bioyond_id, material_bioyond_name 等)
↓ 处理 detail (子物料/坐标)
↓ 按 locationName 放入 deck.warehouses 对应槽位
PLR 资源列表
```
### `resource_plr_to_bioyond` 流程
```
PLR 资源列表
↓ 遍历每个资源:
载架(capacity > 1): 生成 details 子物料 + 坐标
单瓶: 直接映射
↓ type_mapping 查找 typeId
↓ warehouse_mapping 查找位置 UUID
↓ 组装 Bioyond 格式 (name, typeName, typeId, quantity, Parameters, locations)
Bioyond 物料列表
```
### BioyondResourceSynchronizer
工作站通过 `ResourceSynchronizer` 自动同步物料:
```python
class BioyondResourceSynchronizer(ResourceSynchronizer):
def sync_from_external(self) -> bool:
all_data = []
all_data.extend(api_client.stock_material('{"typeMode": 0}')) # 耗材
all_data.extend(api_client.stock_material('{"typeMode": 1}')) # 样品
all_data.extend(api_client.stock_material('{"typeMode": 2}')) # 试剂
unilab_resources = resource_bioyond_to_plr(
all_data,
type_mapping=self.workstation.bioyond_config["material_type_mappings"],
deck=self.workstation.deck
)
# 更新 deck 上的资源
```
---
## 4. 非瓶类资源
### ElectrodeSheet极片
路径:`unilabos/resources/battery/electrode_sheet.py`
```python
class ElectrodeSheet(ResourcePLR):
"""片状材料(极片、隔膜、弹片、垫片等)"""
_unilabos_state = {
"diameter": 0.0,
"thickness": 0.0,
"mass": 0.0,
"material_type": "",
"color": "",
"info": "",
}
```
工厂函数:`PositiveCan`, `PositiveElectrode`, `NegativeCan`, `NegativeElectrode`, `SpringWasher`, `FlatWasher`, `AluminumFoil`
### Battery电池
```python
class Battery(Container):
"""组装好的电池"""
_unilabos_state = {
"color": "",
"electrolyte_name": "",
"open_circuit_voltage": 0.0,
}
```
### Magazine / MagazineHolder子弹夹
```python
class Magazine(ResourceStack):
"""子弹夹洞位,可堆叠 ElectrodeSheet"""
# direction, max_sheets
class MagazineHolder(ItemizedResource):
"""多洞位子弹夹"""
# hole_diameter, hole_depth, max_sheets_per_hole
```
工厂函数 `magazine_factory()``create_homogeneous_resources` 生成洞位,可选预填 `ElectrodeSheet``Battery`
---
## 5. 仓库工厂模式参考
### 实际 warehouse 工厂函数示例
```python
# 行优先 4x4 仓库
def bioyond_warehouse_1x4x4(name: str) -> WareHouse:
return warehouse_factory(
name=name,
num_items_x=4, num_items_y=4, num_items_z=1,
dx=10.0, dy=10.0, dz=10.0,
item_dx=147.0, item_dy=106.0, item_dz=130.0,
layout="row-major", # A01,A02,A03,A04, B01,...
)
# 右侧 4x4 仓库(列名偏移)
def bioyond_warehouse_1x4x4_right(name: str) -> WareHouse:
return warehouse_factory(
name=name,
num_items_x=4, num_items_y=4, num_items_z=1,
dx=10.0, dy=10.0, dz=10.0,
item_dx=147.0, item_dy=106.0, item_dz=130.0,
col_offset=4, # A05,A06,A07,A08
layout="row-major",
)
# 竖向仓库(站内试剂存放)
def bioyond_warehouse_reagent_storage(name: str) -> WareHouse:
return warehouse_factory(
name=name,
num_items_x=1, num_items_y=2, num_items_z=1,
dx=10.0, dy=10.0, dz=10.0,
item_dx=147.0, item_dy=106.0, item_dz=130.0,
layout="vertical-col-major",
)
# 行偏移F 行开始)
def bioyond_warehouse_5x3x1(name: str, row_offset: int = 0) -> WareHouse:
return warehouse_factory(
name=name,
num_items_x=3, num_items_y=5, num_items_z=1,
dx=10.0, dy=10.0, dz=10.0,
item_dx=159.0, item_dy=183.0, item_dz=130.0,
row_offset=row_offset, # 0→A行起5→F行起
layout="row-major",
)
```
### layout 类型说明
| layout | 命名顺序 | 适用场景 |
|--------|---------|---------|
| `col-major` (默认) | A01,B01,C01,D01, A02,B02,... | 列优先,标准堆栈 |
| `row-major` | A01,A02,A03,A04, B01,B02,... | 行优先Bioyond 前端展示 |
| `vertical-col-major` | 竖向排列,标签从底部开始 | 竖向仓库(试剂存放、测密度) |
---
## 6. 关键路径
| 内容 | 路径 |
|------|------|
| Bottle/Carrier 基类 | `unilabos/resources/itemized_carrier.py` |
| WareHouse 类 + 工厂 | `unilabos/resources/warehouse.py` |
| ResourceTreeSet 转换 | `unilabos/resources/resource_tracker.py` |
| Bioyond 物料转换 | `unilabos/resources/graphio.py` |
| Bioyond 仓库定义 | `unilabos/resources/bioyond/warehouses.py` |
| 电池资源 | `unilabos/resources/battery/` |
| PLR 注册 | `unilabos/resources/plr_additional_res_reg.py` |

View File

@@ -0,0 +1,500 @@
---
name: add-workstation
description: Guide for adding new workstations to Uni-Lab-OS (接入新工作站). Walks through workstation type selection, sub-device composition, external system integration, driver creation, registry YAML, deck setup, and graph file configuration. Use when the user wants to add/integrate a new workstation, create a workstation driver, configure a station with sub-devices, set up deck and materials, or mentions 工作站/工站/station/workstation.
---
# Uni-Lab-OS 工作站接入指南
工作站workstation是组合多个子设备的大型设备拥有独立的物料管理系统PLR Deck和工作流引擎。本指南覆盖从需求分析到验证的全流程。
> **前置知识**:工作站接入基于 `docs/ai_guides/add_device.md` 的通用设备接入框架,但有显著差异。阅读本指南前无需先读通用指南。
## 第一步:确定工作站类型
向用户确认以下信息:
**Q1: 工作站的业务场景?**
| 类型 | 基类 | 适用场景 | 示例 |
|------|------|----------|------|
| **Protocol 工作站** | `ProtocolNode` | 标准化学操作协议(过滤、转移、加热等) | FilterProtocolStation |
| **外部系统工作站** | `WorkstationBase` | 与外部 LIMS/MES 系统对接,有专属 API | BioyondStation |
| **硬件控制工作站** | `WorkstationBase` | 直接控制 PLC/硬件,无外部系统 | CoinCellAssembly |
**Q2: 工作站英文名称?**(如 `my_reaction_station`
**Q3: 与外部系统的交互方式?**
| 方式 | 适用场景 | 需要的配置 |
|------|----------|-----------|
| 无外部系统 | Protocol 工作站、纯硬件控制 | 无 |
| HTTP API | LIMS/MES 系统(如 Bioyond | `api_host`, `api_key` |
| Modbus TCP | PLC 控制 | `address`, `port` |
| OPC UA | 工业设备 | `url` |
**Q4: 子设备组成?**
- 列出所有子设备(如反应器、泵、阀、传感器等)
- 哪些是已有设备类型?哪些需要新增?
- 子设备之间的硬件代理关系(如泵通过串口设备通信)
**Q5: 物料管理需求?**
- 是否需要 Deck物料面板
- 物料类型plate、tip_rack、bottle 等)
- 是否需要与外部物料系统同步?
---
## 第二步:理解工作站架构
工作站与普通设备的核心差异:
| 维度 | 普通设备 | 工作站 |
|------|---------|--------|
| 基类 | 无(纯 Python 类) | `WorkstationBase``ProtocolNode` |
| ROS 节点 | `BaseROS2DeviceNode` | `ROS2WorkstationNode` |
| 状态管理 | `self.data` 字典 | 通常不用 `self.data`,用 `@property` 直接访问 |
| 子设备 | 无 | `children` 列表,通过 `self._children` 访问 |
| 物料 | 无 | `self.deck`PLR Deck |
| 图文件角色 | `parent: null``parent: "<station>"` | `parent: null`,含 `children``deck` |
### 继承体系
`WorkstationBase` (ABC) → `ProtocolNode` (通用协议) / `BioyondWorkstation` (→ ReactionStation, DispensingStation) / `CoinCellAssemblyWorkstation` (硬件控制)
### ROS 层
`ROS2WorkstationNode` 额外负责:初始化 children 子设备节点、为子设备创建 ActionClient、配置硬件代理、为 protocol_type 创建协议 ActionServer。
---
## 第三步:创建驱动文件
文件路径:`unilabos/devices/workstation/<station_name>/<station_name>.py`
### 模板 A基于外部系统的工作站
适用于与 LIMS/MES 等外部系统对接的场景。
```python
import logging
from typing import Dict, Any, Optional, List
from pylabrobot.resources import Deck
from unilabos.devices.workstation.workstation_base import WorkstationBase
try:
from unilabos.ros.nodes.presets.workstation import ROS2WorkstationNode
except ImportError:
ROS2WorkstationNode = None
class MyWorkstation(WorkstationBase):
"""工作站描述"""
_ros_node: "ROS2WorkstationNode"
def __init__(
self,
config: dict = None,
deck: Optional[Deck] = None,
protocol_type: list = None,
**kwargs,
):
super().__init__(deck=deck, **kwargs)
self.config = config or {}
self.logger = logging.getLogger(f"MyWorkstation")
# 外部系统连接配置
self.api_host = self.config.get("api_host", "")
self.api_key = self.config.get("api_key", "")
# 工作站业务状态(不同于 self.data 模式)
self._status = "Idle"
def post_init(self, ros_node: "ROS2WorkstationNode") -> None:
super().post_init(ros_node)
# 在这里启动后台服务、连接监控等
# ============ 子设备访问 ============
def _get_child_device(self, device_id: str):
"""通过 ID 获取子设备节点"""
return self._children.get(device_id)
# ============ 动作方法 ============
async def scheduler_start(self, **kwargs) -> Dict[str, Any]:
"""启动调度器"""
return {"success": True}
async def create_order(self, json_str: str, **kwargs) -> Dict[str, Any]:
"""创建工单"""
return {"success": True}
# ============ 属性 ============
@property
def workflow_sequence(self) -> str:
return "[]"
@property
def material_info(self) -> str:
return "{}"
```
### 模板 B基于硬件控制的工作站
适用于直接与 PLC/硬件通信的场景。
```python
import logging
from typing import Dict, Any, Optional
from pylabrobot.resources import Deck
from unilabos.devices.workstation.workstation_base import WorkstationBase
try:
from unilabos.ros.nodes.presets.workstation import ROS2WorkstationNode
except ImportError:
ROS2WorkstationNode = None
class MyHardwareWorkstation(WorkstationBase):
"""硬件控制工作站"""
_ros_node: "ROS2WorkstationNode"
def __init__(
self,
config: dict = None,
deck: Optional[Deck] = None,
address: str = "192.168.1.100",
port: str = "502",
debug_mode: bool = False,
*args,
**kwargs,
):
super().__init__(deck=deck, *args, **kwargs)
self.config = config or {}
self.address = address
self.port = int(port)
self.debug_mode = debug_mode
self.logger = logging.getLogger("MyHardwareWorkstation")
# 初始化通信客户端
if not debug_mode:
from unilabos.device_comms.modbus_plc.client import ModbusTcpClient
self.client = ModbusTcpClient(host=self.address, port=self.port)
else:
self.client = None
def post_init(self, ros_node: "ROS2WorkstationNode") -> None:
super().post_init(ros_node)
# ============ 硬件读写 ============
def _read_register(self, name: str):
"""读取 Modbus 寄存器"""
if self.debug_mode:
return 0
# 实际读取逻辑
pass
# ============ 动作方法 ============
async def start_process(self, **kwargs) -> Dict[str, Any]:
"""启动加工流程"""
return {"success": True}
async def stop_process(self, **kwargs) -> Dict[str, Any]:
"""停止加工流程"""
return {"success": True}
# ============ 属性(从硬件实时读取)============
@property
def sys_status(self) -> str:
return str(self._read_register("SYS_STATUS"))
```
### 模板 CProtocol 工作站
适用于标准化学操作协议的场景,直接使用 `ProtocolNode`
```python
from typing import List, Optional
from pylabrobot.resources import Resource as PLRResource
from unilabos.devices.workstation.workstation_base import ProtocolNode
class MyProtocolStation(ProtocolNode):
"""Protocol 工作站 — 使用标准化学操作协议"""
def __init__(
self,
protocol_type: List[str],
deck: Optional[PLRResource] = None,
*args,
**kwargs,
):
super().__init__(protocol_type=protocol_type, deck=deck, *args, **kwargs)
```
> Protocol 工作站通常不需要自定义驱动类,直接使用 `ProtocolNode` 并在注册表和图文件中配置 `protocol_type` 即可。
---
## 第四步:创建子设备驱动(如需要)
工作站的子设备本身是独立设备。按 `docs/ai_guides/add_device.md` 的标准流程创建。
子设备的关键约束:
- 在图文件中 `parent` 指向工作站 ID
- 图文件中在工作站的 `children` 数组里列出
- 如需硬件代理,在子设备的 `config.hardware_interface.name` 指向通信设备 ID
---
## 第五步:创建注册表 YAML
路径:`unilabos/registry/devices/<station_name>.yaml`
### 最小配置
```yaml
my_workstation:
category:
- workstation
class:
module: unilabos.devices.workstation.my_station.my_station:MyWorkstation
type: python
```
启动时 `--complete_registry` 自动补全 `status_types``action_value_mappings`
### 完整配置参考
```yaml
my_workstation:
description: "我的工作站"
version: "1.0.0"
category:
- workstation
- my_category
class:
module: unilabos.devices.workstation.my_station.my_station:MyWorkstation
type: python
status_types:
workflow_sequence: String
material_info: String
action_value_mappings:
scheduler_start:
type: UniLabJsonCommandAsync
goal: {}
result:
success: success
create_order:
type: UniLabJsonCommandAsync
goal:
json_str: json_str
result:
success: success
init_param_schema:
config:
type: object
deck:
type: object
protocol_type:
type: array
```
### 子设备注册表
子设备有独立的注册表文件,需要在 `category` 中包含工作站标识:
```yaml
my_reactor:
category:
- reactor
- my_workstation
class:
module: unilabos.devices.workstation.my_station.my_reactor:MyReactor
type: python
```
---
## 第六步:配置 Deck 资源(如需要)
如果工作站有物料管理需求,需要定义 Deck 类。
### 使用已有 Deck 类
查看 `unilabos/resources/` 目录下是否有适用的 Deck 类。
### 创建自定义 Deck
`unilabos/resources/<category>/decks.py` 中定义:
```python
from pylabrobot.resources import Deck
from pylabrobot.resources.coordinate import Coordinate
def MyStation_Deck(name: str = "MyStation_Deck") -> Deck:
deck = Deck(name=name, size_x=2700.0, size_y=1080.0, size_z=1500.0)
# 在 deck 上定义子资源位置carrier、plate 等)
return deck
```
`unilabos/resources/<category>/` 下注册或通过注册表引用。
---
## 第七步:配置图文件
图文件路径:`unilabos/test/experiments/<station_name>.json`
### 完整结构
```json
{
"nodes": [
{
"id": "my_station",
"name": "my_station",
"children": ["my_deck", "sub_device_1", "sub_device_2"],
"parent": null,
"type": "device",
"class": "my_workstation",
"position": {"x": 0, "y": 0, "z": 0},
"config": {
"api_host": "http://192.168.1.100:8080",
"api_key": "YOUR_KEY"
},
"deck": {
"data": {
"_resource_child_name": "my_deck",
"_resource_type": "unilabos.resources.my_module.decks:MyStation_Deck"
}
},
"size_x": 2700.0,
"size_y": 1080.0,
"size_z": 1500.0,
"protocol_type": [],
"data": {}
},
{
"id": "my_deck",
"name": "my_deck",
"children": [],
"parent": "my_station",
"type": "deck",
"class": "MyStation_Deck",
"position": {"x": 0, "y": 0, "z": 0},
"config": {
"type": "MyStation_Deck",
"setup": true,
"rotation": {"x": 0, "y": 0, "z": 0, "type": "Rotation"}
},
"data": {}
},
{
"id": "sub_device_1",
"name": "sub_device_1",
"children": [],
"parent": "my_station",
"type": "device",
"class": "sub_device_registry_name",
"position": {"x": 100, "y": 0, "z": 0},
"config": {},
"data": {}
}
]
}
```
### 图文件规则
| 字段 | 说明 |
|------|------|
| `id` | 节点唯一标识,与 `children` 数组中的引用一致 |
| `children` | 包含 deck ID 和所有子设备 ID |
| `parent` | 工作站节点为 `null`;子设备/deck 指向工作站 ID |
| `type` | 工作站和子设备为 `"device"`deck 为 `"deck"` |
| `class` | 对应注册表中的设备名 |
| `deck.data._resource_child_name` | 必须与 deck 节点的 `id` 一致 |
| `deck.data._resource_type` | Deck 工厂函数的完整 Python 路径 |
| `protocol_type` | Protocol 工作站填入协议名列表;否则为 `[]` |
| `config` | 传入驱动 `__init__``config` 参数 |
---
## 第八步:验证
```bash
# 1. 模块可导入
python -c "from unilabos.devices.workstation.<name>.<name> import <ClassName>"
# 2. 注册表补全
unilab -g <graph>.json --complete_registry
# 3. 启动测试
unilab -g <graph>.json
```
---
## 高级模式
实现外部系统对接型工作站时,详见 [reference.md](reference.md)RPC 客户端、HTTP 回调服务、连接监控、Config 结构模式material_type_mappings / warehouse_mapping / workflow_mappings、ResourceSynchronizer、update_resource、工作流序列、站间物料转移、post_init 完整模式。
---
## 关键规则
1. **`__init__` 必须接受 `deck``**kwargs`** — `WorkstationBase.__init__` 需要 `deck` 参数
2. **通过 `self._children` 访问子设备** — 不要自行维护子设备引用
3. **`post_init` 中启动后台服务** — 不要在 `__init__` 中启动网络连接
4. **异步方法使用 `await self._ros_node.sleep()`** — 禁止 `time.sleep()``asyncio.sleep()`
5. **子设备在图文件中声明** — 不在驱动代码中创建子设备实例
6. **`deck` 配置中的 `_resource_child_name` 必须与 deck 节点 ID 一致**
7. **Protocol 工作站优先使用 `ProtocolNode`** — 不需要自定义类
---
## 工作流清单
```
工作站接入进度:
- [ ] 1. 确定工作站类型Protocol / 外部系统 / 硬件控制)
- [ ] 2. 确认子设备组成和物料需求
- [ ] 3. 创建工作站驱动 unilabos/devices/workstation/<name>/<name>.py
- [ ] 4. 创建子设备驱动(如需要,按 add_device.md 流程)
- [ ] 5. 创建注册表 unilabos/registry/devices/<name>.yaml
- [ ] 6. 创建/选择 Deck 资源类(如需要)
- [ ] 7. 配置图文件 unilabos/test/experiments/<name>.json
- [ ] 8. 验证:可导入 + 注册表补全 + 启动测试
```
---
## 现有工作站参考
| 工作站 | 注册表名 | 驱动类 | 类型 |
|--------|----------|--------|------|
| Protocol 通用 | `workstation` | `ProtocolNode` | Protocol |
| Bioyond 反应站 | `reaction_station.bioyond` | `BioyondReactionStation` | 外部系统 |
| Bioyond 配液站 | `bioyond_dispensing_station` | `BioyondDispensingStation` | 外部系统 |
| 纽扣电池组装 | `coincellassemblyworkstation_device` | `CoinCellAssemblyWorkstation` | 硬件控制 |
### 参考文件路径
- 基类: `unilabos/devices/workstation/workstation_base.py`
- Bioyond 基类: `unilabos/devices/workstation/bioyond_studio/station.py`
- 反应站: `unilabos/devices/workstation/bioyond_studio/reaction_station/reaction_station.py`
- 配液站: `unilabos/devices/workstation/bioyond_studio/dispensing_station/dispensing_station.py`
- 纽扣电池: `unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py`
- ROS 节点: `unilabos/ros/nodes/presets/workstation.py`
- 图文件: `unilabos/test/experiments/reaction_station_bioyond.json`, `dispensing_station_bioyond.json`

View File

@@ -0,0 +1,371 @@
# 工作站高级模式参考
本文件是 SKILL.md 的补充,包含外部系统集成、物料同步、配置结构等高级模式。
Agent 在需要实现这些功能时按需阅读。
---
## 1. 外部系统集成模式
### 1.1 RPC 客户端
与外部 LIMS/MES 系统通信的标准模式。继承 `BaseRequest`,所有接口统一用 POST。
```python
from unilabos.device_comms.rpc import BaseRequest
class MySystemRPC(BaseRequest):
"""外部系统 RPC 客户端"""
def __init__(self, host: str, api_key: str):
super().__init__(host)
self.api_key = api_key
def _request(self, endpoint: str, data: dict = None) -> dict:
return self.post(
url=f"{self.host}/api/{endpoint}",
params={
"apiKey": self.api_key,
"requestTime": self.get_current_time_iso8601(),
"data": data or {},
},
)
def query_status(self) -> dict:
return self._request("status/query")
def create_order(self, order_data: dict) -> dict:
return self._request("order/create", order_data)
```
参考:`unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py``BioyondV1RPC`
### 1.2 HTTP 回调服务
接收外部系统报送的标准模式。使用 `WorkstationHTTPService`,在 `post_init` 中启动。
```python
from unilabos.devices.workstation.workstation_http_service import WorkstationHTTPService
class MyWorkstation(WorkstationBase):
def __init__(self, config=None, deck=None, **kwargs):
super().__init__(deck=deck, **kwargs)
self.config = config or {}
http_cfg = self.config.get("http_service_config", {})
self._http_service_config = {
"host": http_cfg.get("http_service_host", "127.0.0.1"),
"port": http_cfg.get("http_service_port", 8080),
}
self.http_service = None
def post_init(self, ros_node):
super().post_init(ros_node)
self.http_service = WorkstationHTTPService(
workstation_instance=self,
host=self._http_service_config["host"],
port=self._http_service_config["port"],
)
self.http_service.start()
```
**HTTP 服务路由**(固定端点,由 `WorkstationHTTPHandler` 自动分发):
| 端点 | 调用的工作站方法 |
|------|-----------------|
| `/report/step_finish` | `process_step_finish_report(report_request)` |
| `/report/sample_finish` | `process_sample_finish_report(report_request)` |
| `/report/order_finish` | `process_order_finish_report(report_request, used_materials)` |
| `/report/material_change` | `process_material_change_report(report_data)` |
| `/report/error_handling` | `handle_external_error(error_data)` |
实现对应方法即可接收回调:
```python
def process_step_finish_report(self, report_request) -> Dict[str, Any]:
"""处理步骤完成报告"""
step_name = report_request.data.get("stepName")
return {"success": True, "message": f"步骤 {step_name} 已处理"}
def process_order_finish_report(self, report_request, used_materials) -> Dict[str, Any]:
"""处理订单完成报告"""
order_code = report_request.data.get("orderCode")
return {"success": True}
```
参考:`unilabos/devices/workstation/workstation_http_service.py`
### 1.3 连接监控
独立线程周期性检测外部系统连接状态,状态变化时发布 ROS 事件。
```python
class ConnectionMonitor:
def __init__(self, workstation, check_interval=30):
self.workstation = workstation
self.check_interval = check_interval
self._running = False
self._thread = None
def start(self):
self._running = True
self._thread = threading.Thread(target=self._monitor_loop, daemon=True)
self._thread.start()
def _monitor_loop(self):
while self._running:
try:
# 调用外部系统接口检测连接
self.workstation.hardware_interface.ping()
status = "online"
except Exception:
status = "offline"
time.sleep(self.check_interval)
```
参考:`unilabos/devices/workstation/bioyond_studio/station.py``ConnectionMonitor`
---
## 2. Config 结构模式
工作站的 `config` 在图文件中定义,传入 `__init__`。以下是常见字段模式:
### 2.1 外部系统连接
```json
{
"api_host": "http://192.168.1.100:8080",
"api_key": "YOUR_API_KEY"
}
```
### 2.2 HTTP 回调服务
```json
{
"http_service_config": {
"http_service_host": "127.0.0.1",
"http_service_port": 8080
}
}
```
### 2.3 物料类型映射
将 PLR 资源类名映射到外部系统的物料类型(名称 + UUID。用于双向物料转换。
```json
{
"material_type_mappings": {
"PLR_ResourceClassName": ["外部系统显示名", "external-type-uuid"],
"BIOYOND_PolymerStation_Reactor": ["反应器", "3a14233b-902d-0d7b-..."]
}
}
```
### 2.4 仓库映射
将仓库名映射到外部系统的仓库 UUID 和库位 UUID。用于入库/出库操作。
```json
{
"warehouse_mapping": {
"仓库名": {
"uuid": "warehouse-uuid",
"site_uuids": {
"A01": "site-uuid-A01",
"A02": "site-uuid-A02"
}
}
}
}
```
### 2.5 工作流映射
将内部工作流名映射到外部系统的工作流 ID。
```json
{
"workflow_mappings": {
"internal_workflow_name": "external-workflow-uuid"
}
}
```
### 2.6 物料默认参数
```json
{
"material_default_parameters": {
"NMP": {
"unit": "毫升",
"density": "1.03",
"densityUnit": "g/mL",
"description": "N-甲基吡咯烷酮"
}
}
}
```
---
## 3. 资源同步机制
### 3.1 ResourceSynchronizer
抽象基类,用于与外部物料系统双向同步。定义在 `workstation_base.py`
```python
from unilabos.devices.workstation.workstation_base import ResourceSynchronizer
class MyResourceSynchronizer(ResourceSynchronizer):
def __init__(self, workstation, api_client):
super().__init__(workstation)
self.api_client = api_client
def sync_from_external(self) -> bool:
"""从外部系统拉取物料到 deck"""
external_materials = self.api_client.list_materials()
for material in external_materials:
plr_resource = self._convert_to_plr(material)
self.workstation.deck.assign_child_resource(plr_resource, coordinate)
return True
def sync_to_external(self, plr_resource) -> bool:
"""将 deck 中的物料变更推送到外部系统"""
external_data = self._convert_from_plr(plr_resource)
self.api_client.update_material(external_data)
return True
def handle_external_change(self, change_info) -> bool:
"""处理外部系统推送的物料变更"""
return True
```
### 3.2 update_resource — 上传资源树到云端
将 PLR Deck 序列化后通过 ROS 服务上传。典型使用场景:
```python
# 在 post_init 中上传初始 deck
from unilabos.ros.nodes.base_device_node import ROS2DeviceNode
ROS2DeviceNode.run_async_func(
self._ros_node.update_resource, True,
**{"resources": [self.deck]}
)
# 在动作方法中更新特定资源
ROS2DeviceNode.run_async_func(
self._ros_node.update_resource, True,
**{"resources": [updated_plate]}
)
```
---
## 4. 工作流序列管理
工作站通过 `workflow_sequence` 属性管理任务队列JSON 字符串形式)。
```python
class MyWorkstation(WorkstationBase):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._workflow_sequence = []
@property
def workflow_sequence(self) -> str:
"""返回 JSON 字符串ROS 自动发布"""
import json
return json.dumps(self._workflow_sequence)
async def append_to_workflow_sequence(self, workflow_name: str) -> Dict[str, Any]:
"""添加工作流到队列"""
self._workflow_sequence.append({
"name": workflow_name,
"status": "pending",
"created_at": time.time(),
})
return {"success": True}
async def clear_workflows(self) -> Dict[str, Any]:
"""清空工作流队列"""
self._workflow_sequence = []
return {"success": True}
```
---
## 5. 站间物料转移
工作站之间转移物料的模式。通过 ROS ActionClient 调用目标站的动作。
```python
async def transfer_materials_to_another_station(
self,
target_device_id: str,
transfer_groups: list,
**kwargs,
) -> Dict[str, Any]:
"""将物料转移到另一个工作站"""
target_node = self._children.get(target_device_id)
if not target_node:
# 通过 ROS 节点查找非子设备的目标站
pass
for group in transfer_groups:
resource = self.find_resource_by_name(group["resource_name"])
# 从本站 deck 移除
resource.unassign()
# 调用目标站的接收方法
# ...
return {"success": True, "transferred": len(transfer_groups)}
```
参考:`BioyondDispensingStation.transfer_materials_to_reaction_station`
---
## 6. post_init 完整模式
`post_init` 是工作站初始化的关键阶段,此时 ROS 节点和子设备已就绪。
```python
def post_init(self, ros_node):
super().post_init(ros_node)
# 1. 初始化外部系统客户端(此时 config 已可用)
self.rpc_client = MySystemRPC(
host=self.config.get("api_host"),
api_key=self.config.get("api_key"),
)
self.hardware_interface = self.rpc_client
# 2. 启动连接监控
self.connection_monitor = ConnectionMonitor(self)
self.connection_monitor.start()
# 3. 启动 HTTP 回调服务
if hasattr(self, '_http_service_config'):
self.http_service = WorkstationHTTPService(
workstation_instance=self,
host=self._http_service_config["host"],
port=self._http_service_config["port"],
)
self.http_service.start()
# 4. 上传 deck 到云端
ROS2DeviceNode.run_async_func(
self._ros_node.update_resource, True,
**{"resources": [self.deck]}
)
# 5. 初始化资源同步器(可选)
self.resource_synchronizer = MyResourceSynchronizer(self, self.rpc_client)
```

View File

@@ -1,328 +0,0 @@
---
name: create-device-skill
description: Create a skill for any Uni-Lab device by extracting action schemas from the device registry. Use when the user wants to create a new device skill, add device API documentation, or set up action schemas for a device.
---
# 创建设备 Skill 指南
本 meta-skill 教你如何为任意 Uni-Lab-OS 设备创建完整的 API 操作技能(参考 `unilab-device-api` 的成功案例)。
## 数据源
- **设备注册表**: `unilabos_data/req_device_registry_upload.json`
- **结构**: `{ "resources": [{ "id": "<device_id>", "class": { "module": "<python_module:ClassName>", "action_value_mappings": { ... } } }] }`
- **生成时机**: `unilab` 启动并完成注册表上传后自动生成
- **module 字段**: 格式 `unilabos.devices.xxx.yyy:ClassName`,可转为源码路径 `unilabos/devices/xxx/yyy.py`,阅读源码可了解参数含义和设备行为
## 创建流程
### Step 0 — 收集必备信息(缺一不可,否则询问后终止)
开始前**必须**确认以下 4 项信息全部就绪。如果用户未提供任何一项,**立即询问并终止当前流程**,等用户补齐后再继续。
向用户提问:「请提供你的 unilab 启动参数,我需要以下信息:」
#### 必备项 ①ak / sk认证凭据
来源:启动命令的 `--ak` `--sk` 参数,或 config.py 中的 `ak = "..."` `sk = "..."`
获取后立即生成 AUTH token
```bash
python ./scripts/gen_auth.py <ak> <sk>
# 或从 config.py 提取
python ./scripts/gen_auth.py --config <config.py>
```
认证算法:`base64(ak:sk)``Authorization: Lab <token>`
#### 必备项 ②:--addr目标环境
决定 API 请求发往哪个服务器。从启动命令的 `--addr` 参数获取:
| `--addr` 值 | BASE URL |
|-------------|----------|
| `test` | `https://uni-lab.test.bohrium.com` |
| `uat` | `https://uni-lab.uat.bohrium.com` |
| `local` | `http://127.0.0.1:48197` |
| 不传(默认) | `https://uni-lab.bohrium.com` |
| 其他自定义 URL | 直接使用该 URL |
#### 必备项 ③req_device_registry_upload.json设备注册表
数据文件由 `unilab` 启动时自动生成,需要定位它:
**推断 working_dir**(即 `unilabos_data` 所在目录):
| 条件 | working_dir 取值 |
|------|------------------|
| 传了 `--working_dir` | `<working_dir>/unilabos_data/`(若子目录已存在则直接用) |
| 仅传了 `--config` | `<config 文件所在目录>/unilabos_data/` |
| 都没传 | `<当前工作目录>/unilabos_data/` |
**按优先级搜索文件**
```
<推断的 working_dir>/unilabos_data/req_device_registry_upload.json
<推断的 working_dir>/req_device_registry_upload.json
<workspace 根目录>/unilabos_data/req_device_registry_upload.json
```
也可以直接 Glob 搜索:`**/req_device_registry_upload.json`
找到后**必须检查文件修改时间**并告知用户:「找到注册表文件 `<路径>`,生成于 `<时间>`。请确认这是最近一次启动生成的。」超过 1 天提醒用户是否需要重新启动 `unilab`
**如果文件不存在** → 告知用户先运行 `unilab` 启动命令,等日志出现 `注册表响应数据已保存` 后再执行本流程。**终止。**
#### 必备项 ④:目标设备
用户需要明确要为哪个设备创建 skill。可以是设备名称如「PRCXI 移液站」)或 device_id`liquid_handler.prcxi`)。
如果用户不确定,运行提取脚本列出所有设备供选择:
```bash
python ./scripts/extract_device_actions.py --registry <找到的文件路径>
```
#### 完整示例
用户提供:
```
--ak a1fd9d4e-xxxx-xxxx-xxxx-d9a69c09f0fd
--sk 136ff5c6-xxxx-xxxx-xxxx-a03e301f827b
--addr test
--port 8003
--disable_browser
```
从中提取:
- ✅ ak/sk → 运行 `gen_auth.py` 得到 `AUTH="Authorization: Lab YTFmZDlk..."`
- ✅ addr=test → `BASE=https://uni-lab.test.bohrium.com`
- ✅ 搜索 `unilabos_data/req_device_registry_upload.json` → 找到并确认时间
- ✅ 用户指明目标设备 → 如 `liquid_handler.prcxi`
**四项全部就绪后才进入 Step 1。**
### Step 1 — 列出可用设备
运行提取脚本,列出所有设备及 action 数量和 Python 源码路径,让用户选择:
```bash
# 自动搜索(默认在 unilabos_data/ 和当前目录查找)
python ./scripts/extract_device_actions.py
# 指定注册表文件路径
python ./scripts/extract_device_actions.py --registry <path/to/req_device_registry_upload.json>
```
脚本输出包含每个设备的 **Python 源码路径**(从 `class.module` 转换),可用于后续阅读源码理解参数含义。
### Step 2 — 提取 Action Schema
用户选择设备后,运行提取脚本:
```bash
python ./scripts/extract_device_actions.py [--registry <path>] <device_id> ./skills/<skill-name>/actions/
```
脚本会显示设备的 Python 源码路径和类名,方便阅读源码了解参数含义。
每个 action 生成一个 JSON 文件,包含:
- `type` — 作为 API 调用的 `action_type`
- `schema` — 完整 JSON Schema`properties.goal.properties` 参数定义)
- `goal` — goal 字段映射(含占位符 `$placeholder`
- `goal_default` — 默认值
### Step 3 — 写 action-index.md
按模板为每个 action 写条目:
```markdown
### `<action_name>`
<用途描述(一句话)>
- **Schema**: [`actions/<filename>.json`](actions/<filename>.json)
- **核心参数**: `param1`, `param2`(从 schema.required 获取)
- **可选参数**: `param3`, `param4`
- **占位符字段**: `field`(需填入物料信息,值以 `$` 开头)
```
描述规则:
-`schema.properties` 读参数列表schema 已提升为 goal 内容)
-`schema.required` 区分核心/可选参数
- 按功能分类(移液、枪头、外设等)
- 标注 `placeholder_keys` 中的字段类型:
- `unilabos_resources`**ResourceSlot**,填入 `{id, name, uuid}`id 是路径格式,从资源树取物料节点)
- `unilabos_devices`**DeviceSlot**,填入路径字符串如 `"/host_node"`(从资源树筛选 type=device
- `unilabos_nodes`**NodeSlot**,填入路径字符串如 `"/PRCXI/PRCXI_Deck"`(资源树中任意节点)
- `unilabos_class`**ClassSlot**,填入类名字符串如 `"container"`(从注册表查找)
- array 类型字段 → `[{id, name, uuid}, ...]`
- 特殊:`create_resource``res_id`ResourceSlot可填不存在的路径
### Step 4 — 写 SKILL.md
直接复用 `unilab-device-api` 的 API 模板10 个 endpoint修改
- 设备名称
- Action 数量
- 目录列表
- Session state 中的 `device_name`
- **AUTH 头** — 使用 Step 0 中 `gen_auth.py` 生成的 `Authorization: Lab <token>`(不要硬编码 `Api` 类型的 key
- **Python 源码路径** — 在 SKILL.md 开头注明设备对应的源码文件,方便参考参数含义
- **Slot 字段表** — 列出本设备哪些 action 的哪些字段需要填入 Slot物料/设备/节点/类名)
API 模板结构:
```markdown
## 设备信息
- device_id, Python 源码路径, 设备类名
## 前置条件(缺一不可)
- ak/sk → AUTH, --addr → BASE URL
## Session State
- lab_uuid通过 API #1 自动匹配,不要问用户), device_name
## API Endpoints (10 个)
# 注意:
# - #1 获取 lab 列表 + 自动匹配 lab_uuid遍历 is_admin 的 lab
# 调用 /lab/info/{uuid} 比对 access_key == ak
# - #2 创建工作流用 POST /lab/workflow
# - #10 获取资源树路径含 lab_uuid: /lab/material/download/{lab_uuid}
## Placeholder Slot 填写规则
- unilabos_resources → ResourceSlot → {"id":"/path/name","name":"name","uuid":"xxx"}
- unilabos_devices → DeviceSlot → "/parent/device" 路径字符串
- unilabos_nodes → NodeSlot → "/parent/node" 路径字符串
- unilabos_class → ClassSlot → "class_name" 字符串
- 特例create_resource 的 res_id 允许填不存在的路径
- 列出本设备所有 Slot 字段、类型及含义
## 渐进加载策略
## 完整工作流 Checklist
```
### Step 5 — 验证
检查文件完整性:
- [ ] `SKILL.md` 包含 10 个 API endpoint
- [ ] `SKILL.md` 包含 Placeholder Slot 填写规则ResourceSlot / DeviceSlot / NodeSlot / ClassSlot + create_resource 特例)和本设备的 Slot 字段表
- [ ] `action-index.md` 列出所有 action 并有描述
- [ ] `actions/` 目录中每个 action 有对应 JSON 文件
- [ ] JSON 文件包含 `type`, `schema`(已提升为 goal 内容), `goal`, `goal_default`, `placeholder_keys` 字段
- [ ] 描述能让 agent 判断该用哪个 action
## Action JSON 文件结构
```json
{
"type": "LiquidHandlerTransfer", // → API 的 action_type
"goal": { // goal 字段映射
"sources": "sources",
"targets": "targets",
"tip_racks": "tip_racks",
"asp_vols": "asp_vols"
},
"schema": { // ← 直接是 goal 的 schema已提升
"type": "object",
"properties": { // 参数定义(即请求中 goal 的字段)
"sources": { "type": "array", "items": { "type": "object" } },
"targets": { "type": "array", "items": { "type": "object" } },
"asp_vols": { "type": "array", "items": { "type": "number" } }
},
"required": [...],
"_unilabos_placeholder_info": { // ← Slot 类型标记
"sources": "unilabos_resources",
"targets": "unilabos_resources",
"tip_racks": "unilabos_resources"
}
},
"goal_default": { ... }, // 默认值
"placeholder_keys": { // ← 汇总所有 Slot 字段
"sources": "unilabos_resources", // ResourceSlot
"targets": "unilabos_resources",
"tip_racks": "unilabos_resources",
"target_device_id": "unilabos_devices" // DeviceSlot
}
}
```
> **注意**`schema` 已由脚本从原始 `schema.properties.goal` 提升为顶层,直接包含参数定义。
> `schema.properties` 中的字段即为 API 请求 `param.goal` 中的字段。
## Placeholder Slot 类型体系
`placeholder_keys` / `_unilabos_placeholder_info` 中有 4 种值,对应不同的填写方式:
| placeholder 值 | Slot 类型 | 填写格式 | 选取范围 |
|---------------|-----------|---------|---------|
| `unilabos_resources` | ResourceSlot | `{"id": "/path/name", "name": "name", "uuid": "xxx"}` | 仅**物料**节点(不含设备) |
| `unilabos_devices` | DeviceSlot | `"/parent/device_name"` | 仅**设备**节点type=device路径字符串 |
| `unilabos_nodes` | NodeSlot | `"/parent/node_name"` | **设备 + 物料**,即所有节点,路径字符串 |
| `unilabos_class` | ClassSlot | `"class_name"` | 注册表中已上报的资源类 name |
### ResourceSlot`unilabos_resources`
最常见的类型。从资源树中选取**物料**节点(孔板、枪头盒、试剂槽等):
```json
{"id": "/workstation/container1", "name": "container1", "uuid": "ff149a9a-2cb8-419d-8db5-d3ba056fb3c2"}
```
- 单个schema type=object`{"id": "/path/name", "name": "name", "uuid": "xxx"}`
- 数组schema type=array`[{"id": "/path/a", "name": "a", "uuid": "xxx"}, ...]`
- `id` 本身是从 parent 计算的路径格式
- 根据 action 语义选择正确的物料(如 `sources` = 液体来源,`targets` = 目标位置)
> **特例**`create_resource` 的 `res_id` 字段,目标物料可能**尚不存在**,此时直接填写期望的路径(如 `"/workstation/container1"`),不需要 uuid。
### DeviceSlot`unilabos_devices`
填写**设备路径字符串**。从资源树中筛选 type=device 的节点,从 parent 计算路径:
```
"/host_node"
"/bioyond_cell/reaction_station"
```
- 只填路径字符串,不需要 `{id, uuid}` 对象
- 根据 action 语义选择正确的设备(如 `target_device_id` = 目标设备)
### NodeSlot`unilabos_nodes`
范围 = 设备 + 物料。即资源树中**所有节点**都可以选,填写**路径字符串**
```
"/PRCXI/PRCXI_Deck"
```
- 使用场景:当参数既可能指向物料也可能指向设备时(如 `PumpTransferProtocol``from_vessel`/`to_vessel``create_resource``parent`
### ClassSlot`unilabos_class`
填写注册表中已上报的**资源类 name**。从本地 `req_resource_registry_upload.json` 中查找:
```
"container"
```
### 通过 API #10 获取资源树
```bash
curl -s -X GET "$BASE/api/v1/lab/material/download/$lab_uuid" -H "$AUTH"
```
注意 `lab_uuid` 在路径中(不是查询参数)。资源树返回所有节点,每个节点包含 `id`(路径格式)、`name``uuid``type``parent` 等字段。填写 Slot 时需根据 placeholder 类型筛选正确的节点。
## 最终目录结构
```
./<skill-name>/
├── SKILL.md # API 端点 + 渐进加载指引
├── action-index.md # 动作索引:描述/用途/核心参数
└── actions/ # 每个 action 的完整 JSON Schema
├── action1.json
├── action2.json
└── ...
```

View File

@@ -1,200 +0,0 @@
#!/usr/bin/env python3
"""
从 req_device_registry_upload.json 中提取指定设备的 action schema。
用法:
# 列出所有设备及 action 数量(自动搜索注册表文件)
python extract_device_actions.py
# 指定注册表文件路径
python extract_device_actions.py --registry <path/to/req_device_registry_upload.json>
# 提取指定设备的 action 到目录
python extract_device_actions.py <device_id> <output_dir>
python extract_device_actions.py --registry <path> <device_id> <output_dir>
示例:
python extract_device_actions.py --registry unilabos_data/req_device_registry_upload.json
python extract_device_actions.py liquid_handler.prcxi .cursor/skills/unilab-device-api/actions/
"""
import json
import os
import sys
from datetime import datetime
REGISTRY_FILENAME = "req_device_registry_upload.json"
def find_registry(explicit_path=None):
"""
查找 req_device_registry_upload.json 文件。
搜索优先级:
1. 用户通过 --registry 显式指定的路径
2. <cwd>/unilabos_data/req_device_registry_upload.json
3. <cwd>/req_device_registry_upload.json
4. <script所在目录>/../../.. (workspace根) 下的 unilabos_data/
5. 向上逐级搜索父目录(最多 5 层)
"""
if explicit_path:
if os.path.isfile(explicit_path):
return explicit_path
if os.path.isdir(explicit_path):
fp = os.path.join(explicit_path, REGISTRY_FILENAME)
if os.path.isfile(fp):
return fp
print(f"警告: 指定的路径不存在: {explicit_path}")
return None
candidates = [
os.path.join("unilabos_data", REGISTRY_FILENAME),
REGISTRY_FILENAME,
]
for c in candidates:
if os.path.isfile(c):
return c
script_dir = os.path.dirname(os.path.abspath(__file__))
workspace_root = os.path.normpath(os.path.join(script_dir, "..", "..", ".."))
for c in candidates:
path = os.path.join(workspace_root, c)
if os.path.isfile(path):
return path
cwd = os.getcwd()
for _ in range(5):
parent = os.path.dirname(cwd)
if parent == cwd:
break
cwd = parent
for c in candidates:
path = os.path.join(cwd, c)
if os.path.isfile(path):
return path
return None
def load_registry(path):
with open(path, 'r', encoding='utf-8') as f:
return json.load(f)
def list_devices(data):
"""列出所有包含 action_value_mappings 的设备,同时返回 module 路径"""
resources = data.get('resources', [])
devices = []
for res in resources:
rid = res.get('id', '')
cls = res.get('class', {})
avm = cls.get('action_value_mappings', {})
module = cls.get('module', '')
if avm:
devices.append((rid, len(avm), module))
return devices
def flatten_schema_to_goal(action_data):
"""将 schema 中嵌套的 goal 内容提升为顶层 schema去掉 feedback/result 包装"""
schema = action_data.get('schema', {})
goal_schema = schema.get('properties', {}).get('goal', {})
if goal_schema:
action_data = dict(action_data)
action_data['schema'] = goal_schema
return action_data
def extract_actions(data, device_id, output_dir):
"""提取指定设备的 action schema 到独立 JSON 文件"""
resources = data.get('resources', [])
for res in resources:
if res.get('id') == device_id:
cls = res.get('class', {})
module = cls.get('module', '')
avm = cls.get('action_value_mappings', {})
if not avm:
print(f"设备 {device_id} 没有 action_value_mappings")
return []
if module:
py_path = module.split(":")[0].replace(".", "/") + ".py"
class_name = module.split(":")[-1] if ":" in module else ""
print(f"Python 源码: {py_path}")
if class_name:
print(f"设备类: {class_name}")
os.makedirs(output_dir, exist_ok=True)
written = []
for action_name in sorted(avm.keys()):
action_data = flatten_schema_to_goal(avm[action_name])
filename = action_name.replace('-', '_') + '.json'
filepath = os.path.join(output_dir, filename)
with open(filepath, 'w', encoding='utf-8') as f:
json.dump(action_data, f, indent=2, ensure_ascii=False)
written.append(filename)
print(f" {filepath}")
return written
print(f"设备 {device_id} 未找到")
return []
def main():
args = sys.argv[1:]
explicit_registry = None
if "--registry" in args:
idx = args.index("--registry")
if idx + 1 < len(args):
explicit_registry = args[idx + 1]
args = args[:idx] + args[idx + 2:]
else:
print("错误: --registry 需要指定路径")
sys.exit(1)
registry_path = find_registry(explicit_registry)
if not registry_path:
print(f"错误: 找不到 {REGISTRY_FILENAME}")
print()
print("解决方法:")
print(" 1. 先运行 unilab 启动命令,等待注册表生成")
print(" 2. 用 --registry 指定文件路径:")
print(f" python {sys.argv[0]} --registry <path/to/{REGISTRY_FILENAME}>")
print()
print("搜索过的路径:")
for p in [
os.path.join("unilabos_data", REGISTRY_FILENAME),
REGISTRY_FILENAME,
os.path.join("<workspace_root>", "unilabos_data", REGISTRY_FILENAME),
]:
print(f" - {p}")
sys.exit(1)
print(f"注册表: {registry_path}")
mtime = os.path.getmtime(registry_path)
gen_time = datetime.fromtimestamp(mtime).strftime("%Y-%m-%d %H:%M:%S")
size_mb = os.path.getsize(registry_path) / (1024 * 1024)
print(f"生成时间: {gen_time} (文件大小: {size_mb:.1f} MB)")
data = load_registry(registry_path)
if len(args) == 0:
devices = list_devices(data)
print(f"\n找到 {len(devices)} 个设备:")
print(f"{'设备 ID':<50} {'Actions':>7} {'Python 模块'}")
print("-" * 120)
for did, count, module in sorted(devices, key=lambda x: x[0]):
py_path = module.split(":")[0].replace(".", "/") + ".py" if module else ""
print(f"{did:<50} {count:>7} {py_path}")
elif len(args) == 2:
device_id = args[0]
output_dir = args[1]
print(f"\n提取 {device_id} 的 actions 到 {output_dir}/")
written = extract_actions(data, device_id, output_dir)
if written:
print(f"\n共写入 {len(written)} 个 action 文件")
else:
print("用法:")
print(" python extract_device_actions.py [--registry <path>] # 列出设备")
print(" python extract_device_actions.py [--registry <path>] <device_id> <dir> # 提取 actions")
sys.exit(1)
if __name__ == '__main__':
main()

View File

@@ -1,69 +0,0 @@
#!/usr/bin/env python3
"""
从 ak/sk 生成 UniLab API Authorization header。
算法: base64(ak:sk) → "Authorization: Lab <token>"
用法:
python gen_auth.py <ak> <sk>
python gen_auth.py --config <config.py>
示例:
python gen_auth.py myak mysk
python gen_auth.py --config experiments/config.py
"""
import base64
import re
import sys
def gen_auth(ak: str, sk: str) -> str:
token = base64.b64encode(f"{ak}:{sk}".encode("utf-8")).decode("utf-8")
return token
def extract_from_config(config_path: str) -> tuple:
"""从 config.py 中提取 ak 和 sk"""
with open(config_path, "r", encoding="utf-8") as f:
content = f.read()
ak_match = re.search(r'''ak\s*=\s*["']([^"']+)["']''', content)
sk_match = re.search(r'''sk\s*=\s*["']([^"']+)["']''', content)
if not ak_match or not sk_match:
return None, None
return ak_match.group(1), sk_match.group(1)
def main():
args = sys.argv[1:]
if len(args) == 2 and args[0] == "--config":
ak, sk = extract_from_config(args[1])
if not ak or not sk:
print(f"错误: 在 {args[1]} 中未找到 ak/sk 配置")
print("期望格式: ak = \"xxx\" sk = \"xxx\"")
sys.exit(1)
print(f"配置文件: {args[1]}")
elif len(args) == 2:
ak, sk = args
else:
print("用法:")
print(" python gen_auth.py <ak> <sk>")
print(" python gen_auth.py --config <config.py>")
sys.exit(1)
token = gen_auth(ak, sk)
print(f"ak: {ak}")
print(f"sk: {sk}")
print()
print(f"Authorization header:")
print(f" Authorization: Lab {token}")
print()
print(f"curl 用法:")
print(f' curl -H "Authorization: Lab {token}" ...')
print()
print(f"Shell 变量:")
print(f' AUTH="Authorization: Lab {token}"')
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,381 @@
---
name: edit-experiment-graph
description: Guide for creating and editing experiment graph files in Uni-Lab-OS (创建/编辑实验组态图). Covers node types, link types, parent-child relationships, deck configuration, and common graph patterns. Use when the user wants to create a graph file, edit an experiment configuration, set up device topology, or mentions 图文件/graph/组态/拓扑/实验图/experiment JSON.
---
# 创建/编辑实验组态图
实验图Graph File定义设备拓扑、物理连接和物料配置。系统启动时加载图文件初始化所有设备和连接关系。
路径:`unilabos/test/experiments/<name>.json`
---
## 第一步:确认需求
向用户确认:
| 信息 | 说明 |
|------|------|
| 场景类型 | 单设备调试 / 多设备联调 / 工作站完整图 |
| 包含的设备 | 设备 ID、注册表 class 名、配置参数 |
| 连接关系 | 物理连接(管道)/ 通信连接(串口)/ 无连接 |
| 父子关系 | 是否有工作站包含子设备 |
| 物料需求 | 是否需要 Deck、容器、试剂瓶 |
---
## 第二步JSON 顶层结构
```json
{
"nodes": [],
"links": []
}
```
> `links` 也可写作 `edges`,加载时两者等效。
---
## 第三步:定义 Nodes
### 节点字段
| 字段 | 类型 | 必需 | 默认值 | 说明 |
|------|------|------|--------|------|
| `id` | string | **是** | — | 节点唯一标识links 和 children 中引用此值 |
| `class` | string | **是** | — | 对应注册表名(设备/资源 YAML 的 key容器可为 `null` |
| `name` | string | 否 | 同 `id` | 显示名称,缺省时自动用 `id` |
| `type` | string | 否 | `"device"` | 节点类型(见下表),缺省时自动设为 `"device"` |
| `children` | string[] | 否 | `[]` | 子节点 ID 列表 |
| `parent` | string\|null | 否 | `null` | 父节点 ID顶层设备为 `null` |
| `position` | object | 否 | `{x:0,y:0,z:0}` | 空间坐标 |
| `config` | object | 否 | `{}` | 传给驱动 `__init__` 的参数 |
| `data` | object | 否 | `{}` | 初始运行状态 |
| `size_x/y/z` | float | 否 | — | 节点物理尺寸(工作站节点常用) |
> 非标准字段(如 `api_host`)会自动移入 `config`。
### 节点类型
| `type` | 用途 | `class` 要求 |
|--------|------|-------------|
| `device` | 设备(默认) | 注册表中的设备名 |
| `deck` | 工作台面 | Deck 工厂函数/类名 |
| `container` | 容器(烧瓶、反应釜) | `null` 或具体容器类名 |
### 设备节点模板
```json
{
"id": "my_device",
"name": "我的设备",
"children": [],
"parent": null,
"type": "device",
"class": "registry_device_name",
"position": {"x": 0, "y": 0, "z": 0},
"config": {
"port": "/dev/ttyUSB0",
"baudrate": 115200
},
"data": {
"status": "Idle"
}
}
```
### 容器节点模板
容器用于协议系统中表示试剂瓶、反应釜等,`class` 通常为 `null`
```json
{
"id": "flask_DMF",
"name": "DMF试剂瓶",
"children": [],
"parent": "my_station",
"type": "container",
"class": null,
"position": {"x": 200, "y": 500, "z": 0},
"config": {"max_volume": 1000.0},
"data": {
"liquid": [{"liquid_type": "DMF", "liquid_volume": 800.0}]
}
}
```
### Deck 节点模板
```json
{
"id": "my_deck",
"name": "my_deck",
"children": [],
"parent": "my_station",
"type": "deck",
"class": "MyStation_Deck",
"position": {"x": 0, "y": 0, "z": 0},
"config": {
"type": "MyStation_Deck",
"setup": true,
"rotation": {"x": 0, "y": 0, "z": 0, "type": "Rotation"}
},
"data": {}
}
```
---
## 第四步:定义 Links
### Link 字段
| 字段 | 类型 | 说明 |
|------|------|------|
| `source` | string | 源节点 ID |
| `target` | string | 目标节点 ID |
| `type` | string | `"physical"` / `"fluid"` / `"communication"` |
| `port` | object | 端口映射 `{source_id: "port_name", target_id: "port_name"}` |
### 物理/流体连接
设备间的管道连接,协议系统用此查找路径:
```json
{
"source": "multiway_valve_1",
"target": "flask_DMF",
"type": "fluid",
"port": {
"multiway_valve_1": "2",
"flask_DMF": "outlet"
}
}
```
### 通信连接
设备间的串口/IO 通信代理,加载时自动将端口信息写入目标设备 config
```json
{
"source": "pump_1",
"target": "serial_device",
"type": "communication",
"port": {
"pump_1": "port",
"serial_device": "port"
}
}
```
---
## 第五步:父子关系与工作站配置
### 工作站 + 子设备
工作站节点的 `children` 列出所有子节点 ID子节点的 `parent` 指向工作站:
```json
{
"id": "my_station",
"children": ["my_deck", "pump_1", "valve_1", "reactor_1"],
"parent": null,
"type": "device",
"class": "workstation",
"config": {
"protocol_type": ["PumpTransferProtocol", "CleanProtocol"]
}
}
```
### 工作站 + Deck 引用
工作站节点中通过 `deck` 字段引用 Deck
```json
{
"id": "my_station",
"children": ["my_deck", "sub_device_1"],
"deck": {
"data": {
"_resource_child_name": "my_deck",
"_resource_type": "unilabos.resources.my_module.decks:MyDeck"
}
}
}
```
**关键约束:**
- `_resource_child_name` 必须与 Deck 节点的 `id` 一致
- `_resource_type` 为 Deck 类/工厂函数的完整 Python 路径
---
## 常见图模式
### 模式 A单设备调试
最简形式,一个设备节点,无连接:
```json
{
"nodes": [
{
"id": "my_device",
"name": "my_device",
"children": [],
"parent": null,
"type": "device",
"class": "motor.zdt_x42",
"position": {"x": 0, "y": 0, "z": 0},
"config": {"port": "/dev/ttyUSB0", "baudrate": 115200},
"data": {"status": "idle"}
}
],
"links": []
}
```
### 模式 BProtocol 工作站(泵+阀+容器)
工作站配合泵、阀、容器和物理连接,用于协议编译:
```json
{
"nodes": [
{
"id": "station", "name": "协议工作站",
"class": "workstation", "type": "device", "parent": null,
"children": ["pump", "valve", "flask_solvent", "reactor", "waste"],
"config": {"protocol_type": ["PumpTransferProtocol"]}
},
{"id": "pump", "name": "转移泵", "class": "virtual_transfer_pump",
"type": "device", "parent": "station",
"config": {"port": "VIRTUAL", "max_volume": 25.0},
"data": {"status": "Idle", "position": 0.0, "valve_position": "0"}},
{"id": "valve", "name": "多通阀", "class": "virtual_multiway_valve",
"type": "device", "parent": "station",
"config": {"port": "VIRTUAL", "positions": 8}},
{"id": "flask_solvent", "name": "溶剂瓶", "type": "container",
"class": null, "parent": "station",
"config": {"max_volume": 1000.0},
"data": {"liquid": [{"liquid_type": "DMF", "liquid_volume": 500}]}},
{"id": "reactor", "name": "反应器", "type": "container",
"class": null, "parent": "station"},
{"id": "waste", "name": "废液瓶", "type": "container",
"class": null, "parent": "station"}
],
"links": [
{"source": "pump", "target": "valve", "type": "fluid",
"port": {"pump": "transferpump", "valve": "transferpump"}},
{"source": "valve", "target": "flask_solvent", "type": "fluid",
"port": {"valve": "1", "flask_solvent": "outlet"}},
{"source": "valve", "target": "reactor", "type": "fluid",
"port": {"valve": "2", "reactor": "inlet"}},
{"source": "valve", "target": "waste", "type": "fluid",
"port": {"valve": "3", "waste": "inlet"}}
]
}
```
### 模式 C外部系统工作站 + Deck
```json
{
"nodes": [
{
"id": "bioyond_station", "class": "reaction_station.bioyond",
"parent": null, "children": ["bioyond_deck"],
"config": {
"api_host": "http://192.168.1.100:8080",
"api_key": "YOUR_KEY",
"material_type_mappings": {},
"warehouse_mapping": {}
},
"deck": {
"data": {
"_resource_child_name": "bioyond_deck",
"_resource_type": "unilabos.resources.bioyond.decks:BIOYOND_PolymerReactionStation_Deck"
}
}
},
{
"id": "bioyond_deck", "class": "BIOYOND_PolymerReactionStation_Deck",
"parent": "bioyond_station", "type": "deck",
"config": {"type": "BIOYOND_PolymerReactionStation_Deck", "setup": true}
}
],
"links": []
}
```
### 模式 D通信代理串口设备
泵通过串口设备通信,使用 `communication` 类型的 link。加载时系统会自动将串口端口信息写入泵的 `config`
```json
{
"nodes": [
{"id": "station", "name": "工作站", "type": "device",
"class": "workstation", "parent": null,
"children": ["serial_1", "pump_1"]},
{"id": "serial_1", "name": "串口", "type": "device",
"class": "serial", "parent": "station",
"config": {"port": "COM7", "baudrate": 9600}},
{"id": "pump_1", "name": "注射泵", "type": "device",
"class": "syringe_pump_with_valve.runze.SY03B-T08", "parent": "station"}
],
"links": [
{"source": "pump_1", "target": "serial_1", "type": "communication",
"port": {"pump_1": "port", "serial_1": "port"}}
]
}
```
---
## 验证
```bash
# 启动测试
unilab -g unilabos/test/experiments/<name>.json --complete_registry
# 仅检查注册表
python -m unilabos --check_mode --skip_env_check
```
---
## 高级模式
处理复杂图文件时,详见 [reference.md](reference.md)ResourceDict 完整字段 schema、Pose 标准化规则、Handle 验证机制、GraphML 格式支持、外部系统工作站完整 config 结构。
---
## 常见错误
| 错误 | 原因 | 修复 |
|------|------|------|
| `class` 找不到 | 注册表中无此设备名 | 在 `unilabos/registry/devices/``resources/` 中搜索正确名称 |
| children/parent 不一致 | 子节点 `parent` 与父节点 `children` 不匹配 | 确保双向一致 |
| `_resource_child_name` 不匹配 | Deck 引用名与 Deck 节点 `id` 不同 | 保持一致 |
| Link 端口错误 | `port` 中的 key 不是 source/target 的 `id` | key 必须是对应节点的 `id` |
| 重复 UUID | 多个节点有相同 `uuid` | 删除或修改 UUID |
---
## 参考路径
| 内容 | 路径 |
|------|------|
| 图文件目录 | `unilabos/test/experiments/` |
| 协议测试站 | `unilabos/test/experiments/Protocol_Test_Station/` |
| 图加载代码 | `unilabos/resources/graphio.py` |
| 节点模型 | `unilabos/resources/resource_tracker.py` |
| 设备注册表 | `unilabos/registry/devices/` |
| 资源注册表 | `unilabos/registry/resources/` |
| 用户文档 | `docs/user_guide/graph_files.md` |

View File

@@ -0,0 +1,255 @@
# 实验图高级参考
本文件是 SKILL.md 的补充,包含 ResourceDict 完整 schema、Handle 验证、GraphML 格式、Pose 标准化规则和复杂图文件结构。Agent 在需要处理这些场景时按需阅读。
---
## 1. ResourceDict 完整字段
`unilabos/resources/resource_tracker.py` 中定义的节点数据模型:
| 字段 | 类型 | 别名 | 说明 |
|------|------|------|------|
| `id` | `str` | — | 节点唯一标识 |
| `uuid` | `str` | — | 全局唯一标识 |
| `name` | `str` | — | 显示名称 |
| `description` | `str` | — | 描述(默认 `""` |
| `resource_schema` | `Dict[str, Any]` | `schema` | 资源 schema |
| `model` | `Dict[str, Any]` | — | 3D 模型信息 |
| `icon` | `str` | — | 图标(默认 `""` |
| `parent_uuid` | `Optional[str]` | — | 父节点 UUID |
| `parent` | `Optional[ResourceDict]` | — | 父节点引用(序列化时 exclude |
| `type` | `Union[Literal["device"], str]` | — | 节点类型 |
| `klass` | `str` | `class` | 注册表类名 |
| `pose` | `ResourceDictPosition` | — | 位姿信息 |
| `config` | `Dict[str, Any]` | — | 配置参数 |
| `data` | `Dict[str, Any]` | — | 运行时数据 |
| `extra` | `Dict[str, Any]` | — | 扩展数据 |
### Pose 完整结构ResourceDictPosition
| 字段 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `size` | `{width, height, depth}` | `{0,0,0}` | 节点尺寸 |
| `scale` | `{x, y, z}` | `{1,1,1}` | 缩放比例 |
| `layout` | `"2d"/"x-y"/"z-y"/"x-z"` | `"x-y"` | 布局方向 |
| `position` | `{x, y, z}` | `{0,0,0}` | 2D 位置 |
| `position3d` | `{x, y, z}` | `{0,0,0}` | 3D 位置 |
| `rotation` | `{x, y, z}` | `{0,0,0}` | 旋转角度 |
| `cross_section_type` | `"rectangle"/"circle"/"rounded_rectangle"` | `"rectangle"` | 横截面形状 |
---
## 2. Position / Pose 标准化规则
图文件中的 `position` 有多种写法,加载时自动标准化。
### 输入格式兼容
```json
// 格式 A: 直接 {x, y, z}(最常用)
"position": {"x": 100, "y": 200, "z": 0}
// 格式 B: 嵌套 position
"position": {"position": {"x": 100, "y": 200, "z": 0}}
// 格式 C: 使用 pose 字段
"pose": {"position": {"x": 100, "y": 200, "z": 0}}
// 格式 D: 顶层 x, y, z无 position 字段)
"x": 100, "y": 200, "z": 0
```
### 标准化流程
1. **graphio.py `canonicalize_nodes_data`**:若 `position` 不是 dict从节点顶层提取 `x/y/z` 填入 `pose.position`
2. **resource_tracker.py `get_resource_instance_from_dict`**:若 `position.x` 存在(旧格式),转为 `{"position": {"x":..., "y":..., "z":...}}`
3. `pose.size``config.size_x/size_y/size_z` 自动填充
---
## 3. Handle 验证
启动时系统验证 link 中的 `sourceHandle` / `targetHandle` 是否在注册表的 `handles` 中定义。
```python
# unilabos/app/main.py (约 449-481 行)
source_handler_keys = [
h["handler_key"] for h in materials[source_node.klass]["handles"]
if h["io_type"] == "source"
]
target_handler_keys = [
h["handler_key"] for h in materials[target_node.klass]["handles"]
if h["io_type"] == "target"
]
if source_handle not in source_handler_keys:
print_status(f"节点 {source_node.id} 的source端点 {source_handle} 不存在", "error")
resource_edge_info.pop(...) # 移除非法 link
```
**Handle 定义在注册表 YAML 中:**
```yaml
my_device:
handles:
- handler_key: access
io_type: target
data_type: fluid
side: NORTH
label: access
```
> 大多数简单设备不定义 handles此验证仅对有 `sourceHandle`/`targetHandle` 的 link 生效。
---
## 4. GraphML 格式支持
除 JSON 外,系统也支持 GraphML 格式(`unilabos/resources/graphio.py::read_graphml`)。
### 与 JSON 的关键差异
| 特性 | JSON | GraphML |
|------|------|---------|
| 父子关系 | `parent`/`children` 字段 | `::` 分隔的节点 ID`station::pump_1` |
| 加载后 | 直接解析 | 先 `nx.read_graphml` 再转 JSON 格式 |
| 输出 | 不生成副本 | 自动生成等价的 `.json` 文件 |
### GraphML 转换流程
```
nx.read_graphml(file)
↓ 用 label 重映射节点名
↓ 从 "::" 推断 parent_relation
nx.relabel_nodes + nx.node_link_data
↓ canonicalize_nodes_data + canonicalize_links_ports
↓ 写出等价 JSON 文件
physical_setup_graph + handle_communications
```
---
## 5. 复杂图文件结构示例
### 外部系统工作站完整 config
`reaction_station_bioyond.json` 为例,工作站 `config` 中的关键字段:
```json
{
"config": {
"api_key": "DE9BDDA0",
"api_host": "http://172.21.103.36:45388",
"workflow_mappings": {
"scheduler_start": {"workflow": "start", "params": {}},
"create_order": {"workflow": "create_order", "params": {}}
},
"material_type_mappings": {
"BIOYOND_PolymerStation_Reactor": ["反应器", "type-uuid-here"],
"BIOYOND_PolymerStation_1BottleCarrier": ["试剂瓶", "type-uuid-here"]
},
"warehouse_mapping": {
"堆栈1左": {
"uuid": "warehouse-uuid-here",
"site_uuids": {
"A01": "site-uuid-1",
"A02": "site-uuid-2"
}
}
},
"http_service_config": {
"enabled": true,
"host": "0.0.0.0",
"port": 45399,
"routes": ["/callback/workflow", "/callback/material"]
},
"deck": {
"data": {
"_resource_child_name": "Bioyond_Deck",
"_resource_type": "unilabos.resources.bioyond.decks:BIOYOND_PolymerReactionStation_Deck"
}
},
"size_x": 2700.0,
"size_y": 1080.0,
"size_z": 2500.0,
"protocol_type": [],
"data": {}
}
}
```
### 子设备 Reactor 节点
```json
{
"id": "reactor_1",
"name": "reactor_1",
"parent": "reaction_station_bioyond",
"type": "device",
"class": "bioyond_reactor",
"position": {"x": 1150, "y": 300, "z": 0},
"config": {
"reactor_index": 0,
"bioyond_workflow_key": "reactor_1"
},
"data": {}
}
```
### Deck 节点
```json
{
"id": "Bioyond_Deck",
"name": "Bioyond_Deck",
"parent": "reaction_station_bioyond",
"type": "deck",
"class": "BIOYOND_PolymerReactionStation_Deck",
"position": {"x": 0, "y": 0, "z": 0},
"config": {
"type": "BIOYOND_PolymerReactionStation_Deck",
"setup": true,
"rotation": {"x": 0, "y": 0, "z": 0, "type": "Rotation"}
},
"data": {}
}
```
---
## 6. Link 端口标准化
`graphio.py::canonicalize_links_ports` 处理 `port` 字段的多种格式:
```python
# 输入: 字符串格式 "(A,B)"
"port": "(pump_1, valve_1)"
# 输出: 字典格式
"port": {"source_id": "pump_1", "target_id": "valve_1"}
# 输入: 已是字典
"port": {"pump_1": "port", "serial_1": "port"}
# 保持不变
# 输入: 无 port 字段
# 自动补充空 port
```
---
## 7. 关键路径
| 内容 | 路径 |
|------|------|
| ResourceDict 模型 | `unilabos/resources/resource_tracker.py` |
| 图加载 + 标准化 | `unilabos/resources/graphio.py` |
| Handle 验证 | `unilabos/app/main.py` (449-481 行) |
| 反应站图文件 | `unilabos/test/experiments/reaction_station_bioyond.json` |
| 配液站图文件 | `unilabos/test/experiments/dispensing_station_bioyond.json` |
| 用户文档 | `docs/user_guide/graph_files.md` |

188
.cursorignore Normal file
View File

@@ -0,0 +1,188 @@
# ============================================================
# Uni-Lab-OS Cursor Ignore 配置,控制 Cursor AI 的文件索引范围
# ============================================================
# ==================== 敏感配置文件 ====================
# 本地配置(可能包含密钥)
**/local_config.py
test_config.py
local_test*.py
# 环境变量和密钥
.env
.env.*
**/.certs/
*.pem
*.key
credentials.json
secrets.yaml
# ==================== 二进制和 3D 模型文件 ====================
# 3D 模型文件(无需索引)
*.stl
*.dae
*.glb
*.gltf
*.obj
*.fbx
*.blend
# URDF/Xacro 机器人描述文件大型XML
*.xacro
# 图片文件
*.png
*.jpg
*.jpeg
*.gif
*.webp
*.ico
*.svg
*.bmp
# 压缩包
*.zip
*.tar
*.tar.gz
*.tgz
*.bz2
*.rar
*.7z
# ==================== Python 生成文件 ====================
__pycache__/
*.py[cod]
*$py.class
*.so
*.pyd
*.egg
*.egg-info/
.eggs/
dist/
build/
*.manifest
*.spec
# ==================== IDE 和编辑器 ====================
.idea/
.vscode/
*.swp
*.swo
*~
.#*
# ==================== 测试和覆盖率 ====================
.pytest_cache/
.coverage
.coverage.*
htmlcov/
.tox/
.nox/
coverage.xml
*.cover
# ==================== 虚拟环境 ====================
.venv/
venv/
env/
ENV/
# ==================== ROS 2 生成文件 ====================
# ROS 构建目录
build/
install/
log/
logs/
devel/
# ROS 消息生成
msg_gen/
srv_gen/
msg/*Action.msg
msg/*ActionFeedback.msg
msg/*ActionGoal.msg
msg/*ActionResult.msg
msg/*Feedback.msg
msg/*Goal.msg
msg/*Result.msg
msg/_*.py
srv/_*.py
build_isolated/
devel_isolated/
# ROS 动态配置
*.cfgc
/cfg/cpp/
/cfg/*.py
# ==================== 项目特定目录 ====================
# 工作数据目录
unilabos_data/
# 临时和输出目录
temp/
output/
cursor_docs/
configs/
# 文档构建
docs/_build/
/site
# ==================== 大型数据文件 ====================
# 点云数据
*.pcd
# GraphML 图形文件
*.graphml
# 日志文件
*.log
# 数据库
*.sqlite3
*.db
# Jupyter 检查点
.ipynb_checkpoints/
# ==================== 设备网格资源 ====================
# 3D 网格文件目录(包含大量 STL/DAE 文件)
unilabos/device_mesh/devices/**/*.stl
unilabos/device_mesh/devices/**/*.dae
unilabos/device_mesh/resources/**/*.stl
unilabos/device_mesh/resources/**/*.glb
unilabos/device_mesh/resources/**/*.xacro
# RViz 配置
*.rviz
# ==================== 系统文件 ====================
.DS_Store
Thumbs.db
desktop.ini
# ==================== 锁文件 ====================
poetry.lock
Pipfile.lock
pdm.lock
package-lock.json
yarn.lock
# ==================== 类型检查缓存 ====================
.mypy_cache/
.dmypy.json
.pytype/
.pyre/
pyrightconfig.json
# ==================== 其他 ====================
# Catkin
CATKIN_IGNORE
# Eclipse/Qt
.project
.cproject
CMakeLists.txt.user
*.user
qtcreator-*

11
.github/copilot-instructions.md vendored Normal file
View File

@@ -0,0 +1,11 @@
## 设备接入
当被要求添加设备驱动时,参考 `docs/ai_guides/add_device.md`
该指南包含完整的模板和已有设备接口参考。
## 关键规则
- 动作方法的参数名是接口契约,不可重命名
- `status` 字符串必须与同类已有设备一致
- `self.data` 必须在 `__init__` 中预填充所有属性字段
- 异步方法中使用 `await self._ros_node.sleep()`,禁止 `time.sleep()`

View File

@@ -49,7 +49,7 @@ jobs:
uv pip uninstall enum34 || echo enum34 not installed, skipping uv pip uninstall enum34 || echo enum34 not installed, skipping
uv pip install . uv pip install .
- name: Run check mode (AST registry validation) - name: Run check mode (complete_registry)
run: | run: |
call conda activate check-env call conda activate check-env
echo Running check mode... echo Running check mode...

1
.gitignore vendored
View File

@@ -5,7 +5,6 @@ output/
unilabos_data/ unilabos_data/
pyrightconfig.json pyrightconfig.json
.cursorignore .cursorignore
device_package*/
## Python ## Python
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

View File

@@ -1,87 +1,21 @@
# AGENTS.md # Uni-Lab-OS AI Agent 指南
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## 设备接入
Also follow the monorepo-level rules in `../AGENTS.md`. 当用户要求添加/接入新设备时,读取 `docs/ai_guides/add_device.md` 并按其流程执行。
该指南完全自包含,包含物模型模板、现有设备接口快照、常见错误和验证清单。
## Build & Development ## 关键规则
```bash - 动作方法的参数名是接口契约,不可重命名(如 `volume` 不能改为 `volume_ml`
# Install in editable mode (requires mamba env with python 3.11) - `status` 字符串必须与同类已有设备一致(如 `"Idle"` 不能改为 `"就绪"`
pip install -e . - `self.data` 必须在 `__init__` 中预填充所有属性字段
uv pip install -r unilabos/utils/requirements.txt - 异步方法中使用 `await self._ros_node.sleep()`,禁止 `time.sleep()``asyncio.sleep()`
# Run with a device graph ## 项目结构
unilab --graph <graph.json> --config <config.py> --backend ros
unilab --graph <graph.json> --config <config.py> --backend simple # no ROS2 needed
# Common CLI flags - 设备驱动:`unilabos/devices/<category>/<device_name>.py`
unilab --app_bridges websocket fastapi # communication bridges - 设备注册表:`unilabos/registry/devices/<device_name>.yaml`
unilab --test_mode # simulate hardware, no real execution - 实验图文件:`unilabos/test/experiments/*.json`
unilab --check_mode # CI validation of registry imports - 人类开发文档:`docs/developer_guide/`
unilab --skip_env_check # skip auto-install of dependencies - AI 专用指南:`docs/ai_guides/`
unilab --visual rviz|web|disable # visualization mode
unilab --is_slave # run as slave node
# Workflow upload subcommand
unilab workflow_upload -f <workflow.json> -n <name> --tags tag1 tag2
# Tests
pytest tests/ # all tests
pytest tests/resources/test_resourcetreeset.py # single test file
pytest tests/resources/test_resourcetreeset.py::TestClassName::test_method # single test
```
## Architecture
### Startup Flow
`unilab` CLI → `unilabos/app/main.py:main()` → loads config → builds registry → reads device graph (JSON/GraphML) → starts backend thread (ROS2/simple) → starts FastAPI web server + WebSocket client.
### Core Layers
**Registry** (`unilabos/registry/`): Singleton `Registry` class discovers and catalogs all device types, resource types, and communication devices from YAML definitions. Device types live in `registry/devices/*.yaml`, resources in `registry/resources/`, comms in `registry/device_comms/`. The registry resolves class paths to actual Python classes via `utils/import_manager.py`.
**Resource Tracking** (`unilabos/resources/resource_tracker.py`): Pydantic-based `ResourceDict``ResourceDictInstance``ResourceTreeSet` hierarchy. `ResourceTreeSet` is the canonical in-memory representation of all devices and resources, used throughout the system. Graph I/O is in `resources/graphio.py` (reads JSON/GraphML device topology files into `nx.Graph` + `ResourceTreeSet`).
**Device Drivers** (`unilabos/devices/`): 30+ hardware drivers organized by device type (liquid_handling, hplc, balance, arm, etc.). Each driver is a Python class that gets wrapped by `ros/device_node_wrapper.py:ros2_device_node()` to become a ROS2 node with publishers, subscribers, and action servers.
**ROS2 Layer** (`unilabos/ros/`): `device_node_wrapper.py` dynamically wraps any device class into `ROS2DeviceNode` (defined in `ros/nodes/base_device_node.py`). Preset node types in `ros/nodes/presets/` include `host_node`, `controller_node`, `workstation`, `serial_node`, `camera`. Messages use custom `unilabos_msgs` (pre-built, distributed via releases).
**Protocol Compilation** (`unilabos/compile/`): 20+ protocol compilers (add, centrifuge, dissolve, filter, heatchill, stir, pump, etc.) that transform YAML protocol definitions into executable sequences.
**Communication** (`unilabos/device_comms/`): Hardware communication adapters — OPC-UA client, Modbus PLC, RPC, and a universal driver. `app/communication.py` provides a factory pattern for WebSocket client connections to the cloud.
**Web/API** (`unilabos/app/web/`): FastAPI server with REST API (`api.py`), Jinja2 template pages (`pages.py`), and HTTP client for cloud communication (`client.py`). Runs on port 8002 by default.
### Configuration System
- **Config classes** in `unilabos/config/config.py`: `BasicConfig`, `WSConfig`, `HTTPConfig`, `ROSConfig` — all class-level attributes, loaded from Python config files
- Config files are `.py` files with matching class names (see `config/example_config.py`)
- Environment variables override with prefix `UNILABOS_` (e.g., `UNILABOS_BASICCONFIG_PORT=9000`)
- Device topology defined in graph files (JSON with node-link format, or GraphML)
### Key Data Flow
1. Graph file → `graphio.read_node_link_json()``(nx.Graph, ResourceTreeSet, resource_links)`
2. `ResourceTreeSet` + `Registry``initialize_device.initialize_device_from_dict()``ROS2DeviceNode` instances
3. Device nodes communicate via ROS2 topics/actions or direct Python calls (simple backend)
4. Cloud sync via WebSocket (`app/ws_client.py`) and HTTP (`app/web/client.py`)
### Test Data
Example device graphs and experiment configs are in `unilabos/test/experiments/` (not `tests/`). Registry test fixtures in `unilabos/test/registry/`.
## Code Conventions
- Code comments and log messages in simplified Chinese
- Python 3.11+, type hints expected
- Pydantic models for data validation (`resource_tracker.py`)
- Singleton pattern via `@singleton` decorator (`utils/decorator.py`)
- Dynamic class loading via `utils/import_manager.py` — device classes resolved at runtime from registry YAML paths
- CLI argument dashes auto-converted to underscores for consistency
## Licensing
- Framework code: GPL-3.0
- Device drivers (`unilabos/devices/`): DP Technology Proprietary License — do not redistribute

View File

@@ -1,4 +1,14 @@
# Uni-Lab-OS
Please follow the rules defined in: ## 设备接入
@AGENTS.md 读取 `docs/ai_guides/add_device.md` 获取完整的自包含指南。
如果可以访问仓库,优先搜索 `unilabos/registry/devices/` 获取最新设备接口;
否则使用指南中内联的「现有设备接口快照」。
## 关键规则
- 动作方法的参数名是接口契约,不可重命名(如 `volume` 不能改为 `volume_ml`
- `status` 字符串必须与同类已有设备一致(如 `"Idle"` 不能改为 `"就绪"`
- `self.data` 必须在 `__init__` 中预填充所有属性字段
- 异步方法中使用 `await self._ros_node.sleep()`,禁止 `time.sleep()``asyncio.sleep()`

1100
docs/ai_guides/add_device.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,344 @@
# Uni-Lab-OS 设备接入 Agent — 提示词模板
> 本文件提供一套可直接复制使用的 Agent 系统提示词,以及各平台的配置说明。
> 提示词模板与 `add_device.md`(领域知识)配合使用,前者控制 Agent 行为,后者提供完整的技术细节。
---
## 系统提示词模板
以下内容可直接作为系统提示词 / Instructions / Custom Instructions 使用。`{{...}}` 标记的变量根据平台替换。
---
### 开始复制 ↓
```
你是 Uni-Lab-OS 设备接入专家。你的任务是帮助用户将新的实验室硬件设备接入 Uni-Lab-OS 系统。
你能做的事:
- 根据用户描述生成完整的设备驱动代码Python、注册表YAML和实验图文件JSON
- 解读用户提供的通信协议文档、SDK 代码、或口述的指令格式
- 诊断已有驱动代码的接口对齐问题
你不能做的事:
- 凭空猜测硬件私有通信指令(必须从用户提供的资料中获取)
- 替代真实硬件联调测试
## 知识来源
{{KNOWLEDGE_LOADING}}
## 工作流程
当用户要求接入新设备时,严格按以下流程执行。每个暂停点必须等待用户确认后再继续。
### 阶段 1设备画像交互
向用户收集以下三个信息,可以一次性提问:
1. **设备类别** — 属于以下哪一种?
- temperature温控、pump_and_valve泵阀、motor电机
- heaterstirrer加热搅拌、balance天平、sensor传感器
- liquid_handling液体处理、robot_arm机械臂、workstation工作站
- virtual虚拟设备、custom自定义
- 如果是 pump_and_valve进一步确认子类型注射泵 / 电磁阀 / 蠕动泵
2. **设备英文名称** — 用于文件名和类名(如 my_heater、runze_sy03b
3. **通信协议** — Serial(RS232/RS485) / Modbus RTU / Modbus TCP / TCP Socket / HTTP API / OPC UA / 无通信(虚拟)
⏸️ **暂停:等待用户回答后继续**
### 阶段 2指令协议收集交互
根据上一步确定的通信协议,引导用户提供指令信息:
- 如果用户有 **SDK/驱动代码**:请用户提供代码文件,你从中提取通信逻辑
- 如果用户有 **协议文档**请用户提供文档PDF/图片/文本),你从中解析指令格式
- 如果用户 **口头描述**:针对每个标准动作逐一确认硬件指令
- 如果是 **标准协议**Modbus 寄存器表、SCPI请用户提供寄存器/指令映射
- 如果是 **虚拟设备**:跳过此阶段
⏸️ **暂停:确认已获取足够的指令协议信息**
### 阶段 3确认摘要
在开始生成代码前,向用户展示你的理解摘要:
```
设备接入摘要:
- 设备名称:<name>
- 设备类别:<category><subtype>
- 通信协议:<protocol>
- 指令来源:<source>
- 将要实现的属性:<list>
- 将要实现的动作:<list>
- 同类已有设备:<existing>(将对齐其接口)
```
⏸️ **暂停:用户确认"没问题"后再生成代码**
### 阶段 4自动生成无需暂停
按以下顺序自动执行:
1. **对齐同类设备接口**(指南第四步)
- 查阅指南中的「现有设备接口快照」或搜索仓库注册表
- 确保所有已有设备的 status_types 和动作方法都被覆盖
- 参数名必须完全一致
2. **生成驱动代码** — `unilabos/devices/<category>/<name>.py`
3. **生成注册表** — `unilabos/registry/devices/<name>.yaml`(最小配置)
4. **生成图文件** — `unilabos/test/experiments/graph_example_<name>.json`
### 阶段 5验证输出
生成完成后,逐项检查对齐验证清单并展示结果:
```
对齐验证清单:
- [x] 所有动作方法的参数名与已有设备完全一致
- [x] status 属性返回的字符串值与已有设备一致
- [x] 已有设备的所有 status_types 字段都有对应 @property
- [x] 已有设备的所有非 auto- 前缀的 action 都有对应方法
- [x] self.data 在 __init__ 中已预填充所有属性字段的默认值
- [x] 串口/二进制协议的响应解析先定位帧起始标记
```
如果有未通过的项,主动修复后再展示。
## 硬约束(违反任何一条都会导致设备接入失败)
1. **禁止重命名参数** — 动作方法的参数名(如 volume、position、max_velocity是接口契约框架通过参数名分派调用。绝不能加后缀如 volume_ml、改名如 speed_ml_s。单位写在 docstring 中。
2. **status 字符串必须一致** — 如果同类已有设备用英文(如 "Idle" / "Busy"),新驱动必须用相同的字符串,不能改为中文(如 "就绪")。
3. **self.data 必须预填充** — 不能用空字典 {}。框架在 initialize() 之前就可能读取属性值。每个 @property 对应的键都必须在 __init__ 中有初始值。
4. **禁止跳过接口对齐** — 对齐同类设备接口是强制步骤。缺失的属性和动作会导致设备在工作流中不可互换。
5. **串口解析先找帧头** — RS-485 总线上响应前常有回声/噪声字节。必须先定位帧起始标记(如 /、0xFE禁止用硬编码索引直接解析。
6. **异步等待用 _ros_node.sleep** — 在 async 方法中使用 await self._ros_node.sleep(),禁止 time.sleep()(阻塞事件循环)和 asyncio.sleep()。
7. **物理单位对外暴露** — 对外参数使用用户友好的物理单位mL、°C、RPM驱动内部负责转换到硬件原始值步数、Hz、寄存器值
## 代码骨架参考
所有设备驱动遵循以下结构:
```python
import logging
import time as time_module
from typing import Dict, Any
try:
from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode
except ImportError:
BaseROS2DeviceNode = None
class MyDevice:
_ros_node: "BaseROS2DeviceNode"
def __init__(self, device_id: str = None, config: Dict[str, Any] = None, **kwargs):
if device_id is None and 'id' in kwargs:
device_id = kwargs.pop('id')
if config is None and 'config' in kwargs:
config = kwargs.pop('config')
self.device_id = device_id or "unknown_device"
self.config = config or {}
self.logger = logging.getLogger(f"MyDevice.{self.device_id}")
self.data = {
"status": "Idle",
# 所有 @property 的键都必须在此预填充
}
def post_init(self, ros_node: "BaseROS2DeviceNode"):
self._ros_node = ros_node
async def initialize(self) -> bool:
self.data["status"] = "Idle"
return True
async def cleanup(self) -> bool:
self.data["status"] = "Offline"
return True
@property
def status(self) -> str:
return self.data.get("status", "Idle")
```
## 注册表最小配置
```yaml
my_device:
class:
module: unilabos.devices.<category>.<file>:MyDevice
type: python
```
启动时 --complete_registry 自动生成 status_types 和 action_value_mappings。
## 图文件模板
```json
{
"nodes": [
{
"id": "my_device_1",
"name": "设备名称",
"children": [],
"parent": null,
"type": "device",
"class": "my_device",
"position": {"x": 0, "y": 0, "z": 0},
"config": {},
"data": {}
}
]
}
```
## 现有设备接口快照(对齐用)
对齐时参考以下已有设备接口。如果能联网,优先从 GitHub 获取最新版本:
https://github.com/dptech-corp/Uni-Lab-OS/tree/main/unilabos/registry/devices/
### pump_and_valve — 注射泵
已有设备syringe_pump_with_valve.runze.SY03B-T06
属性status(str, "Idle"/"Busy"), valve_position(str), position(float, mL), max_velocity(float, mL/s), mode(int), plunger_position(String), velocity_grade(String), velocity_init(String), velocity_end(String)
方法签名(参数名不可改):
- initialize()
- set_valve_position(position)
- set_position(position: float, max_velocity: float = None)
- pull_plunger(volume: float)
- push_plunger(volume: float)
- set_max_velocity(velocity: float)
- set_velocity_grade(velocity)
- stop_operation()
### pump_and_valve — 电磁阀
属性status(str), valve_position(str)
方法open(), close(), set_valve_position(position), is_open(), is_closed()
### temperature
属性status(str), temp(float, °C), temp_target(float, °C), stir_speed(float, RPM), temp_warning(float, °C)
### motor
属性status(str), position(int)
### sensor
属性level(bool), rssi(int)
```
### 结束复制 ↑
---
## `{{KNOWLEDGE_LOADING}}` 变量替换
根据平台能力,将提示词中的 `{{KNOWLEDGE_LOADING}}` 替换为以下对应内容:
### 方案 A有知识库Custom GPT / Claude Project
```
你的知识库中包含 add_device.md 文件,这是完整的设备接入指南。
执行工作流时,参考该文件获取物模型模板、通信协议代码片段、指令协议模式和常见错误检查清单。
本提示词中的「现有设备接口快照」和「硬约束」是从指南中提炼的关键内容,以确保即使知识库检索不完整也能正确工作。
```
### 方案 B有联网能力
```
执行工作流前,从以下 URL 获取完整的设备接入指南:
https://raw.githubusercontent.com/dptech-corp/Uni-Lab-OS/main/docs/ai_guides/add_device.md
该指南包含物模型模板、通信协议代码片段、指令协议模式和常见错误检查清单。
如果无法访问 URL使用本提示词中内联的「现有设备接口快照」和「代码骨架参考」作为兜底。
```
### 方案 C无知识库、无联网
```
完整的设备接入指南需要用户在对话中提供。
如果用户未主动提供,请在阶段 1 开始前询问:
"请将 add_device.md 的内容粘贴到对话中,或上传该文件。如果没有该文件,我将使用内置的精简规则工作。"
本提示词已内联了最关键的内容(硬约束 + 代码骨架 + 接口快照),足以生成基本正确的驱动。
但完整指南包含更多物模型模板和通信协议代码片段,能显著提升生成质量。
```
---
## 各平台配置指南
### OpenAI Custom GPT
1. 进入 https://chat.openai.com/gpts/editor
2. **Name**Uni-Lab-OS 设备接入助手
3. **Description**:帮助用户将实验室硬件设备接入 Uni-Lab-OS 系统,自动生成驱动代码、注册表和图文件。
4. **Instructions**:粘贴上方系统提示词,`{{KNOWLEDGE_LOADING}}` 替换为方案 A
5. **Knowledge**:上传 `docs/ai_guides/add_device.md`
6. **Capabilities**:开启 Code Interpreter用于代码验证
7. **Conversation starters**
- "我要接入一个新的注射泵"
- "帮我把这个 SDK 包装成 UniLab 驱动"
- "检查我的设备驱动有没有接口问题"
### Claude Project
1. 创建新 Project
2. **Custom Instructions**:粘贴系统提示词,`{{KNOWLEDGE_LOADING}}` 替换为方案 A
3. **Project Knowledge**:上传 `docs/ai_guides/add_device.md`
### API AgentLangChain / AutoGen / 自建框架)
```python
system_prompt = """
<粘贴完整系统提示词,{{KNOWLEDGE_LOADING}} 替换为方案 B>
"""
# 如果框架支持工具调用,可注册以下工具:
tools = [
{
"name": "fetch_device_guide",
"description": "获取最新的 Uni-Lab-OS 设备接入指南",
"url": "https://raw.githubusercontent.com/dptech-corp/Uni-Lab-OS/main/docs/ai_guides/add_device.md"
},
{
"name": "fetch_registry",
"description": "获取最新的设备注册表",
"url": "https://raw.githubusercontent.com/dptech-corp/Uni-Lab-OS/main/unilabos/registry/devices/{category}.yaml"
},
]
```
### Cursor Agent Mode
无需使用本模板。Cursor 中使用已有的 `.cursor/skills/add-device/SKILL.md`,它会自动读取 `docs/ai_guides/add_device.md` 并利用 Cursor 的工具能力Grep 搜索注册表、AskQuestion 收集信息等)。
### 纯网页对话ChatGPT / Claude 无 Project
1. 第一条消息粘贴系统提示词(`{{KNOWLEDGE_LOADING}}` 替换为方案 C
2. 第二条消息上传或粘贴 `add_device.md`
3. 第三条消息开始描述设备
---
## 维护说明
- **硬约束更新**:如果 `add_device.md` 中新增了禁止事项或常见错误,需要同步更新本模板的「硬约束」部分
- **接口快照更新**:新增设备类别或已有设备接口变更时,需要同步更新本模板的「现有设备接口快照」部分
- **工作流调整**:如果接入流程发生变化(新增步骤、合并步骤),需要同步调整「工作流程」部分
- 本模板与 `add_device.md` 是**互补关系**:模板定义 Agent 行为,指南提供领域知识。两者独立维护

View File

@@ -15,9 +15,6 @@ Python 类设备驱动在完成注册表后可以直接在 Uni-Lab 中使用,
**示例:** **示例:**
```python ```python
from unilabos.registry.decorators import device, topic_config
@device(id="mock_gripper", category=["gripper"], description="Mock Gripper")
class MockGripper: class MockGripper:
def __init__(self): def __init__(self):
self._position: float = 0.0 self._position: float = 0.0
@@ -26,23 +23,19 @@ class MockGripper:
self._status = "Idle" self._status = "Idle"
@property @property
@topic_config() # 添加 @topic_config 才会定时广播
def position(self) -> float: def position(self) -> float:
return self._position return self._position
@property @property
@topic_config()
def velocity(self) -> float: def velocity(self) -> float:
return self._velocity return self._velocity
@property @property
@topic_config()
def torque(self) -> float: def torque(self) -> float:
return self._torque return self._torque
# 使用 @topic_config 装饰的属性,接入 Uni-Lab 时会定时对外广播 # 会被自动识别的设备属性,接入 Uni-Lab 时会定时对外广播
@property @property
@topic_config(period=2.0) # 可自定义发布周期
def status(self) -> str: def status(self) -> str:
return self._status return self._status
@@ -156,7 +149,7 @@ my_device: # 设备唯一标识符
系统会自动分析您的 Python 驱动类并生成: 系统会自动分析您的 Python 驱动类并生成:
- `status_types`:从 `@topic_config` 装饰的 `@property` 方法自动识别状态属性 - `status_types`:从 `@property` 装饰的方法自动识别状态属性
- `action_value_mappings`:从类方法自动生成动作映射 - `action_value_mappings`:从类方法自动生成动作映射
- `init_param_schema`:从 `__init__` 方法分析初始化参数 - `init_param_schema`:从 `__init__` 方法分析初始化参数
- `schema`:前端显示用的属性类型定义 - `schema`:前端显示用的属性类型定义
@@ -186,9 +179,7 @@ Uni-Lab 设备驱动是一个 Python 类,需要遵循以下结构:
```python ```python
from typing import Dict, Any from typing import Dict, Any
from unilabos.registry.decorators import device, topic_config
@device(id="my_device", category=["general"], description="My Device")
class MyDevice: class MyDevice:
"""设备类文档字符串 """设备类文档字符串
@@ -207,9 +198,8 @@ class MyDevice:
# 初始化硬件连接 # 初始化硬件连接
@property @property
@topic_config() # 必须添加 @topic_config 才会广播
def status(self) -> str: def status(self) -> str:
"""设备状态(通过 @topic_config 广播)""" """设备状态(会自动广播)"""
return self._status return self._status
def my_action(self, param: float) -> Dict[str, Any]: def my_action(self, param: float) -> Dict[str, Any]:
@@ -227,61 +217,34 @@ class MyDevice:
## 状态属性 vs 动作方法 ## 状态属性 vs 动作方法
### 状态属性(@property + @topic_config ### 状态属性(@property
状态属性需要同时使用 `@property``@topic_config` 装饰器才会被识别并定期广播: 状态属性会被自动识别并定期广播:
```python ```python
from unilabos.registry.decorators import topic_config
@property @property
@topic_config() # 必须添加,否则不会广播
def temperature(self) -> float: def temperature(self) -> float:
"""当前温度""" """当前温度"""
return self._read_temperature() return self._read_temperature()
@property @property
@topic_config(period=2.0) # 可自定义发布周期(秒)
def status(self) -> str: def status(self) -> str:
"""设备状态: idle, running, error""" """设备状态: idle, running, error"""
return self._status return self._status
@property @property
@topic_config(name="ready") # 可自定义发布名称
def is_ready(self) -> bool: def is_ready(self) -> bool:
"""设备是否就绪""" """设备是否就绪"""
return self._status == "idle" return self._status == "idle"
``` ```
也可以使用普通方法(非 @property)配合 `@topic_config`
```python
@topic_config(period=10.0)
def get_sensor_data(self) -> Dict[str, float]:
"""获取传感器数据get_ 前缀会自动去除,发布名为 sensor_data"""
return {"temp": self._temp, "humidity": self._humidity}
```
**`@topic_config` 参数**:
| 参数 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `period` | float | 5.0 | 发布周期(秒) |
| `print_publish` | bool | 节点默认 | 是否打印发布日志 |
| `qos` | int | 10 | QoS 深度 |
| `name` | str | None | 自定义发布名称 |
**发布名称优先级**`@topic_config(name=...)` > `get_` 前缀去除 > 方法名
**特点**: **特点**:
- 必须使用 `@topic_config` 装饰器 - 使用`@property`装饰器
- 支持 `@property` 和普通方法 - 只读,不能有参数
- 添加到注册表的 `status_types` - 自动添加到注册表的`status_types`
- 定期发布到 ROS2 topic - 定期发布到 ROS2 topic
> **⚠️ 重要:** 仅有 `@property` 装饰器而没有 `@topic_config` 的属性**不会**被广播。这是一个 Breaking Change。
### 动作方法 ### 动作方法
动作方法是设备可以执行的操作: 动作方法是设备可以执行的操作:
@@ -534,7 +497,6 @@ class LiquidHandler:
self._status = "idle" self._status = "idle"
@property @property
@topic_config()
def status(self) -> str: def status(self) -> str:
return self._status return self._status
@@ -924,52 +886,7 @@ class MyDevice:
## 最佳实践 ## 最佳实践
### 1. 使用 `@device` 装饰器标识设备 ### 1. 类型注解
```python
from unilabos.registry.decorators import device
@device(id="my_device", category=["heating"], description="My Heating Device", icon="heater.webp")
class MyDevice:
...
```
- `id`:设备唯一标识符,用于注册表匹配
- `category`:分类列表,前端用于分组显示
- `description`:设备描述
- `icon`:图标文件名(可选)
### 2. 使用 `@topic_config` 声明需要广播的状态
```python
from unilabos.registry.decorators import topic_config
# ✓ @property + @topic_config → 会广播
@property
@topic_config(period=2.0)
def temperature(self) -> float:
return self._temp
# ✓ 普通方法 + @topic_config → 会广播get_ 前缀自动去除)
@topic_config(period=10.0)
def get_sensor_data(self) -> Dict[str, float]:
return {"temp": self._temp}
# ✓ 使用 name 参数自定义发布名称
@property
@topic_config(name="ready")
def is_ready(self) -> bool:
return self._status == "idle"
# ✗ 仅有 @property没有 @topic_config → 不会广播
@property
def internal_state(self) -> str:
return self._state
```
> **注意:** 与 `@property` 连用时,`@topic_config` 必须放在 `@property` 下面。
### 3. 类型注解
```python ```python
from typing import Dict, Any, Optional, List from typing import Dict, Any, Optional, List
@@ -984,7 +901,7 @@ def method(
pass pass
``` ```
### 4. 文档字符串 ### 2. 文档字符串
```python ```python
def method(self, param: float) -> Dict[str, Any]: def method(self, param: float) -> Dict[str, Any]:
@@ -1006,7 +923,7 @@ def method(self, param: float) -> Dict[str, Any]:
pass pass
``` ```
### 5. 配置验证 ### 3. 配置验证
```python ```python
def __init__(self, config: Dict[str, Any]): def __init__(self, config: Dict[str, Any]):
@@ -1020,7 +937,7 @@ def __init__(self, config: Dict[str, Any]):
self.baudrate = config['baudrate'] self.baudrate = config['baudrate']
``` ```
### 6. 资源清理 ### 4. 资源清理
```python ```python
def __del__(self): def __del__(self):
@@ -1029,7 +946,7 @@ def __del__(self):
self.connection.close() self.connection.close()
``` ```
### 7. 设计前端友好的返回值 ### 5. 设计前端友好的返回值
**记住:返回值会直接显示在 Web 界面** **记住:返回值会直接显示在 Web 界面**

View File

@@ -422,20 +422,18 @@ placeholder_keys:
### status_types ### status_types
系统会扫描你的 Python 类,从带有 `@topic_config` 装饰器的 `@property`方法自动生成这部分: 系统会扫描你的 Python 类,从状态方法property 或 get\_方法自动生成这部分:
```yaml ```yaml
status_types: status_types:
current_temperature: float # 从 @topic_config 装饰的 @property 或方法 current_temperature: float # 从 get_current_temperature() 或 @property current_temperature
is_heating: bool is_heating: bool # 从 get_is_heating() 或 @property is_heating
status: str status: str # 从 get_status() 或 @property status
``` ```
**注意事项** **注意事项**
- 仅有带 `@topic_config` 装饰器的 `@property` 或方法才会被识别为状态属性 - 系统会查找所有 `get_` 开头的方法和 `@property` 装饰的属性
- 没有 `@topic_config``@property` 不会生成 status_types也不会广播
- `get_` 前缀的方法名会自动去除前缀(如 `get_temperature``temperature`
- 类型会自动转成相应的类型(如 `str``float``bool` - 类型会自动转成相应的类型(如 `str``float``bool`
- 如果类型是 `Any``None` 或未知的,默认使用 `String` - 如果类型是 `Any``None` 或未知的,默认使用 `String`
@@ -539,13 +537,11 @@ class AdvancedLiquidHandler:
self._temperature = 25.0 self._temperature = 25.0
@property @property
@topic_config()
def status(self) -> str: def status(self) -> str:
"""设备状态""" """设备状态"""
return self._status return self._status
@property @property
@topic_config()
def temperature(self) -> float: def temperature(self) -> float:
"""当前温度""" """当前温度"""
return self._temperature return self._temperature
@@ -813,23 +809,21 @@ my_temperature_controller:
你的设备类需要符合以下要求: 你的设备类需要符合以下要求:
```python ```python
from unilabos.registry.decorators import device, topic_config from unilabos.common.device_base import DeviceBase
@device(id="my_device", category=["temperature"], description="My Device") class MyDevice(DeviceBase):
class MyDevice:
def __init__(self, config): def __init__(self, config):
"""初始化,参数会自动分析到 init_param_schema.config""" """初始化,参数会自动分析到 init_param_schema.config"""
super().__init__(config)
self.port = config.get('port', '/dev/ttyUSB0') self.port = config.get('port', '/dev/ttyUSB0')
# 状态方法(必须添加 @topic_config 才会生成到 status_types 并广播 # 状态方法(会自动生成到 status_types
@property @property
@topic_config()
def status(self): def status(self):
"""返回设备状态""" """返回设备状态"""
return "idle" return "idle"
@property @property
@topic_config()
def temperature(self): def temperature(self):
"""返回当前温度""" """返回当前温度"""
return 25.0 return 25.0
@@ -1045,34 +1039,7 @@ resource.type # "resource"
### 代码规范 ### 代码规范
1. **使用 `@device` 装饰器标识设备类** 1. **始终使用类型注解**
```python
from unilabos.registry.decorators import device
@device(id="my_device", category=["heating"], description="My Device")
class MyDevice:
...
```
2. **使用 `@topic_config` 声明广播属性**
```python
from unilabos.registry.decorators import topic_config
# ✓ 需要广播的状态属性
@property
@topic_config(period=2.0)
def temperature(self) -> float:
return self._temp
# ✗ 仅有 @property 不会广播
@property
def internal_counter(self) -> int:
return self._counter
```
3. **始终使用类型注解**
```python ```python
# ✓ 好 # ✓ 好
@@ -1084,7 +1051,7 @@ def method(self, resource, device):
pass pass
``` ```
4. **提供有意义的参数名** 2. **提供有意义的参数名**
```python ```python
# ✓ 好 - 清晰的参数名 # ✓ 好 - 清晰的参数名
@@ -1096,7 +1063,7 @@ def transfer(self, r1: ResourceSlot, r2: ResourceSlot):
pass pass
``` ```
5. **使用 Optional 表示可选参数** 3. **使用 Optional 表示可选参数**
```python ```python
from typing import Optional from typing import Optional
@@ -1109,7 +1076,7 @@ def method(
pass pass
``` ```
6. **添加详细的文档字符串** 4. **添加详细的文档字符串**
```python ```python
def method( def method(
@@ -1129,13 +1096,13 @@ def method(
pass pass
``` ```
7. **方法命名规范** 5. **方法命名规范**
- 状态方法使用 `@property` + `@topic_config` 装饰器,或普通方法 + `@topic_config` - 状态方法使用 `@property` 装饰器或 `get_` 前缀
- 动作方法使用动词开头 - 动作方法使用动词开头
- 保持命名清晰、一致 - 保持命名清晰、一致
8. **完善的错误处理** 6. **完善的错误处理**
- 实现完善的错误处理 - 实现完善的错误处理
- 添加日志记录 - 添加日志记录
- 提供有意义的错误信息 - 提供有意义的错误信息

View File

@@ -221,10 +221,10 @@ Laboratory A Laboratory B
```bash ```bash
# 实验室A # 实验室A
unilab --ak your_ak --sk your_sk --upload_registry unilab --ak your_ak --sk your_sk --upload_registry --use_remote_resource
# 实验室B # 实验室B
unilab --ak your_ak --sk your_sk --upload_registry unilab --ak your_ak --sk your_sk --upload_registry --use_remote_resource
``` ```
--- ---

View File

@@ -22,6 +22,7 @@ options:
--is_slave Run the backend as slave node (without host privileges). --is_slave Run the backend as slave node (without host privileges).
--slave_no_host Skip waiting for host service in slave mode --slave_no_host Skip waiting for host service in slave mode
--upload_registry Upload registry information when starting unilab --upload_registry Upload registry information when starting unilab
--use_remote_resource Use remote resources when starting unilab
--config CONFIG Configuration file path, supports .py format Python config files --config CONFIG Configuration file path, supports .py format Python config files
--port PORT Port for web service information page --port PORT Port for web service information page
--disable_browser Disable opening information page on startup --disable_browser Disable opening information page on startup
@@ -84,7 +85,7 @@ Uni-Lab 的启动过程分为以下几个阶段:
支持两种方式: 支持两种方式:
- **本地文件**:使用 `-g` 指定图谱文件(支持 JSON 和 GraphML 格式) - **本地文件**:使用 `-g` 指定图谱文件(支持 JSON 和 GraphML 格式)
- **远程资源**不指定本地文件即可 - **远程资源**使用 `--use_remote_resource` 从云端获取
### 7. 注册表构建 ### 7. 注册表构建
@@ -195,7 +196,7 @@ unilab --config path/to/your/config.py
unilab --ak your_ak --sk your_sk -g path/to/graph.json --upload_registry unilab --ak your_ak --sk your_sk -g path/to/graph.json --upload_registry
# 使用远程资源启动 # 使用远程资源启动
unilab --ak your_ak --sk your_sk unilab --ak your_ak --sk your_sk --use_remote_resource
# 更新注册表 # 更新注册表
unilab --ak your_ak --sk your_sk --complete_registry unilab --ak your_ak --sk your_sk --complete_registry

View File

@@ -1,6 +1,6 @@
package: package:
name: ros-humble-unilabos-msgs name: ros-humble-unilabos-msgs
version: 0.10.19 version: 0.10.18
source: source:
path: ../../unilabos_msgs path: ../../unilabos_msgs
target_directory: src target_directory: src

View File

@@ -1,6 +1,6 @@
package: package:
name: unilabos name: unilabos
version: "0.10.19" version: "0.10.18"
source: source:
path: ../.. path: ../..

View File

@@ -4,7 +4,7 @@ package_name = 'unilabos'
setup( setup(
name=package_name, name=package_name,
version='0.10.19', version='0.10.18',
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
install_requires=['setuptools'], install_requires=['setuptools'],

View File

@@ -1 +1 @@
__version__ = "0.10.19" __version__ = "0.10.18"

View File

@@ -4,7 +4,6 @@ import os
import platform import platform
import shutil import shutil
import signal import signal
import subprocess
import sys import sys
import threading import threading
import time import time
@@ -26,84 +25,6 @@ from unilabos.config.config import load_config, BasicConfig, HTTPConfig
_restart_requested: bool = False _restart_requested: bool = False
_restart_reason: str = "" _restart_reason: str = ""
RESTART_EXIT_CODE = 42
def _build_child_argv():
"""Build sys.argv for child process, stripping supervisor-only arguments."""
result = []
skip_next = False
for arg in sys.argv:
if skip_next:
skip_next = False
continue
if arg in ("--restart_mode", "--restart-mode"):
continue
if arg in ("--auto_restart_count", "--auto-restart-count"):
skip_next = True
continue
if arg.startswith("--auto_restart_count=") or arg.startswith("--auto-restart-count="):
continue
result.append(arg)
return result
def _run_as_supervisor(max_restarts: int):
"""
Supervisor process that spawns and monitors child processes.
Similar to Uvicorn's --reload: the supervisor itself does no heavy work,
it only launches the real process as a child and restarts it when the child
exits with RESTART_EXIT_CODE.
"""
child_argv = [sys.executable] + _build_child_argv()
restart_count = 0
print_status(
f"[Supervisor] Restart mode enabled (max restarts: {max_restarts}), "
f"child command: {' '.join(child_argv)}",
"info",
)
while True:
print_status(
f"[Supervisor] Launching process (restart {restart_count}/{max_restarts})...",
"info",
)
try:
process = subprocess.Popen(child_argv)
exit_code = process.wait()
except KeyboardInterrupt:
print_status("[Supervisor] Interrupted, terminating child process...", "info")
process.terminate()
try:
process.wait(timeout=10)
except subprocess.TimeoutExpired:
process.kill()
process.wait()
sys.exit(1)
if exit_code == RESTART_EXIT_CODE:
restart_count += 1
if restart_count > max_restarts:
print_status(
f"[Supervisor] Maximum restart count ({max_restarts}) reached, exiting",
"warning",
)
sys.exit(1)
print_status(
f"[Supervisor] Child requested restart ({restart_count}/{max_restarts}), restarting in 2s...",
"info",
)
time.sleep(2)
else:
if exit_code != 0:
print_status(f"[Supervisor] Child exited with code {exit_code}", "warning")
else:
print_status("[Supervisor] Child exited normally", "info")
sys.exit(exit_code)
def load_config_from_file(config_path): def load_config_from_file(config_path):
if config_path is None: if config_path is None:
@@ -145,13 +66,6 @@ def parse_args():
action="append", action="append",
help="Path to the registry directory", help="Path to the registry directory",
) )
parser.add_argument(
"--devices",
type=str,
default=None,
action="append",
help="Path to Python code directory for AST-based device/resource scanning",
)
parser.add_argument( parser.add_argument(
"--working_dir", "--working_dir",
type=str, type=str,
@@ -241,18 +155,18 @@ def parse_args():
action="store_true", action="store_true",
help="Skip environment dependency check on startup", help="Skip environment dependency check on startup",
) )
parser.add_argument(
"--complete_registry",
action="store_true",
default=False,
help="Complete registry information",
)
parser.add_argument( parser.add_argument(
"--check_mode", "--check_mode",
action="store_true", action="store_true",
default=False, default=False,
help="Run in check mode for CI: validates registry imports and ensures no file changes", help="Run in check mode for CI: validates registry imports and ensures no file changes",
) )
parser.add_argument(
"--complete_registry",
action="store_true",
default=False,
help="Complete and rewrite YAML registry files using AST analysis results",
)
parser.add_argument( parser.add_argument(
"--no_update_feedback", "--no_update_feedback",
action="store_true", action="store_true",
@@ -264,24 +178,6 @@ def parse_args():
default=False, default=False,
help="Test mode: all actions simulate execution and return mock results without running real hardware", help="Test mode: all actions simulate execution and return mock results without running real hardware",
) )
parser.add_argument(
"--extra_resource",
action="store_true",
default=False,
help="Load extra lab_ prefixed labware resources (529 auto-generated definitions from lab_resources.py)",
)
parser.add_argument(
"--restart_mode",
action="store_true",
default=False,
help="Enable supervisor mode: automatically restart the process when triggered via WebSocket",
)
parser.add_argument(
"--auto_restart_count",
type=int,
default=500,
help="Maximum number of automatic restarts in restart mode (default: 500)",
)
# workflow upload subcommand # workflow upload subcommand
workflow_parser = subparsers.add_parser( workflow_parser = subparsers.add_parser(
"workflow_upload", "workflow_upload",
@@ -332,11 +228,6 @@ def main():
args = parser.parse_args() args = parser.parse_args()
args_dict = vars(args) args_dict = vars(args)
# Supervisor mode: spawn child processes and monitor for restart
if args_dict.get("restart_mode", False):
_run_as_supervisor(args_dict.get("auto_restart_count", 5))
return
# 环境检查 - 检查并自动安装必需的包 (可选) # 环境检查 - 检查并自动安装必需的包 (可选)
skip_env_check = args_dict.get("skip_env_check", False) skip_env_check = args_dict.get("skip_env_check", False)
check_mode = args_dict.get("check_mode", False) check_mode = args_dict.get("check_mode", False)
@@ -467,9 +358,6 @@ def main():
BasicConfig.test_mode = args_dict.get("test_mode", False) BasicConfig.test_mode = args_dict.get("test_mode", False)
if BasicConfig.test_mode: if BasicConfig.test_mode:
print_status("启用测试模式:所有动作将模拟执行,不调用真实硬件", "warning") print_status("启用测试模式:所有动作将模拟执行,不调用真实硬件", "warning")
BasicConfig.extra_resource = args_dict.get("extra_resource", False)
if BasicConfig.extra_resource:
print_status("启用额外资源加载将加载lab_开头的labware资源定义", "info")
BasicConfig.communication_protocol = "websocket" BasicConfig.communication_protocol = "websocket"
machine_name = platform.node() machine_name = platform.node()
machine_name = "".join([c if c.isalnum() or c == "_" else "_" for c in machine_name]) machine_name = "".join([c if c.isalnum() or c == "_" else "_" for c in machine_name])
@@ -494,32 +382,22 @@ def main():
# 显示启动横幅 # 显示启动横幅
print_unilab_banner(args_dict) print_unilab_banner(args_dict)
# Step 0: AST 分析优先 + YAML 注册表加载 # 注册表 - check_mode 时强制启用 complete_registry
# check_mode 和 upload_registry 都会执行实际 import 验证
devices_dirs = args_dict.get("devices", None)
complete_registry = args_dict.get("complete_registry", False) or check_mode complete_registry = args_dict.get("complete_registry", False) or check_mode
lab_registry = build_registry( lab_registry = build_registry(args_dict["registry_path"], complete_registry, BasicConfig.upload_registry)
registry_paths=args_dict["registry_path"],
devices_dirs=devices_dirs,
upload_registry=BasicConfig.upload_registry,
check_mode=check_mode,
complete_registry=complete_registry,
)
# Check mode: 注册表验证完成后直接退出 # Check mode: complete_registry 完成后直接退出git diff 检测由 CI workflow 执行
if check_mode: if check_mode:
device_count = len(lab_registry.device_type_registry) print_status("Check mode: complete_registry 完成,退出", "info")
resource_count = len(lab_registry.resource_type_registry)
print_status(f"Check mode: 注册表验证完成 ({device_count} 设备, {resource_count} 资源),退出", "info")
os._exit(0) os._exit(0)
# Step 1: 上传全部注册表到服务端,同步保存到 unilabos_data
if BasicConfig.upload_registry: if BasicConfig.upload_registry:
# 设备注册到服务端 - 需要 ak 和 sk
if BasicConfig.ak and BasicConfig.sk: if BasicConfig.ak and BasicConfig.sk:
# print_status("开始注册设备到服务端...", "info") print_status("开始注册设备到服务端...", "info")
try: try:
register_devices_and_resources(lab_registry) register_devices_and_resources(lab_registry)
# print_status("设备注册完成", "info") print_status("设备注册完成", "info")
except Exception as e: except Exception as e:
print_status(f"设备注册失败: {e}", "error") print_status(f"设备注册失败: {e}", "error")
else: else:
@@ -604,7 +482,7 @@ def main():
continue continue
# 如果从远端获取了物料信息,则与本地物料进行同步 # 如果从远端获取了物料信息,则与本地物料进行同步
if file_path is not None and request_startup_json and "nodes" in request_startup_json: if request_startup_json and "nodes" in request_startup_json:
print_status("开始同步远端物料到本地...", "info") print_status("开始同步远端物料到本地...", "info")
remote_tree_set = ResourceTreeSet.from_raw_dict_list(request_startup_json["nodes"]) remote_tree_set = ResourceTreeSet.from_raw_dict_list(request_startup_json["nodes"])
resource_tree_set.merge_remote_resources(remote_tree_set) resource_tree_set.merge_remote_resources(remote_tree_set)
@@ -701,10 +579,6 @@ def main():
open_browser=not args_dict["disable_browser"], open_browser=not args_dict["disable_browser"],
port=BasicConfig.port, port=BasicConfig.port,
) )
if restart_requested:
print_status("[Main] Restart requested, cleaning up...", "info")
cleanup_for_restart()
os._exit(RESTART_EXIT_CODE)
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -1,8 +1,9 @@
import json
import time import time
from typing import Any, Dict, Optional, Tuple from typing import Optional, Tuple, Dict, Any
from unilabos.utils.log import logger from unilabos.utils.log import logger
from unilabos.utils.tools import normalize_json as _normalize_device from unilabos.utils.type_check import TypeEncoder
def register_devices_and_resources(lab_registry, gather_only=False) -> Optional[Tuple[Dict[str, Any], Dict[str, Any]]]: def register_devices_and_resources(lab_registry, gather_only=False) -> Optional[Tuple[Dict[str, Any], Dict[str, Any]]]:
@@ -10,63 +11,50 @@ def register_devices_and_resources(lab_registry, gather_only=False) -> Optional[
注册设备和资源到服务器仅支持HTTP 注册设备和资源到服务器仅支持HTTP
""" """
# 注册资源信息 - 使用HTTP方式
from unilabos.app.web.client import http_client from unilabos.app.web.client import http_client
logger.info("[UniLab Register] 开始注册设备和资源...") logger.info("[UniLab Register] 开始注册设备和资源...")
# 注册设备信息
devices_to_register = {} devices_to_register = {}
for device_info in lab_registry.obtain_registry_device_info(): for device_info in lab_registry.obtain_registry_device_info():
devices_to_register[device_info["id"]] = _normalize_device(device_info) devices_to_register[device_info["id"]] = json.loads(
logger.trace(f"[UniLab Register] 收集设备: {device_info['id']}") json.dumps(device_info, ensure_ascii=False, cls=TypeEncoder)
)
logger.debug(f"[UniLab Register] 收集设备: {device_info['id']}")
resources_to_register = {} resources_to_register = {}
for resource_info in lab_registry.obtain_registry_resource_info(): for resource_info in lab_registry.obtain_registry_resource_info():
resources_to_register[resource_info["id"]] = resource_info resources_to_register[resource_info["id"]] = resource_info
logger.trace(f"[UniLab Register] 收集资源: {resource_info['id']}") logger.debug(f"[UniLab Register] 收集资源: {resource_info['id']}")
if gather_only: if gather_only:
return devices_to_register, resources_to_register return devices_to_register, resources_to_register
# 注册设备
if devices_to_register: if devices_to_register:
try: try:
start_time = time.time() start_time = time.time()
response = http_client.resource_registry( response = http_client.resource_registry({"resources": list(devices_to_register.values())})
{"resources": list(devices_to_register.values())},
tag="device_registry",
)
cost_time = time.time() - start_time cost_time = time.time() - start_time
res_data = response.json() if response.status_code == 200 else {} if response.status_code in [200, 201]:
skipped = res_data.get("data", {}).get("skipped", False) logger.info(f"[UniLab Register] 成功注册 {len(devices_to_register)} 个设备 {cost_time}s")
if skipped:
logger.info(
f"[UniLab Register] 设备注册跳过(内容未变化)"
f" {len(devices_to_register)}{cost_time:.3f}s"
)
elif response.status_code in [200, 201]:
logger.info(f"[UniLab Register] 成功注册 {len(devices_to_register)} 个设备 {cost_time:.3f}s")
else: else:
logger.error(f"[UniLab Register] 设备注册失败: {response.status_code}, {response.text} {cost_time:.3f}s") logger.error(f"[UniLab Register] 设备注册失败: {response.status_code}, {response.text} {cost_time}s")
except Exception as e: except Exception as e:
logger.error(f"[UniLab Register] 设备注册异常: {e}") logger.error(f"[UniLab Register] 设备注册异常: {e}")
# 注册资源
if resources_to_register: if resources_to_register:
try: try:
start_time = time.time() start_time = time.time()
response = http_client.resource_registry( response = http_client.resource_registry({"resources": list(resources_to_register.values())})
{"resources": list(resources_to_register.values())},
tag="resource_registry",
)
cost_time = time.time() - start_time cost_time = time.time() - start_time
res_data = response.json() if response.status_code == 200 else {} if response.status_code in [200, 201]:
skipped = res_data.get("data", {}).get("skipped", False) logger.info(f"[UniLab Register] 成功注册 {len(resources_to_register)} 个资源 {cost_time}s")
if skipped:
logger.info(
f"[UniLab Register] 资源注册跳过(内容未变化)"
f" {len(resources_to_register)}{cost_time:.3f}s"
)
elif response.status_code in [200, 201]:
logger.info(f"[UniLab Register] 成功注册 {len(resources_to_register)} 个资源 {cost_time:.3f}s")
else: else:
logger.error(f"[UniLab Register] 资源注册失败: {response.status_code}, {response.text} {cost_time:.3f}s") logger.error(f"[UniLab Register] 资源注册失败: {response.status_code}, {response.text} {cost_time}s")
except Exception as e: except Exception as e:
logger.error(f"[UniLab Register] 资源注册异常: {e}") logger.error(f"[UniLab Register] 资源注册异常: {e}")
logger.info("[UniLab Register] 设备和资源注册完成.")

View File

@@ -1052,7 +1052,7 @@ async def handle_file_import(websocket: WebSocket, request_data: dict):
"result": {}, "result": {},
"schema": lab_registry._generate_unilab_json_command_schema(v["args"], k), "schema": lab_registry._generate_unilab_json_command_schema(v["args"], k),
"goal_default": {i["name"]: i["default"] for i in v["args"]}, "goal_default": {i["name"]: i["default"] for i in v["args"]},
"handles": {}, "handles": [],
} }
# 不生成已配置action的动作 # 不生成已配置action的动作
for k, v in enhanced_info["action_methods"].items() for k, v in enhanced_info["action_methods"].items()
@@ -1340,5 +1340,5 @@ def setup_api_routes(app):
# 启动广播任务 # 启动广播任务
@app.on_event("startup") @app.on_event("startup")
async def startup_event(): async def startup_event():
asyncio.create_task(broadcast_device_status(), name="web-api-startup-device") asyncio.create_task(broadcast_device_status())
asyncio.create_task(broadcast_status_page_data(), name="web-api-startup-status") asyncio.create_task(broadcast_status_page_data())

View File

@@ -8,8 +8,6 @@ import json
import os import os
from typing import List, Dict, Any, Optional from typing import List, Dict, Any, Optional
from unilabos.utils.tools import fast_dumps as _fast_dumps, fast_dumps_pretty as _fast_dumps_pretty
import requests import requests
from unilabos.resources.resource_tracker import ResourceTreeSet from unilabos.resources.resource_tracker import ResourceTreeSet
from unilabos.utils.log import info from unilabos.utils.log import info
@@ -282,54 +280,29 @@ class HTTPClient:
) )
return response return response
def resource_registry( def resource_registry(self, registry_data: Dict[str, Any] | List[Dict[str, Any]]) -> requests.Response:
self, registry_data: Dict[str, Any] | List[Dict[str, Any]], tag: str = "registry",
) -> requests.Response:
""" """
注册资源到服务器,同步保存请求/响应到 unilabos_data 注册资源到服务器
Args: Args:
registry_data: 注册表数据,格式为 {resource_id: resource_info} / [{resource_info}] registry_data: 注册表数据,格式为 {resource_id: resource_info} / [{resource_info}]
tag: 保存文件的标签后缀 (如 "device_registry" / "resource_registry")
Returns: Returns:
Response: API响应对象 Response: API响应对象
""" """
# 序列化一次,同时用于保存和发送 compressed_body = gzip.compress(
json_bytes = _fast_dumps(registry_data) json.dumps(registry_data, ensure_ascii=False, default=str).encode("utf-8")
)
# 保存请求数据到 unilabos_data
req_path = os.path.join(BasicConfig.working_dir, f"req_{tag}_upload.json")
try:
os.makedirs(BasicConfig.working_dir, exist_ok=True)
with open(req_path, "wb") as f:
f.write(_fast_dumps_pretty(registry_data))
logger.trace(f"注册表请求数据已保存: {req_path}")
except Exception as e:
logger.warning(f"保存注册表请求数据失败: {e}")
compressed_body = gzip.compress(json_bytes)
headers = {
"Authorization": f"Lab {self.auth}",
"Content-Type": "application/json",
"Content-Encoding": "gzip",
}
response = requests.post( response = requests.post(
f"{self.remote_addr}/lab/resource", f"{self.remote_addr}/lab/resource",
data=compressed_body, data=compressed_body,
headers=headers, headers={
"Authorization": f"Lab {self.auth}",
"Content-Type": "application/json",
"Content-Encoding": "gzip",
},
timeout=30, timeout=30,
) )
# 保存响应数据到 unilabos_data
res_path = os.path.join(BasicConfig.working_dir, f"res_{tag}_upload.json")
try:
with open(res_path, "w", encoding="utf-8") as f:
f.write(f"{response.status_code}\n{response.text}")
logger.trace(f"注册表响应数据已保存: {res_path}")
except Exception as e:
logger.warning(f"保存注册表响应数据失败: {e}")
if response.status_code not in [200, 201]: if response.status_code not in [200, 201]:
logger.error(f"注册资源失败: {response.status_code}, {response.text}") logger.error(f"注册资源失败: {response.status_code}, {response.text}")
if response.status_code == 200: if response.status_code == 200:

View File

@@ -86,7 +86,7 @@ def setup_server() -> FastAPI:
# 设置页面路由 # 设置页面路由
try: try:
setup_web_pages(pages) setup_web_pages(pages)
# info("[Web] 已加载Web UI模块") info("[Web] 已加载Web UI模块")
except ImportError as e: except ImportError as e:
info(f"[Web] 未找到Web页面模块: {str(e)}") info(f"[Web] 未找到Web页面模块: {str(e)}")
except Exception as e: except Exception as e:
@@ -138,7 +138,7 @@ def start_server(host: str = "0.0.0.0", port: int = 8002, open_browser: bool = T
server_thread = threading.Thread(target=server.run, daemon=True, name="uvicorn_server") server_thread = threading.Thread(target=server.run, daemon=True, name="uvicorn_server")
server_thread.start() server_thread.start()
# info("[Web] Server started, monitoring for restart requests...") info("[Web] Server started, monitoring for restart requests...")
# 监控重启标志 # 监控重启标志
import unilabos.app.main as main_module import unilabos.app.main as main_module

View File

@@ -26,7 +26,6 @@ from enum import Enum
from typing_extensions import TypedDict from typing_extensions import TypedDict
from unilabos.app.model import JobAddReq from unilabos.app.model import JobAddReq
from unilabos.resources.resource_tracker import ResourceDictType
from unilabos.ros.nodes.presets.host_node import HostNode from unilabos.ros.nodes.presets.host_node import HostNode
from unilabos.utils.type_check import serialize_result_info from unilabos.utils.type_check import serialize_result_info
from unilabos.app.communication import BaseCommunicationClient from unilabos.app.communication import BaseCommunicationClient
@@ -409,7 +408,6 @@ class MessageProcessor:
# 线程控制 # 线程控制
self.is_running = False self.is_running = False
self.thread = None self.thread = None
self._loop = None # asyncio event loop引用用于外部关闭websocket
self.reconnect_count = 0 self.reconnect_count = 0
logger.info(f"[MessageProcessor] Initialized for URL: {websocket_url}") logger.info(f"[MessageProcessor] Initialized for URL: {websocket_url}")
@@ -436,31 +434,22 @@ class MessageProcessor:
def stop(self) -> None: def stop(self) -> None:
"""停止消息处理线程""" """停止消息处理线程"""
self.is_running = False self.is_running = False
# 主动关闭websocket以快速中断消息接收循环
ws = self.websocket
loop = self._loop
if ws and loop and loop.is_running():
try:
asyncio.run_coroutine_threadsafe(ws.close(), loop)
except Exception:
pass
if self.thread and self.thread.is_alive(): if self.thread and self.thread.is_alive():
self.thread.join(timeout=2) self.thread.join(timeout=2)
logger.info("[MessageProcessor] Stopped") logger.info("[MessageProcessor] Stopped")
def _run(self): def _run(self):
"""运行消息处理主循环""" """运行消息处理主循环"""
self._loop = asyncio.new_event_loop() loop = asyncio.new_event_loop()
try: try:
asyncio.set_event_loop(self._loop) asyncio.set_event_loop(loop)
self._loop.run_until_complete(self._connection_handler()) loop.run_until_complete(self._connection_handler())
except Exception as e: except Exception as e:
logger.error(f"[MessageProcessor] Thread error: {str(e)}") logger.error(f"[MessageProcessor] Thread error: {str(e)}")
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
finally: finally:
if self._loop: if loop:
self._loop.close() loop.close()
self._loop = None
async def _connection_handler(self): async def _connection_handler(self):
"""处理WebSocket连接和重连逻辑""" """处理WebSocket连接和重连逻辑"""
@@ -480,7 +469,6 @@ class MessageProcessor:
open_timeout=20, open_timeout=20,
ping_interval=WSConfig.ping_interval, ping_interval=WSConfig.ping_interval,
ping_timeout=10, ping_timeout=10,
close_timeout=5,
additional_headers={ additional_headers={
"Authorization": f"Lab {BasicConfig.auth_secret()}", "Authorization": f"Lab {BasicConfig.auth_secret()}",
"EdgeSession": f"{self.session_id}", "EdgeSession": f"{self.session_id}",
@@ -491,45 +479,42 @@ class MessageProcessor:
self.connected = True self.connected = True
self.reconnect_count = 0 self.reconnect_count = 0
logger.info(f"[MessageProcessor] 已连接到 {self.websocket_url}") logger.trace(f"[MessageProcessor] Connected to {self.websocket_url}")
# 启动发送协程 # 启动发送协程
send_task = asyncio.create_task(self._send_handler(), name="websocket-send_task") send_task = asyncio.create_task(self._send_handler())
# 每次连接(含重连)后重新向服务端注册,
# 否则服务端不知道客户端已上线,不会推送消息。
if self.websocket_client:
self.websocket_client.publish_host_ready()
try: try:
# 接收消息循环 # 接收消息循环
await self._message_handler() await self._message_handler()
finally: finally:
# 必须在 async with __aexit__ 之前停止 send_task
# 否则 send_task 会在关闭握手期间继续发送数据,
# 干扰 websockets 库的内部清理,导致 task 泄漏。
self.connected = False
send_task.cancel() send_task.cancel()
try: try:
await send_task await send_task
except asyncio.CancelledError: except asyncio.CancelledError:
pass pass
self.connected = False
except websockets.exceptions.ConnectionClosed: except websockets.exceptions.ConnectionClosed:
logger.warning("[MessageProcessor] 与服务端连接中断") logger.warning("[MessageProcessor] Connection closed")
self.connected = False
except TimeoutError: except TimeoutError:
logger.warning( logger.warning(
f"[MessageProcessor] 与服务端连接通信超时 (已尝试 {self.reconnect_count + 1} 次),请检查您的网络状况" f"[MessageProcessor] Connection timeout (attempt {self.reconnect_count + 1}), "
f"server may be temporarily unavailable"
) )
self.connected = False
except websockets.exceptions.InvalidStatus as e: except websockets.exceptions.InvalidStatus as e:
logger.warning( logger.warning(
f"[MessageProcessor] 收到服务端注册码 {e.response.status_code}, 上一进程可能还未退出" f"[MessageProcessor] Server returned unexpected HTTP status {e.response.status_code}, "
f"WebSocket endpoint may not be ready yet"
) )
except Exception as e:
logger.error(traceback.format_exc())
logger.error(f"[MessageProcessor] 尝试重连时出错 {str(e)}")
finally:
self.connected = False self.connected = False
except Exception as e:
logger.error(f"[MessageProcessor] Connection error: {str(e)}")
logger.error(traceback.format_exc())
self.connected = False
finally:
self.websocket = None self.websocket = None
# 重连逻辑 # 重连逻辑
@@ -537,9 +522,10 @@ class MessageProcessor:
break break
if self.reconnect_count < WSConfig.max_reconnect_attempts: if self.reconnect_count < WSConfig.max_reconnect_attempts:
self.reconnect_count += 1 self.reconnect_count += 1
backoff = WSConfig.reconnect_interval backoff = min(WSConfig.reconnect_interval * (2 ** (self.reconnect_count - 1)), 60)
logger.info( logger.info(
f"[MessageProcessor] 即将在 {backoff} 秒后重连 (已尝试 {self.reconnect_count}/{WSConfig.max_reconnect_attempts})" f"[MessageProcessor] Reconnecting in {backoff}s "
f"(attempt {self.reconnect_count}/{WSConfig.max_reconnect_attempts})"
) )
await asyncio.sleep(backoff) await asyncio.sleep(backoff)
else: else:
@@ -547,38 +533,40 @@ class MessageProcessor:
break break
async def _message_handler(self): async def _message_handler(self):
"""处理接收到的消息 """处理接收到的消息"""
ConnectionClosed 不在此处捕获,让其向上传播到 _connection_handler
以便 async with websockets.connect() 的 __aexit__ 能感知连接已断,
正确清理内部 task避免 task 泄漏。
"""
if not self.websocket: if not self.websocket:
logger.error("[MessageProcessor] WebSocket connection is None") logger.error("[MessageProcessor] WebSocket connection is None")
return return
async for message in self.websocket: try:
try: async for message in self.websocket:
data = json.loads(message) try:
message_type = data.get("action", "") data = json.loads(message)
message_data = data.get("data") message_type = data.get("action", "")
if self.session_id and self.session_id == data.get("edge_session"): message_data = data.get("data")
await self._process_message(message_type, message_data) if self.session_id and self.session_id == data.get("edge_session"):
else:
if message_type.endswith("_material"):
logger.trace(
f"[MessageProcessor] 收到一条归属 {data.get('edge_session')} 的旧消息:{data}"
)
logger.debug(
f"[MessageProcessor] 跳过了一条归属 {data.get('edge_session')} 的旧消息: {data.get('action')}"
)
else:
await self._process_message(message_type, message_data) await self._process_message(message_type, message_data)
except json.JSONDecodeError: else:
logger.error(f"[MessageProcessor] Invalid JSON received: {message}") if message_type.endswith("_material"):
except Exception as e: logger.trace(
logger.error(f"[MessageProcessor] Error processing message: {str(e)}") f"[MessageProcessor] 收到一条归属 {data.get('edge_session')} 的旧消息:{data}"
logger.error(traceback.format_exc()) )
logger.debug(
f"[MessageProcessor] 跳过了一条归属 {data.get('edge_session')} 的旧消息: {data.get('action')}"
)
else:
await self._process_message(message_type, message_data)
except json.JSONDecodeError:
logger.error(f"[MessageProcessor] Invalid JSON received: {message}")
except Exception as e:
logger.error(f"[MessageProcessor] Error processing message: {str(e)}")
logger.error(traceback.format_exc())
except websockets.exceptions.ConnectionClosed:
logger.info("[MessageProcessor] Message handler stopped - connection closed")
except Exception as e:
logger.error(f"[MessageProcessor] Message handler error: {str(e)}")
logger.error(traceback.format_exc())
async def _send_handler(self): async def _send_handler(self):
"""处理发送队列中的消息""" """处理发送队列中的消息"""
@@ -627,7 +615,6 @@ class MessageProcessor:
except asyncio.CancelledError: except asyncio.CancelledError:
logger.debug("[MessageProcessor] Send handler cancelled") logger.debug("[MessageProcessor] Send handler cancelled")
raise
except Exception as e: except Exception as e:
logger.error(f"[MessageProcessor] Fatal error in send handler: {str(e)}") logger.error(f"[MessageProcessor] Fatal error in send handler: {str(e)}")
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
@@ -659,10 +646,6 @@ class MessageProcessor:
# elif message_type == "session_id": # elif message_type == "session_id":
# self.session_id = message_data.get("session_id") # self.session_id = message_data.get("session_id")
# logger.info(f"[MessageProcessor] Session ID: {self.session_id}") # logger.info(f"[MessageProcessor] Session ID: {self.session_id}")
elif message_type == "add_device":
await self._handle_device_manage(message_data, "add")
elif message_type == "remove_device":
await self._handle_device_manage(message_data, "remove")
elif message_type == "request_restart": elif message_type == "request_restart":
await self._handle_request_restart(message_data) await self._handle_request_restart(message_data)
else: else:
@@ -999,37 +982,6 @@ class MessageProcessor:
) )
thread.start() thread.start()
async def _handle_device_manage(self, device_list: list[ResourceDictType], action: str):
"""Handle add_device / remove_device from LabGo server."""
if not device_list:
return
for item in device_list:
target_node_id = item.get("target_node_id", "host_node")
def _notify(target_id: str, act: str, cfg: ResourceDictType):
try:
host_node = HostNode.get_instance(timeout=5)
if not host_node:
logger.error(f"[DeviceManage] HostNode not available for {act}_device")
return
success = host_node.notify_device_manage(target_id, act, cfg)
if success:
logger.info(f"[DeviceManage] {act}_device completed on {target_id}")
else:
logger.warning(f"[DeviceManage] {act}_device failed on {target_id}")
except Exception as e:
logger.error(f"[DeviceManage] Error in {act}_device: {e}")
logger.error(traceback.format_exc())
thread = threading.Thread(
target=_notify,
args=(target_node_id, action, item),
daemon=True,
name=f"DeviceManage-{action}-{item.get('id', '')}",
)
thread.start()
async def _handle_request_restart(self, data: Dict[str, Any]): async def _handle_request_restart(self, data: Dict[str, Any]):
""" """
处理重启请求 处理重启请求
@@ -1041,9 +993,10 @@ class MessageProcessor:
logger.info(f"[MessageProcessor] Received restart request, reason: {reason}, delay: {delay}s") logger.info(f"[MessageProcessor] Received restart request, reason: {reason}, delay: {delay}s")
# 发送确认消息 # 发送确认消息
self.send_message( if self.websocket_client:
{"action": "restart_acknowledged", "data": {"reason": reason, "delay": delay}} await self.websocket_client.send_message(
) {"action": "restart_acknowledged", "data": {"reason": reason, "delay": delay}}
)
# 设置全局重启标志 # 设置全局重启标志
import unilabos.app.main as main_module import unilabos.app.main as main_module
@@ -1145,7 +1098,6 @@ class QueueProcessor:
def stop(self) -> None: def stop(self) -> None:
"""停止队列处理线程""" """停止队列处理线程"""
self.is_running = False self.is_running = False
self.queue_update_event.set() # 立即唤醒等待中的线程
if self.thread and self.thread.is_alive(): if self.thread and self.thread.is_alive():
self.thread.join(timeout=2) self.thread.join(timeout=2)
logger.info("[QueueProcessor] Stopped") logger.info("[QueueProcessor] Stopped")
@@ -1399,8 +1351,8 @@ class WebSocketClient(BaseCommunicationClient):
message = {"action": "normal_exit", "data": {"session_id": session_id}} message = {"action": "normal_exit", "data": {"session_id": session_id}}
self.message_processor.send_message(message) self.message_processor.send_message(message)
logger.info(f"[WebSocketClient] Sent normal_exit message with session_id: {session_id}") logger.info(f"[WebSocketClient] Sent normal_exit message with session_id: {session_id}")
# send_handler 每100ms检查一次队列等300ms足以让消息发 # 给一点时间让消息发送出去
time.sleep(0.3) time.sleep(1)
except Exception as e: except Exception as e:
logger.warning(f"[WebSocketClient] Failed to send normal_exit message: {str(e)}") logger.warning(f"[WebSocketClient] Failed to send normal_exit message: {str(e)}")

View File

@@ -24,7 +24,6 @@ class BasicConfig:
port = 8002 # 本地HTTP服务 port = 8002 # 本地HTTP服务
check_mode = False # CI 检查模式,用于验证 registry 导入和文件一致性 check_mode = False # CI 检查模式,用于验证 registry 导入和文件一致性
test_mode = False # 测试模式,所有动作不实际执行,返回模拟结果 test_mode = False # 测试模式,所有动作不实际执行,返回模拟结果
extra_resource = False # 是否加载lab_开头的额外资源
# 'TRACE', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL' # 'TRACE', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'
log_level: Literal["TRACE", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "DEBUG" log_level: Literal["TRACE", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "DEBUG"
@@ -41,7 +40,7 @@ class BasicConfig:
class WSConfig: class WSConfig:
reconnect_interval = 5 # 重连间隔(秒) reconnect_interval = 5 # 重连间隔(秒)
max_reconnect_attempts = 999 # 最大重连次数 max_reconnect_attempts = 999 # 最大重连次数
ping_interval = 20 # ping间隔 ping_interval = 30 # ping间隔
# HTTP配置 # HTTP配置

View File

@@ -1,3 +1,4 @@
from abc import abstractmethod from abc import abstractmethod
from functools import wraps from functools import wraps
import inspect import inspect

View File

@@ -57,6 +57,18 @@ class TransferLiquidReturn(TypedDict):
targets: List[List[ResourceDict]] targets: List[List[ResourceDict]]
class SetLiquidReturn(TypedDict):
wells: list
volumes: list
class SetLiquidFromPlateReturn(TypedDict):
plate: list
wells: list
volumes: list
class LiquidHandlerMiddleware(LiquidHandler): class LiquidHandlerMiddleware(LiquidHandler):
def __init__( def __init__(
self, backend: LiquidHandlerBackend, deck: Deck, simulator: bool = False, channel_num: int = 8, **kwargs self, backend: LiquidHandlerBackend, deck: Deck, simulator: bool = False, channel_num: int = 8, **kwargs

View File

@@ -634,7 +634,7 @@ class PRCXI9300Handler(LiquidHandlerAbstract):
def __init__( def __init__(
self, self,
deck: PRCXI9300Deck, deck: Deck,
host: str, host: str,
port: int, port: int,
timeout: float, timeout: float,
@@ -648,11 +648,11 @@ class PRCXI9300Handler(LiquidHandlerAbstract):
is_9320=False, is_9320=False,
): ):
tablets_info = [] tablets_info = []
for site_id in range(len(deck.sites)): count = 0
child = deck._get_site_resource(site_id) for child in deck.children:
# 如果放其他类型的物料,是不可以的 # 如果放其他类型的物料,是不可以的
if hasattr(child, "_unilabos_state") and "Material" in child._unilabos_state: if hasattr(child, "_unilabos_state") and "Material" in child._unilabos_state:
number = site_id + 1 number = int(child.name.replace("T", ""))
tablets_info.append( tablets_info.append(
WorkTablets( WorkTablets(
Number=number, Code=f"T{number}", Material=child._unilabos_state["Material"] Number=number, Code=f"T{number}", Material=child._unilabos_state["Material"]

View File

@@ -0,0 +1,376 @@
# -*- coding: utf-8 -*-
"""
ZDT X42 Closed-Loop Stepper Motor Driver
RS485 Serial Communication via USB-Serial Converter
- Baudrate: 115200
"""
import serial
import time
import threading
import struct
import logging
from typing import Optional, Any
try:
from unilabos.device_comms.universal_driver import UniversalDriver
except ImportError:
class UniversalDriver:
def __init__(self, *args, **kwargs):
self.logger = logging.getLogger(self.__class__.__name__)
def execute_command_from_outer(self, command: Any): pass
from serial.rs485 import RS485Settings
class ZDTX42Driver(UniversalDriver):
"""
ZDT X42 闭环步进电机驱动器
支持功能:
- 速度模式运行
- 位置模式运行 (相对/绝对)
- 位置读取和清零
- 使能/禁用控制
通信协议:
- 帧格式: [设备ID] [功能码] [数据...] [校验位=0x6B]
- 响应长度根据功能码决定
"""
def __init__(
self,
port: str,
baudrate: int = 115200,
device_id: int = 1,
timeout: float = 0.5,
debug: bool = False
):
"""
初始化 ZDT X42 电机驱动
Args:
port: 串口设备路径
baudrate: 波特率 (默认 115200)
device_id: 设备地址 (1-255)
timeout: 通信超时时间(秒)
debug: 是否启用调试输出
"""
super().__init__()
self.id = device_id
self.debug = debug
self.lock = threading.RLock()
self.status = "idle" # 对应注册表中的 status (str)
self.position = 0 # 对应注册表中的 position (int)
try:
self.ser = serial.Serial(
port=port,
baudrate=baudrate,
timeout=timeout,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE
)
# 启用 RS485 模式
try:
self.ser.rs485_mode = RS485Settings(
rts_level_for_tx=True,
rts_level_for_rx=False
)
except Exception:
pass # RS485 模式是可选的
self.logger.info(
f"ZDT X42 Motor connected: {port} "
f"(Baud: {baudrate}, ID: {device_id})"
)
# 自动使能电机,确保初始状态可运动
self.enable(True)
# 启动背景轮询线程,确保 position 实时刷新
self._stop_event = threading.Event()
self._polling_thread = threading.Thread(
target=self._update_loop,
name=f"ZDTPolling_{port}",
daemon=True
)
self._polling_thread.start()
except Exception as e:
self.logger.error(f"Failed to open serial port {port}: {e}")
self.ser = None
def _update_loop(self):
"""背景循环读取电机位置"""
while not self._stop_event.is_set():
try:
self.get_position()
except Exception as e:
if self.debug:
self.logger.error(f"Polling error: {e}")
time.sleep(1.0) # 每1秒刷新一次位置数据
def _send(self, func_code: int, payload: list) -> bytes:
"""
发送指令并接收响应
Args:
func_code: 功能码
payload: 数据负载 (list of bytes)
Returns:
响应数据 (bytes)
"""
if not self.ser:
self.logger.error("Serial port not available")
return b""
with self.lock:
# 清空输入缓冲区
self.ser.reset_input_buffer()
# 构建消息: [ID] [功能码] [数据...] [校验位=0x6B]
message = bytes([self.id, func_code] + payload + [0x6B])
# 发送
self.ser.write(message)
# 根据功能码决定响应长度
# 查询类指令返回 10 字节,控制类指令返回 4 字节
read_len = 10 if func_code in [0x31, 0x32, 0x35, 0x24, 0x27] else 4
response = self.ser.read(read_len)
# 调试输出
if self.debug:
sent_hex = message.hex().upper()
recv_hex = response.hex().upper() if response else 'TIMEOUT'
print(f"[ID {self.id}] TX: {sent_hex} → RX: {recv_hex}")
return response
def enable(self, on: bool = True) -> bool:
"""
使能/禁用电机
Args:
on: True=使能(锁轴), False=禁用(松轴)
Returns:
是否成功
"""
state = 1 if on else 0
resp = self._send(0xF3, [0xAB, state, 0])
return len(resp) >= 4
def move_speed(
self,
speed_rpm: int,
direction: str = "CW",
acceleration: int = 10
) -> bool:
"""
速度模式运行
Args:
speed_rpm: 转速 (RPM)
direction: 方向 ("CW"=顺时针, "CCW"=逆时针)
acceleration: 加速度 (0-255)
Returns:
是否成功
"""
dir_val = 0 if direction.upper() in ["CW", "顺时针"] else 1
speed_bytes = struct.pack('>H', int(speed_rpm))
self.status = f"moving@{speed_rpm}rpm"
resp = self._send(0xF6, [dir_val, speed_bytes[0], speed_bytes[1], acceleration, 0])
return len(resp) >= 4
def move_position(
self,
pulses: int,
speed_rpm: int,
direction: str = "CW",
acceleration: int = 10,
absolute: bool = False
) -> bool:
"""
位置模式运行
Args:
pulses: 脉冲数
speed_rpm: 转速 (RPM)
direction: 方向 ("CW"=顺时针, "CCW"=逆时针)
acceleration: 加速度 (0-255)
absolute: True=绝对位置, False=相对位置
Returns:
是否成功
"""
dir_val = 0 if direction.upper() in ["CW", "顺时针"] else 1
speed_bytes = struct.pack('>H', int(speed_rpm))
self.status = f"moving_to_{pulses}"
pulse_bytes = struct.pack('>I', int(pulses))
abs_flag = 1 if absolute else 0
payload = [
dir_val,
speed_bytes[0], speed_bytes[1],
acceleration,
pulse_bytes[0], pulse_bytes[1], pulse_bytes[2], pulse_bytes[3],
abs_flag,
0
]
resp = self._send(0xFD, payload)
return len(resp) >= 4
def stop(self) -> bool:
"""
停止电机
Returns:
是否成功
"""
self.status = "idle"
resp = self._send(0xFE, [0x98, 0])
return len(resp) >= 4
def rotate_quarter(self, speed_rpm: int = 60, direction: str = "CW") -> bool:
"""
电机旋转 1/4 圈 (阻塞式)
假设电机细分为 3200 脉冲/圈1/4 圈 = 800 脉冲
"""
pulses = 800
success = self.move_position(pulses=pulses, speed_rpm=speed_rpm, direction=direction, absolute=False)
if success:
# 计算预估旋转时间并进行阻塞等待 (Time = revolutions / (RPM/60))
# 1/4 rev / (RPM/60) = 15.0 / RPM
estimated_time = 15.0 / max(1, speed_rpm)
time.sleep(estimated_time + 0.5) # 额外给 0.5 秒缓冲
self.status = "idle"
return success
def wait_time(self, duration_s: float) -> bool:
"""
等待指定时间 (秒)
"""
self.logger.info(f"Waiting for {duration_s} seconds...")
time.sleep(duration_s)
return True
def set_zero(self) -> bool:
"""
清零当前位置
Returns:
是否成功
"""
resp = self._send(0x0A, [])
return len(resp) >= 4
def get_position(self) -> Optional[int]:
"""
读取当前位置 (脉冲数)
Returns:
当前位置脉冲数,失败返回 None
"""
resp = self._send(0x32, [])
if len(resp) >= 8:
# 响应格式: [ID] [Func] [符号位] [数值4字节] [校验]
sign = resp[2] # 0=正, 1=负
value = struct.unpack('>I', resp[3:7])[0]
self.position = -value if sign == 1 else value
if self.debug:
print(f"[Position] Raw: {resp.hex().upper()}, Parsed: {self.position}")
return self.position
self.logger.warning("Failed to read position")
return None
def close(self):
"""关闭串口连接并停止线程"""
if hasattr(self, '_stop_event'):
self._stop_event.set()
if self.ser and self.ser.is_open:
self.ser.close()
self.logger.info("Serial port closed")
# ============================================================
# 测试和调试代码
# ============================================================
def test_motor():
"""基础功能测试"""
logging.basicConfig(level=logging.INFO)
print("="*60)
print("ZDT X42 电机驱动测试")
print("="*60)
driver = ZDTX42Driver(
port="/dev/tty.usbserial-3110",
baudrate=115200,
device_id=2,
debug=True
)
if not driver.ser:
print("❌ 串口打开失败")
return
try:
# 测试 1: 读取位置
print("\n[1] 读取当前位置")
pos = driver.get_position()
print(f"✓ 当前位置: {pos} 脉冲")
# 测试 2: 使能
print("\n[2] 使能电机")
driver.enable(True)
time.sleep(0.3)
print("✓ 电机已锁定")
# 测试 3: 相对位置运动
print("\n[3] 相对位置运动 (1000脉冲)")
driver.move_position(pulses=1000, speed_rpm=60, direction="CW")
time.sleep(2)
pos = driver.get_position()
print(f"✓ 新位置: {pos}")
# 测试 4: 速度运动
print("\n[4] 速度模式 (30RPM, 3秒)")
driver.move_speed(speed_rpm=30, direction="CW")
time.sleep(3)
driver.stop()
pos = driver.get_position()
print(f"✓ 停止后位置: {pos}")
# 测试 5: 禁用
print("\n[5] 禁用电机")
driver.enable(False)
print("✓ 电机已松开")
print("\n" + "="*60)
print("✅ 测试完成")
print("="*60)
except Exception as e:
print(f"\n❌ 测试失败: {e}")
import traceback
traceback.print_exc()
finally:
driver.close()
if __name__ == "__main__":
test_motor()

View File

@@ -623,6 +623,119 @@ class ChinweDevice(UniversalDriver):
time.sleep(duration) time.sleep(duration)
return True return True
def separation_step(self, motor_id: int = 5, speed: int = 60, pulses: int = 700,
max_cycles: int = 0, timeout: int = 300) -> bool:
"""
分液步骤 - 液位传感器与电机联动
当液位传感器检测到"有液"时,电机顺时针旋转指定脉冲数
当液位传感器检测到"无液"时,电机逆时针旋转指定脉冲数
:param motor_id: 电机ID (必须在初始化时配置的motor_ids中)
:param speed: 电机转速 (RPM)
:param pulses: 每次旋转的脉冲数 (默认700约为1/4圈,假设3200脉冲/圈)
:param max_cycles: 最大执行循环次数 (0=无限制,默认0)
:param timeout: 整体超时时间 (秒)
:return: 成功返回True,超时或失败返回False
"""
motor_id = int(motor_id)
speed = int(speed)
pulses = int(pulses)
max_cycles = int(max_cycles)
timeout = int(timeout)
# 检查电机是否存在
if motor_id not in self.motors:
self.logger.error(f"Motor {motor_id} not found in configured motors: {list(self.motors.keys())}")
return False
# 检查传感器是否可用
if not self.sensor:
self.logger.error("Sensor not initialized")
return False
motor = self.motors[motor_id]
# 停止轮询线程,避免与 separation_step 同时读取传感器造成串口冲突
self.logger.info("Stopping polling thread for separation_step...")
self._stop_event.set()
if self._poll_thread and self._poll_thread.is_alive():
self._poll_thread.join(timeout=2.0)
# 使能电机
self.logger.info(f"Enabling motor {motor_id}...")
motor.enable(True)
time.sleep(0.2)
self.logger.info(f"Starting separation step: motor_id={motor_id}, speed={speed} RPM, "
f"pulses={pulses}, max_cycles={max_cycles}, timeout={timeout}s")
# 记录上一次的液位状态
last_level = None
cycle_count = 0
start_time = time.time()
error_count = 0
try:
while True:
# 检查超时
if time.time() - start_time > timeout:
self.logger.warning(f"Separation step timeout after {timeout} seconds")
return False
# 检查循环次数限制
if max_cycles > 0 and cycle_count >= max_cycles:
self.logger.info(f"Separation step completed: reached max_cycles={max_cycles}")
return True
# 读取传感器数据
data = self.sensor.read_level()
if data is None:
error_count += 1
if error_count > 5:
self.logger.warning("Sensor read failed multiple times, retrying...")
error_count = 0
time.sleep(0.5)
continue
error_count = 0
current_level = data['level']
rssi = data['rssi']
# 检测状态变化 (包括首次检测)
if current_level != last_level:
cycle_count += 1
if current_level:
# 有液 -> 电机顺时针旋转
self.logger.info(f"[Cycle {cycle_count}] Liquid detected (RSSI={rssi}), "
f"rotating motor {motor_id} clockwise {pulses} pulses")
motor.run_position(pulses=pulses, speed_rpm=speed, direction=0, absolute=False)
# 等待电机完成 (预估时间)
estimated_time = 15.0 / max(1, speed)
time.sleep(estimated_time + 0.5)
else:
# 无液 -> 电机逆时针旋转
self.logger.info(f"[Cycle {cycle_count}] No liquid detected (RSSI={rssi}), "
f"rotating motor {motor_id} counter-clockwise {pulses} pulses")
motor.run_position(pulses=pulses, speed_rpm=speed, direction=1, absolute=False)
# 等待电机完成 (预估时间)
estimated_time = 15.0 / max(1, speed)
time.sleep(estimated_time + 0.5)
# 更新状态
last_level = current_level
# 轮询间隔
time.sleep(0.1)
finally:
# 恢复轮询线程
self.logger.info("Restarting polling thread...")
self._start_polling()
def execute_command_from_outer(self, command_dict: Dict[str, Any]) -> bool: def execute_command_from_outer(self, command_dict: Dict[str, Any]) -> bool:
"""支持标准 JSON 指令调用""" """支持标准 JSON 指令调用"""
return super().execute_command_from_outer(command_dict) return super().execute_command_from_outer(command_dict)

View File

@@ -0,0 +1,379 @@
# -*- coding: utf-8 -*-
"""
XKC RS485 液位传感器 (Modbus RTU)
说明:
1. 遵循 Modbus-RTU 协议。
2. 数据寄存器: 0x0001 (液位状态, 1=有液, 0=无液), 0x0002 (RSSI 信号强度)。
3. 地址寄存器: 0x0004 (可读写, 范围 1-254)。
4. 波特率寄存器: 0x0005 (可写, 代码表见 change_baudrate 方法)。
"""
import struct
import threading
import time
import logging
import serial
from typing import Optional, Dict, Any, List
from unilabos.device_comms.universal_driver import UniversalDriver
class TransportManager:
"""
统一通信管理类。
仅支持 串口 (Serial/有线) 连接。
"""
def __init__(self, port: str, baudrate: int = 9600, timeout: float = 3.0, logger=None):
self.port = port
self.baudrate = baudrate
self.timeout = timeout
self.logger = logger
self.lock = threading.RLock() # 线程锁,确保多设备共用一个连接时不冲突
self.serial = None
self._connect_serial()
def _connect_serial(self):
try:
self.serial = serial.Serial(
port=self.port,
baudrate=self.baudrate,
timeout=self.timeout
)
except Exception as e:
raise ConnectionError(f"Serial open failed: {e}")
def close(self):
"""关闭连接"""
if self.serial and self.serial.is_open:
self.serial.close()
def clear_buffer(self):
"""清空缓冲区 (Thread-safe)"""
with self.lock:
if self.serial:
self.serial.reset_input_buffer()
def write(self, data: bytes):
"""发送原始字节"""
with self.lock:
if self.serial:
self.serial.write(data)
def read(self, size: int) -> bytes:
"""读取指定长度字节"""
if self.serial:
return self.serial.read(size)
return b''
class XKCSensorDriver(UniversalDriver):
"""XKC RS485 液位传感器 (Modbus RTU)"""
def __init__(self, port: str, baudrate: int = 9600, device_id: int = 6,
threshold: int = 300, timeout: float = 3.0, debug: bool = False):
super().__init__()
self.port = port
self.baudrate = baudrate
self.device_id = device_id
self.threshold = threshold
self.timeout = timeout
self.debug = debug
self.level = False
self.rssi = 0
self.status = {"level": self.level, "rssi": self.rssi}
try:
self.transport = TransportManager(port, baudrate, timeout, logger=self.logger)
self.logger.info(f"XKCSensorDriver connected to {port} (ID: {device_id})")
except Exception as e:
self.logger.error(f"Failed to connect XKCSensorDriver: {e}")
self.transport = None
# 启动背景轮询线程,确保 status 实时刷新
self._stop_event = threading.Event()
self._polling_thread = threading.Thread(
target=self._update_loop,
name=f"XKCPolling_{port}",
daemon=True
)
if self.transport:
self._polling_thread.start()
def _update_loop(self):
"""背景循环读取传感器数据"""
while not self._stop_event.is_set():
try:
self.read_level()
except Exception as e:
if self.debug:
self.logger.error(f"Polling error: {e}")
time.sleep(2.0) # 每2秒刷新一次数据
def _crc(self, data: bytes) -> bytes:
crc = 0xFFFF
for byte in data:
crc ^= byte
for _ in range(8):
if crc & 0x0001: crc = (crc >> 1) ^ 0xA001
else: crc >>= 1
return struct.pack('<H', crc)
def read_level(self) -> Optional[Dict[str, Any]]:
"""
读取液位。
返回: {'level': bool, 'rssi': int}
"""
if not self.transport:
return None
with self.transport.lock:
self.transport.clear_buffer()
# Modbus Read Registers: 01 03 00 01 00 02 CRC
payload = struct.pack('>HH', 0x0001, 0x0002)
msg = struct.pack('BB', self.device_id, 0x03) + payload
msg += self._crc(msg)
if self.debug:
self.logger.info(f"TX (ID {self.device_id}): {msg.hex().upper()}")
self.transport.write(msg)
# Read header
h = self.transport.read(3) # Addr, Func, Len
if self.debug:
self.logger.info(f"RX Header: {h.hex().upper()}")
if len(h) < 3: return None
length = h[2]
# Read body + CRC
body = self.transport.read(length + 2)
if self.debug:
self.logger.info(f"RX Body+CRC: {body.hex().upper()}")
if len(body) < length + 2:
# Firmware bug fix specific to some modules
if len(body) == 4 and length == 4:
pass
else:
return None
data = body[:-2]
# 根据手册说明:
# 寄存器 0x0001 (data[0:2]): 液位状态 (00 01 为有液, 00 00 为无液)
# 寄存器 0x0002 (data[2:4]): 信号强度 RSSI
hw_level = False
rssi = 0
if len(data) >= 4:
hw_level = ((data[0] << 8) | data[1]) == 1
rssi = (data[2] << 8) | data[3]
elif len(data) == 2:
# 兼容模式: 某些老固件可能只返回 1 个寄存器
rssi = (data[0] << 8) | data[1]
hw_level = rssi > self.threshold
else:
return None
# 最终判定: 优先使用硬件层级的 level 判定,但 RSSI 阈值逻辑作为补充/校验
# 注意: 如果用户显式设置了 THRESHOLD我们可以在逻辑中做权衡
self.level = hw_level or (rssi > self.threshold)
self.rssi = rssi
result = {
'level': self.level,
'rssi': self.rssi
}
self.status = result
return result
def wait_level(self, target_state: bool, timeout: float = 60.0) -> bool:
"""
等待液位达到目标状态 (阻塞式)
"""
self.logger.info(f"Waiting for level: {target_state}")
start_time = time.time()
while (time.time() - start_time) < timeout:
res = self.read_level()
if res and res.get('level') == target_state:
return True
time.sleep(0.5)
self.logger.warning(f"Wait level timeout ({timeout}s)")
return False
def wait_for_liquid(self, target_state: bool, timeout: float = 120.0) -> bool:
"""
实时检测电导率(RSSI)并等待用户指定的“有液”或“无液”状态。
一旦检测到符合目标状态,立即返回。
Args:
target_state: True 为“有液”, False 为“无液”
timeout: 最大等待时间(秒)
"""
state_str = "有液" if target_state else "无液"
self.logger.info(f"开始实时检测电导率,等待状态: {state_str} (超时: {timeout}s)")
start_time = time.time()
while (time.time() - start_time) < timeout:
res = self.read_level() # 内部已更新 self.level 和 self.rssi
if res:
current_level = res.get('level')
current_rssi = res.get('rssi')
if current_level == target_state:
self.logger.info(f"✅ 检测到目标状态: {state_str} (当前电导率/RSSI: {current_rssi})")
return True
if self.debug:
self.logger.debug(f"当前状态: {'有液' if current_level else '无液'}, RSSI: {current_rssi}")
time.sleep(0.2) # 高频采样
self.logger.warning(f"❌ 等待 {state_str} 状态超时 ({timeout}s)")
return False
def set_threshold(self, threshold: int):
"""设置液位判定阈值"""
self.threshold = int(threshold)
self.logger.info(f"Threshold updated to: {self.threshold}")
def change_device_id(self, new_id: int) -> bool:
"""
修改设备的 Modbus 从站地址。
寄存器: 0x0004, 功能码: 0x06
"""
if not (1 <= new_id <= 254):
self.logger.error(f"Invalid device ID: {new_id}. Must be 1-254.")
return False
self.logger.info(f"Changing device ID from {self.device_id} to {new_id}")
success = self._write_single_register(0x0004, new_id)
if success:
self.device_id = new_id # 更新内存中的地址
self.logger.info(f"Device ID update command sent successfully (target {new_id}).")
return success
def change_baudrate(self, baud_code: int) -> bool:
"""
更改通讯波特率 (寄存器: 0x0005)。
设置成功后传感器 LED 会闪烁,通常无数据返回。
波特率代码对照表 (16进制):
05: 2400
06: 4800
07: 9600 (默认)
08: 14400
09: 19200
0A: 28800
0C: 57600
0D: 115200
0E: 128000
0F: 256000
"""
self.logger.info(f"Sending baudrate change command (Code: {baud_code:02X})")
# 写入寄存器 0x0005
self._write_single_register(0x0005, baud_code)
self.logger.info("Baudrate change command executed. Device LED should flash. Please update connection settings.")
return True
def factory_reset(self) -> bool:
"""
恢复出厂设置 (通过广播地址 FF)。
设置地址为 01逻辑为向 0x0004 写入 0x0002
"""
self.logger.info("Sending factory reset command via broadcast address FF...")
# 广播指令通常无回显
self._write_single_register(0x0004, 0x0002, slave_id=0xFF)
self.logger.info("Factory reset command sent. Device address should be 01 now.")
return True
def _write_single_register(self, reg_addr: int, value: int, slave_id: Optional[int] = None) -> bool:
"""内部辅助函数: Modbus 功能码 06 写单个寄存器"""
if not self.transport: return False
target_id = slave_id if slave_id is not None else self.device_id
msg = struct.pack('BBHH', target_id, 0x06, reg_addr, value)
msg += self._crc(msg)
with self.transport.lock:
self.transport.clear_buffer()
if self.debug:
self.logger.info(f"TX Write (Reg {reg_addr:#06x}): {msg.hex().upper()}")
self.transport.write(msg)
# 广播地址、波特率修改或厂家特定指令可能无回显
if target_id == 0xFF or reg_addr == 0x0005:
time.sleep(0.5)
return True
# 等待返回 (正常应返回相同报文)
resp = self.transport.read(len(msg))
if self.debug:
self.logger.info(f"RX Write Response: {resp.hex().upper()}")
return resp == msg
def close(self):
if self.transport:
self.transport.close()
if __name__ == "__main__":
# 快速实例化测试
import logging
# 减少冗余日志,仅显示重要信息
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
# 硬件配置 (根据实际情况修改)
TEST_PORT = "/dev/tty.usbserial-3110"
SLAVE_ID = 1
THRESHOLD = 300
print("\n" + "="*50)
print(f" XKC RS485 传感器独立测试程序")
print(f" 端口: {TEST_PORT} | 地址: {SLAVE_ID} | 阈值: {THRESHOLD}")
print("="*50)
sensor = XKCSensorDriver(port=TEST_PORT, device_id=SLAVE_ID, threshold=THRESHOLD, debug=False)
try:
if sensor.transport:
print(f"\n开始实时连续采样测试 (持续 15 秒)...")
print(f"按 Ctrl+C 可提前停止\n")
start_time = time.time()
duration = 15
count = 0
while time.time() - start_time < duration:
count += 1
res = sensor.read_level()
if res:
rssi = res['rssi']
level = res['level']
status_str = "【有液】" if level else "【无液】"
# 使用 \r 实现单行刷新显示 (或者不刷,直接打印历史)
# 为了方便查看变化,我们直接打印
elapsed = time.time() - start_time
print(f" [{elapsed:4.1f}s] 采样 {count:<3}: 电导率/RSSI = {rssi:<5} | 判定结果: {status_str}")
else:
print(f" [{time.time()-start_time:4.1f}s] 采样 {count:<3}: 通信失败 (无响应)")
time.sleep(0.5) # 每秒采样 2 次
print(f"\n--- 15 秒采样测试完成 (总计 {count} 次) ---")
# [3] 测试动态修改阈值
print(f"\n[3] 动态修改阈值演示...")
new_threshold = 400
sensor.set_threshold(new_threshold)
res = sensor.read_level()
if res:
print(f" 采样 (当前阈值={new_threshold}): 电导率/RSSI = {res['rssi']:<5} | 判定结果: {'【有液】' if res['level'] else '【无液】'}")
sensor.set_threshold(THRESHOLD) # 还原
except KeyboardInterrupt:
print("\n[!] 用户中断测试")
except Exception as e:
print(f"\n[!] 测试运行出错: {e}")
finally:
sensor.close()
print("\n--- 测试程序已退出 ---\n")

View File

@@ -1,15 +1,15 @@
""" """
Virtual Workbench Device - 模拟工作台设备 Virtual Workbench Device - 模拟工作台设备
包含: 包含
- 1个机械臂 (每次操作3s, 独占锁) - 1个机械臂 (每次操作3s, 独占锁)
- 3个加热台 (每次加热10s, 可并行) - 3个加热台 (每次加热10s, 可并行)
工作流程: 工作流程
1. A1-A5 物料同时启动, 竞争机械臂 1. A1-A5 物料同时启动竞争机械臂
2. 机械臂将物料移动到空闲加热台 2. 机械臂将物料移动到空闲加热台
3. 加热完成后, 机械臂将物料移动到C1-C5 3. 加热完成后机械臂将物料移动到C1-C5
注意: 调用来自线程池, 使用 threading.Lock 进行同步 注意调用来自线程池使用 threading.Lock 进行同步
""" """
import logging import logging
@@ -21,11 +21,9 @@ from threading import Lock, RLock
from typing_extensions import TypedDict from typing_extensions import TypedDict
from unilabos.registry.decorators import (
device, action, ActionInputHandle, ActionOutputHandle, DataSource, topic_config, not_action
)
from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode
from unilabos.resources.resource_tracker import SampleUUIDsType, LabSample from unilabos.utils.decorator import not_action, always_free
from unilabos.resources.resource_tracker import SampleUUIDsType, LabSample, RETURN_UNILABOS_SAMPLES
# ============ TypedDict 返回类型定义 ============ # ============ TypedDict 返回类型定义 ============
@@ -59,8 +57,6 @@ class MoveToOutputResult(TypedDict):
success: bool success: bool
station_id: int station_id: int
material_id: str material_id: str
output_position: str
message: str
unilabos_samples: List[LabSample] unilabos_samples: List[LabSample]
@@ -85,9 +81,9 @@ class HeatingStationState(Enum):
"""加热台状态枚举""" """加热台状态枚举"""
IDLE = "idle" # 空闲 IDLE = "idle" # 空闲
OCCUPIED = "occupied" # 已放置物料, 等待加热 OCCUPIED = "occupied" # 已放置物料等待加热
HEATING = "heating" # 加热中 HEATING = "heating" # 加热中
COMPLETED = "completed" # 加热完成, 等待取走 COMPLETED = "completed" # 加热完成等待取走
class ArmState(Enum): class ArmState(Enum):
@@ -109,24 +105,19 @@ class HeatingStation:
heating_progress: float = 0.0 heating_progress: float = 0.0
@device(
id="virtual_workbench",
category=["virtual_device"],
description="Virtual Workbench with 1 robotic arm and 3 heating stations for concurrent material processing",
)
class VirtualWorkbench: class VirtualWorkbench:
""" """
Virtual Workbench Device - 虚拟工作台设备 Virtual Workbench Device - 虚拟工作台设备
模拟一个包含1个机械臂和3个加热台的工作站 模拟一个包含1个机械臂和3个加热台的工作站
- 机械臂操作耗时3秒, 同一时间只能执行一个操作 - 机械臂操作耗时3秒同一时间只能执行一个操作
- 加热台加热耗时10秒, 3个加热台可并行工作 - 加热台加热耗时10秒3个加热台可并行工作
工作流: 工作流:
1. 物料A1-A5并发启动(线程池), 竞争机械臂使用权 1. 物料A1-A5并发启动线程池竞争机械臂使用权
2. 获取机械臂后, 查找空闲加热台 2. 获取机械臂后查找空闲加热台
3. 机械臂将物料放入加热台, 开始加热 3. 机械臂将物料放入加热台开始加热
4. 加热完成后, 机械臂将物料移动到目标位置Cn 4. 加热完成后机械臂将物料移动到目标位置Cn
""" """
_ros_node: BaseROS2DeviceNode _ros_node: BaseROS2DeviceNode
@@ -154,19 +145,19 @@ class VirtualWorkbench:
self.HEATING_TIME = float(self.config.get("heating_time", self.HEATING_TIME)) self.HEATING_TIME = float(self.config.get("heating_time", self.HEATING_TIME))
self.NUM_HEATING_STATIONS = int(self.config.get("num_heating_stations", self.NUM_HEATING_STATIONS)) self.NUM_HEATING_STATIONS = int(self.config.get("num_heating_stations", self.NUM_HEATING_STATIONS))
# 机械臂状态和锁 # 机械臂状态和锁 (使用threading.Lock)
self._arm_lock = Lock() self._arm_lock = Lock()
self._arm_state = ArmState.IDLE self._arm_state = ArmState.IDLE
self._arm_current_task: Optional[str] = None self._arm_current_task: Optional[str] = None
# 加热台状态 # 加热台状态 (station_id -> HeatingStation) - 立即初始化不依赖initialize()
self._heating_stations: Dict[int, HeatingStation] = { self._heating_stations: Dict[int, HeatingStation] = {
i: HeatingStation(station_id=i) for i in range(1, self.NUM_HEATING_STATIONS + 1) i: HeatingStation(station_id=i) for i in range(1, self.NUM_HEATING_STATIONS + 1)
} }
self._stations_lock = RLock() self._stations_lock = RLock() # 可重入锁,保护加热台状态
# 任务追踪 # 任务追踪
self._active_tasks: Dict[str, Dict[str, Any]] = {} self._active_tasks: Dict[str, Dict[str, Any]] = {} # material_id -> task_info
self._tasks_lock = Lock() self._tasks_lock = Lock()
# 处理其他kwargs参数 # 处理其他kwargs参数
@@ -192,6 +183,7 @@ class VirtualWorkbench:
"""初始化虚拟工作台""" """初始化虚拟工作台"""
self.logger.info(f"初始化虚拟工作台 {self.device_id}") self.logger.info(f"初始化虚拟工作台 {self.device_id}")
# 重置加热台状态 (已在__init__中创建这里重置为初始状态)
with self._stations_lock: with self._stations_lock:
for station in self._heating_stations.values(): for station in self._heating_stations.values():
station.state = HeatingStationState.IDLE station.state = HeatingStationState.IDLE
@@ -199,6 +191,7 @@ class VirtualWorkbench:
station.material_number = None station.material_number = None
station.heating_progress = 0.0 station.heating_progress = 0.0
# 初始化状态
self.data.update( self.data.update(
{ {
"status": "Ready", "status": "Ready",
@@ -264,7 +257,11 @@ class VirtualWorkbench:
self.data["message"] = message self.data["message"] = message
def _find_available_heating_station(self) -> Optional[int]: def _find_available_heating_station(self) -> Optional[int]:
"""查找空闲的加热台""" """查找空闲的加热台
Returns:
空闲加热台ID如果没有则返回None
"""
with self._stations_lock: with self._stations_lock:
for station_id, station in self._heating_stations.items(): for station_id, station in self._heating_stations.items():
if station.state == HeatingStationState.IDLE: if station.state == HeatingStationState.IDLE:
@@ -272,12 +269,23 @@ class VirtualWorkbench:
return None return None
def _acquire_arm(self, task_description: str) -> bool: def _acquire_arm(self, task_description: str) -> bool:
"""获取机械臂使用权(阻塞直到获取)""" """获取机械臂使用权阻塞直到获取
Args:
task_description: 任务描述,用于日志
Returns:
是否成功获取
"""
self.logger.info(f"[{task_description}] 等待获取机械臂...") self.logger.info(f"[{task_description}] 等待获取机械臂...")
# 阻塞等待获取锁
self._arm_lock.acquire() self._arm_lock.acquire()
self._arm_state = ArmState.BUSY self._arm_state = ArmState.BUSY
self._arm_current_task = task_description self._arm_current_task = task_description
self._update_data_status(f"机械臂执行: {task_description}") self._update_data_status(f"机械臂执行: {task_description}")
self.logger.info(f"[{task_description}] 成功获取机械臂使用权") self.logger.info(f"[{task_description}] 成功获取机械臂使用权")
return True return True
@@ -290,22 +298,6 @@ class VirtualWorkbench:
self._update_data_status(f"机械臂已释放 (完成: {task})") self._update_data_status(f"机械臂已释放 (完成: {task})")
self.logger.info(f"机械臂已释放 (完成: {task})") self.logger.info(f"机械臂已释放 (完成: {task})")
@action(
auto_prefix=True,
description="批量准备物料 - 虚拟起始节点, 生成A1-A5物料, 输出5个handle供后续节点使用",
handles=[
ActionOutputHandle(key="channel_1", data_type="workbench_material",
label="实验1", data_key="material_1", data_source=DataSource.EXECUTOR),
ActionOutputHandle(key="channel_2", data_type="workbench_material",
label="实验2", data_key="material_2", data_source=DataSource.EXECUTOR),
ActionOutputHandle(key="channel_3", data_type="workbench_material",
label="实验3", data_key="material_3", data_source=DataSource.EXECUTOR),
ActionOutputHandle(key="channel_4", data_type="workbench_material",
label="实验4", data_key="material_4", data_source=DataSource.EXECUTOR),
ActionOutputHandle(key="channel_5", data_type="workbench_material",
label="实验5", data_key="material_5", data_source=DataSource.EXECUTOR),
],
)
def prepare_materials( def prepare_materials(
self, self,
sample_uuids: SampleUUIDsType, sample_uuids: SampleUUIDsType,
@@ -314,14 +306,19 @@ class VirtualWorkbench:
""" """
批量准备物料 - 虚拟起始节点 批量准备物料 - 虚拟起始节点
作为工作流的起始节点, 生成指定数量的物料编号供后续节点使用。 作为工作流的起始节点生成指定数量的物料编号供后续节点使用。
输出5个handle (material_1 ~ material_5), 分别对应实验1~5。 输出5个handle (material_1 ~ material_5)分别对应实验1~5。
Args:
count: 待生成的物料数量默认5 (生成 A1-A5)
Returns:
PrepareMaterialsResult: 包含 material_1 ~ material_5 用于传递给 move_to_heating_station
""" """
# 生成物料列表 A1 - A{count}
materials = [i for i in range(1, count + 1)] materials = [i for i in range(1, count + 1)]
self.logger.info( self.logger.info(f"[准备物料] 生成 {count} 个物料: " f"A1-A{count} -> material_1~material_{count}")
f"[准备物料] 生成 {count} 个物料: A1-A{count} -> material_1~material_{count}"
)
return { return {
"success": True, "success": True,
@@ -332,28 +329,9 @@ class VirtualWorkbench:
"material_4": materials[3] if len(materials) > 3 else 0, "material_4": materials[3] if len(materials) > 3 else 0,
"material_5": materials[4] if len(materials) > 4 else 0, "material_5": materials[4] if len(materials) > 4 else 0,
"message": f"已准备 {count} 个物料: A1-A{count}", "message": f"已准备 {count} 个物料: A1-A{count}",
"unilabos_samples": [ "unilabos_samples": [LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for sample_uuid, content in sample_uuids.items()]
LabSample(
sample_uuid=sample_uuid,
oss_path="",
extra={"material_uuid": content} if isinstance(content, str) else (content.serialize() if content else {}),
)
for sample_uuid, content in sample_uuids.items()
],
} }
@action(
auto_prefix=True,
description="将物料从An位置移动到空闲加热台, 返回分配的加热台ID",
handles=[
ActionInputHandle(key="material_input", data_type="workbench_material",
label="物料编号", data_key="material_number", data_source=DataSource.HANDLE),
ActionOutputHandle(key="heating_station_output", data_type="workbench_station",
label="加热台ID", data_key="station_id", data_source=DataSource.EXECUTOR),
ActionOutputHandle(key="material_number_output", data_type="workbench_material",
label="物料编号", data_key="material_number", data_source=DataSource.EXECUTOR),
],
)
def move_to_heating_station( def move_to_heating_station(
self, self,
sample_uuids: SampleUUIDsType, sample_uuids: SampleUUIDsType,
@@ -362,12 +340,20 @@ class VirtualWorkbench:
""" """
将物料从An位置移动到加热台 将物料从An位置移动到加热台
多线程并发调用时, 会竞争机械臂使用权, 并自动查找空闲加热台 多线程并发调用时会竞争机械臂使用权并自动查找空闲加热台
Args:
material_number: 物料编号 (1-5)
Returns:
MoveToHeatingStationResult: 包含 station_id, material_number 等用于传递给下一个节点
""" """
# 根据物料编号生成物料ID
material_id = f"A{material_number}" material_id = f"A{material_number}"
task_desc = f"移动{material_id}到加热台" task_desc = f"移动{material_id}到加热台"
self.logger.info(f"[任务] {task_desc} - 开始执行") self.logger.info(f"[任务] {task_desc} - 开始执行")
# 记录任务
with self._tasks_lock: with self._tasks_lock:
self._active_tasks[material_id] = { self._active_tasks[material_id] = {
"status": "waiting_for_arm", "status": "waiting_for_arm",
@@ -375,27 +361,33 @@ class VirtualWorkbench:
} }
try: try:
# 步骤1: 等待获取机械臂使用权(竞争)
with self._tasks_lock: with self._tasks_lock:
self._active_tasks[material_id]["status"] = "waiting_for_arm" self._active_tasks[material_id]["status"] = "waiting_for_arm"
self._acquire_arm(task_desc) self._acquire_arm(task_desc)
# 步骤2: 查找空闲加热台
with self._tasks_lock: with self._tasks_lock:
self._active_tasks[material_id]["status"] = "finding_station" self._active_tasks[material_id]["status"] = "finding_station"
station_id = None station_id = None
# 循环等待直到找到空闲加热台
while station_id is None: while station_id is None:
station_id = self._find_available_heating_station() station_id = self._find_available_heating_station()
if station_id is None: if station_id is None:
self.logger.info(f"[{material_id}] 没有空闲加热台, 等待中...") self.logger.info(f"[{material_id}] 没有空闲加热台等待中...")
# 释放机械臂,等待后重试
self._release_arm() self._release_arm()
time.sleep(0.5) time.sleep(0.5)
self._acquire_arm(task_desc) self._acquire_arm(task_desc)
# 步骤3: 占用加热台 - 立即标记为OCCUPIED防止其他任务选择同一加热台
with self._stations_lock: with self._stations_lock:
self._heating_stations[station_id].state = HeatingStationState.OCCUPIED self._heating_stations[station_id].state = HeatingStationState.OCCUPIED
self._heating_stations[station_id].current_material = material_id self._heating_stations[station_id].current_material = material_id
self._heating_stations[station_id].material_number = material_number self._heating_stations[station_id].material_number = material_number
# 步骤4: 模拟机械臂移动操作 (3秒)
with self._tasks_lock: with self._tasks_lock:
self._active_tasks[material_id]["status"] = "arm_moving" self._active_tasks[material_id]["status"] = "arm_moving"
self._active_tasks[material_id]["assigned_station"] = station_id self._active_tasks[material_id]["assigned_station"] = station_id
@@ -403,11 +395,11 @@ class VirtualWorkbench:
time.sleep(self.ARM_OPERATION_TIME) time.sleep(self.ARM_OPERATION_TIME)
# 步骤5: 放入加热台完成
self._update_data_status(f"{material_id}已放入加热台{station_id}") self._update_data_status(f"{material_id}已放入加热台{station_id}")
self.logger.info( self.logger.info(f"[{material_id}] 已放入加热台{station_id} (用时{self.ARM_OPERATION_TIME}s)")
f"[{material_id}] 已放入加热台{station_id} (用时{self.ARM_OPERATION_TIME}s)"
)
# 释放机械臂
self._release_arm() self._release_arm()
with self._tasks_lock: with self._tasks_lock:
@@ -420,16 +412,8 @@ class VirtualWorkbench:
"material_number": material_number, "material_number": material_number,
"message": f"{material_id}已成功移动到加热台{station_id}", "message": f"{material_id}已成功移动到加热台{station_id}",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
except Exception as e: except Exception as e:
@@ -443,33 +427,11 @@ class VirtualWorkbench:
"material_number": material_number, "material_number": material_number,
"message": f"移动失败: {str(e)}", "message": f"移动失败: {str(e)}",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
@action( @always_free
auto_prefix=True,
always_free=True,
description="启动指定加热台的加热程序",
handles=[
ActionInputHandle(key="station_id_input", data_type="workbench_station",
label="加热台ID", data_key="station_id", data_source=DataSource.HANDLE),
ActionInputHandle(key="material_number_input", data_type="workbench_material",
label="物料编号", data_key="material_number", data_source=DataSource.HANDLE),
ActionOutputHandle(key="heating_done_station", data_type="workbench_station",
label="加热完成-加热台ID", data_key="station_id", data_source=DataSource.EXECUTOR),
ActionOutputHandle(key="heating_done_material", data_type="workbench_material",
label="加热完成-物料编号", data_key="material_number", data_source=DataSource.EXECUTOR),
],
)
def start_heating( def start_heating(
self, self,
sample_uuids: SampleUUIDsType, sample_uuids: SampleUUIDsType,
@@ -478,6 +440,13 @@ class VirtualWorkbench:
) -> StartHeatingResult: ) -> StartHeatingResult:
""" """
启动指定加热台的加热程序 启动指定加热台的加热程序
Args:
station_id: 加热台ID (1-3),从 move_to_heating_station 的 handle 传入
material_number: 物料编号,从 move_to_heating_station 的 handle 传入
Returns:
StartHeatingResult: 包含 station_id, material_number 等用于传递给下一个节点
""" """
self.logger.info(f"[加热台{station_id}] 开始加热") self.logger.info(f"[加热台{station_id}] 开始加热")
@@ -489,16 +458,8 @@ class VirtualWorkbench:
"material_number": material_number, "material_number": material_number,
"message": f"无效的加热台ID: {station_id}", "message": f"无效的加热台ID: {station_id}",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
with self._stations_lock: with self._stations_lock:
@@ -512,16 +473,8 @@ class VirtualWorkbench:
"material_number": material_number, "material_number": material_number,
"message": f"加热台{station_id}上没有物料", "message": f"加热台{station_id}上没有物料",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
if station.state == HeatingStationState.HEATING: if station.state == HeatingStationState.HEATING:
@@ -532,20 +485,13 @@ class VirtualWorkbench:
"material_number": material_number, "material_number": material_number,
"message": f"加热台{station_id}已经在加热中", "message": f"加热台{station_id}已经在加热中",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
material_id = station.current_material material_id = station.current_material
# 开始加热
station.state = HeatingStationState.HEATING station.state = HeatingStationState.HEATING
station.heating_start_time = time.time() station.heating_start_time = time.time()
station.heating_progress = 0.0 station.heating_progress = 0.0
@@ -556,6 +502,7 @@ class VirtualWorkbench:
self._update_data_status(f"加热台{station_id}开始加热{material_id}") self._update_data_status(f"加热台{station_id}开始加热{material_id}")
# 打印当前所有正在加热的台位
with self._stations_lock: with self._stations_lock:
heating_list = [ heating_list = [
f"加热台{sid}:{s.current_material}" f"加热台{sid}:{s.current_material}"
@@ -564,6 +511,7 @@ class VirtualWorkbench:
] ]
self.logger.info(f"[并行加热] 当前同时加热中: {', '.join(heating_list)}") self.logger.info(f"[并行加热] 当前同时加热中: {', '.join(heating_list)}")
# 模拟加热过程
start_time = time.time() start_time = time.time()
last_countdown_log = start_time last_countdown_log = start_time
while True: while True:
@@ -576,6 +524,7 @@ class VirtualWorkbench:
self._update_data_status(f"加热台{station_id}加热中: {progress:.1f}%") self._update_data_status(f"加热台{station_id}加热中: {progress:.1f}%")
# 每5秒打印一次倒计时
if time.time() - last_countdown_log >= 5.0: if time.time() - last_countdown_log >= 5.0:
self.logger.info(f"[加热台{station_id}] {material_id} 剩余 {remaining:.1f}s") self.logger.info(f"[加热台{station_id}] {material_id} 剩余 {remaining:.1f}s")
last_countdown_log = time.time() last_countdown_log = time.time()
@@ -585,6 +534,7 @@ class VirtualWorkbench:
time.sleep(1.0) time.sleep(1.0)
# 加热完成
with self._stations_lock: with self._stations_lock:
self._heating_stations[station_id].state = HeatingStationState.COMPLETED self._heating_stations[station_id].state = HeatingStationState.COMPLETED
self._heating_stations[station_id].heating_progress = 100.0 self._heating_stations[station_id].heating_progress = 100.0
@@ -603,28 +553,10 @@ class VirtualWorkbench:
"material_number": material_number, "material_number": material_number,
"message": f"加热台{station_id}加热完成", "message": f"加热台{station_id}加热完成",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
@action(
auto_prefix=True,
description="将物料从加热台移动到输出位置Cn",
handles=[
ActionInputHandle(key="output_station_input", data_type="workbench_station",
label="加热台ID", data_key="station_id", data_source=DataSource.HANDLE),
ActionInputHandle(key="output_material_input", data_type="workbench_material",
label="物料编号", data_key="material_number", data_source=DataSource.HANDLE),
],
)
def move_to_output( def move_to_output(
self, self,
sample_uuids: SampleUUIDsType, sample_uuids: SampleUUIDsType,
@@ -633,8 +565,15 @@ class VirtualWorkbench:
) -> MoveToOutputResult: ) -> MoveToOutputResult:
""" """
将物料从加热台移动到输出位置Cn 将物料从加热台移动到输出位置Cn
Args:
station_id: 加热台ID (1-3),从 start_heating 的 handle 传入
material_number: 物料编号,从 start_heating 的 handle 传入,用于确定输出位置 Cn
Returns:
MoveToOutputResult: 包含执行结果
""" """
output_number = material_number output_number = material_number # 物料编号决定输出位置
if station_id not in self._heating_stations: if station_id not in self._heating_stations:
return { return {
@@ -644,16 +583,8 @@ class VirtualWorkbench:
"output_position": f"C{output_number}", "output_position": f"C{output_number}",
"message": f"无效的加热台ID: {station_id}", "message": f"无效的加热台ID: {station_id}",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
with self._stations_lock: with self._stations_lock:
@@ -668,16 +599,8 @@ class VirtualWorkbench:
"output_position": f"C{output_number}", "output_position": f"C{output_number}",
"message": f"加热台{station_id}上没有物料", "message": f"加热台{station_id}上没有物料",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
if station.state != HeatingStationState.COMPLETED: if station.state != HeatingStationState.COMPLETED:
@@ -688,16 +611,8 @@ class VirtualWorkbench:
"output_position": f"C{output_number}", "output_position": f"C{output_number}",
"message": f"加热台{station_id}尚未完成加热 (当前状态: {station.state.value})", "message": f"加热台{station_id}尚未完成加热 (当前状态: {station.state.value})",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
output_position = f"C{output_number}" output_position = f"C{output_number}"
@@ -709,17 +624,18 @@ class VirtualWorkbench:
if material_id in self._active_tasks: if material_id in self._active_tasks:
self._active_tasks[material_id]["status"] = "waiting_for_arm_output" self._active_tasks[material_id]["status"] = "waiting_for_arm_output"
# 获取机械臂
self._acquire_arm(task_desc) self._acquire_arm(task_desc)
with self._tasks_lock: with self._tasks_lock:
if material_id in self._active_tasks: if material_id in self._active_tasks:
self._active_tasks[material_id]["status"] = "arm_moving_to_output" self._active_tasks[material_id]["status"] = "arm_moving_to_output"
self.logger.info( # 模拟机械臂操作 (3秒)
f"[{material_id}] 机械臂正在从加热台{station_id}取出并移动到{output_position}..." self.logger.info(f"[{material_id}] 机械臂正在从加热台{station_id}取出并移动到{output_position}...")
)
time.sleep(self.ARM_OPERATION_TIME) time.sleep(self.ARM_OPERATION_TIME)
# 清空加热台
with self._stations_lock: with self._stations_lock:
self._heating_stations[station_id].state = HeatingStationState.IDLE self._heating_stations[station_id].state = HeatingStationState.IDLE
self._heating_stations[station_id].current_material = None self._heating_stations[station_id].current_material = None
@@ -727,17 +643,17 @@ class VirtualWorkbench:
self._heating_stations[station_id].heating_progress = 0.0 self._heating_stations[station_id].heating_progress = 0.0
self._heating_stations[station_id].heating_start_time = None self._heating_stations[station_id].heating_start_time = None
# 释放机械臂
self._release_arm() self._release_arm()
# 任务完成
with self._tasks_lock: with self._tasks_lock:
if material_id in self._active_tasks: if material_id in self._active_tasks:
self._active_tasks[material_id]["status"] = "completed" self._active_tasks[material_id]["status"] = "completed"
self._active_tasks[material_id]["end_time"] = time.time() self._active_tasks[material_id]["end_time"] = time.time()
self._update_data_status(f"{material_id}已移动到{output_position}") self._update_data_status(f"{material_id}已移动到{output_position}")
self.logger.info( self.logger.info(f"[{material_id}] 已成功移动到{output_position} (用时{self.ARM_OPERATION_TIME}s)")
f"[{material_id}] 已成功移动到{output_position} (用时{self.ARM_OPERATION_TIME}s)"
)
return { return {
"success": True, "success": True,
@@ -746,17 +662,8 @@ class VirtualWorkbench:
"output_position": output_position, "output_position": output_position,
"message": f"{material_id}已成功移动到{output_position}", "message": f"{material_id}已成功移动到{output_position}",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str)
else (content.serialize() if content is not None else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
except Exception as e: except Exception as e:
@@ -770,105 +677,83 @@ class VirtualWorkbench:
"output_position": output_position, "output_position": output_position,
"message": f"移动失败: {str(e)}", "message": f"移动失败: {str(e)}",
"unilabos_samples": [ "unilabos_samples": [
LabSample( LabSample(sample_uuid=sample_uuid, oss_path="", extra={"material_uuid": content} if isinstance(content, str) else content.serialize()) for
sample_uuid=sample_uuid, sample_uuid, content in sample_uuids.items()]
oss_path="",
extra=(
{"material_uuid": content}
if isinstance(content, str) else (content.serialize() if content else {})
),
)
for sample_uuid, content in sample_uuids.items()
],
} }
# ============ 状态属性 ============ # ============ 状态属性 ============
@property @property
@topic_config()
def status(self) -> str: def status(self) -> str:
return self.data.get("status", "Unknown") return self.data.get("status", "Unknown")
@property @property
@topic_config()
def arm_state(self) -> str: def arm_state(self) -> str:
return self._arm_state.value return self._arm_state.value
@property @property
@topic_config()
def arm_current_task(self) -> str: def arm_current_task(self) -> str:
return self._arm_current_task or "" return self._arm_current_task or ""
@property @property
@topic_config()
def heating_station_1_state(self) -> str: def heating_station_1_state(self) -> str:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(1) station = self._heating_stations.get(1)
return station.state.value if station else "unknown" return station.state.value if station else "unknown"
@property @property
@topic_config()
def heating_station_1_material(self) -> str: def heating_station_1_material(self) -> str:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(1) station = self._heating_stations.get(1)
return station.current_material or "" if station else "" return station.current_material or "" if station else ""
@property @property
@topic_config()
def heating_station_1_progress(self) -> float: def heating_station_1_progress(self) -> float:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(1) station = self._heating_stations.get(1)
return station.heating_progress if station else 0.0 return station.heating_progress if station else 0.0
@property @property
@topic_config()
def heating_station_2_state(self) -> str: def heating_station_2_state(self) -> str:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(2) station = self._heating_stations.get(2)
return station.state.value if station else "unknown" return station.state.value if station else "unknown"
@property @property
@topic_config()
def heating_station_2_material(self) -> str: def heating_station_2_material(self) -> str:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(2) station = self._heating_stations.get(2)
return station.current_material or "" if station else "" return station.current_material or "" if station else ""
@property @property
@topic_config()
def heating_station_2_progress(self) -> float: def heating_station_2_progress(self) -> float:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(2) station = self._heating_stations.get(2)
return station.heating_progress if station else 0.0 return station.heating_progress if station else 0.0
@property @property
@topic_config()
def heating_station_3_state(self) -> str: def heating_station_3_state(self) -> str:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(3) station = self._heating_stations.get(3)
return station.state.value if station else "unknown" return station.state.value if station else "unknown"
@property @property
@topic_config()
def heating_station_3_material(self) -> str: def heating_station_3_material(self) -> str:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(3) station = self._heating_stations.get(3)
return station.current_material or "" if station else "" return station.current_material or "" if station else ""
@property @property
@topic_config()
def heating_station_3_progress(self) -> float: def heating_station_3_progress(self) -> float:
with self._stations_lock: with self._stations_lock:
station = self._heating_stations.get(3) station = self._heating_stations.get(3)
return station.heating_progress if station else 0.0 return station.heating_progress if station else 0.0
@property @property
@topic_config()
def active_tasks_count(self) -> int: def active_tasks_count(self) -> int:
with self._tasks_lock: with self._tasks_lock:
return len(self._active_tasks) return len(self._active_tasks)
@property @property
@topic_config()
def message(self) -> str: def message(self) -> str:
return self.data.get("message", "") return self.data.get("message", "")

View File

@@ -258,7 +258,7 @@ class BioyondResourceSynchronizer(ResourceSynchronizer):
logger.info(f"[同步→Bioyond] 物料不存在于 Bioyond将创建新物料并入库") logger.info(f"[同步→Bioyond] 物料不存在于 Bioyond将创建新物料并入库")
# 第1步从配置中获取仓库配置 # 第1步从配置中获取仓库配置
warehouse_mapping = self.bioyond_config.get("warehouse_mapping", {}) warehouse_mapping = self.workstation.bioyond_config.get("warehouse_mapping", {})
# 确定目标仓库名称 # 确定目标仓库名称
parent_name = None parent_name = None

File diff suppressed because it is too large Load Diff

View File

@@ -1,614 +0,0 @@
"""
装饰器注册表系统
通过 @device, @action, @resource 装饰器替代 YAML 配置文件来定义设备/动作/资源注册表信息。
Usage:
from unilabos.registry.decorators import (
device, action, resource,
InputHandle, OutputHandle,
ActionInputHandle, ActionOutputHandle,
HardwareInterface, Side, DataSource,
)
@device(
id="solenoid_valve.mock",
category=["pump_and_valve"],
description="模拟电磁阀设备",
handles=[
InputHandle(key="in", data_type="fluid", label="in", side=Side.NORTH),
OutputHandle(key="out", data_type="fluid", label="out", side=Side.SOUTH),
],
hardware_interface=HardwareInterface(
name="hardware_interface",
read="send_command",
write="send_command",
),
)
class SolenoidValveMock:
@action(action_type=EmptyIn)
def close(self):
...
@action(
handles=[
ActionInputHandle(key="in", data_type="fluid", label="in"),
ActionOutputHandle(key="out", data_type="fluid", label="out"),
],
)
def set_valve_position(self, position):
...
# 无 @action 装饰器 => auto- 前缀动作
def is_open(self):
...
"""
from enum import Enum
from functools import wraps
from typing import Any, Callable, Dict, List, Optional, TypeVar
from pydantic import BaseModel, ConfigDict, Field
F = TypeVar("F", bound=Callable[..., Any])
# ---------------------------------------------------------------------------
# 枚举
# ---------------------------------------------------------------------------
class Side(str, Enum):
"""UI 上 Handle 的显示位置"""
NORTH = "NORTH"
SOUTH = "SOUTH"
EAST = "EAST"
WEST = "WEST"
class DataSource(str, Enum):
"""Handle 的数据来源"""
HANDLE = "handle" # 从上游 handle 获取数据 (用于 InputHandle)
EXECUTOR = "executor" # 从执行器输出数据 (用于 OutputHandle)
# ---------------------------------------------------------------------------
# Device / Resource Handle (设备/资源级别端口, 序列化时包含 io_type)
# ---------------------------------------------------------------------------
class _DeviceHandleBase(BaseModel):
"""设备/资源端口基类 (内部使用)"""
model_config = ConfigDict(populate_by_name=True)
key: str = Field(serialization_alias="handler_key")
data_type: str
label: str
side: Optional[Side] = None
data_key: Optional[str] = None
data_source: Optional[str] = None
description: Optional[str] = None
# 子类覆盖
io_type: str = ""
def to_registry_dict(self) -> Dict[str, Any]:
return self.model_dump(by_alias=True, exclude_none=True)
class InputHandle(_DeviceHandleBase):
"""
输入端口 (io_type="target"), 用于 @device / @resource handles
Example:
InputHandle(key="in", data_type="fluid", label="in", side=Side.NORTH)
"""
io_type: str = "target"
class OutputHandle(_DeviceHandleBase):
"""
输出端口 (io_type="source"), 用于 @device / @resource handles
Example:
OutputHandle(key="out", data_type="fluid", label="out", side=Side.SOUTH)
"""
io_type: str = "source"
# ---------------------------------------------------------------------------
# Action Handle (动作级别端口, 序列化时不含 io_type, 按类型自动分组)
# ---------------------------------------------------------------------------
class _ActionHandleBase(BaseModel):
"""动作端口基类 (内部使用)"""
model_config = ConfigDict(populate_by_name=True)
key: str = Field(serialization_alias="handler_key")
data_type: str
label: str
side: Optional[Side] = None
data_key: Optional[str] = None
data_source: Optional[str] = None
description: Optional[str] = None
io_type: Optional[str] = None # source/sink (dataflow) or target/source (device-style)
def to_registry_dict(self) -> Dict[str, Any]:
return self.model_dump(by_alias=True, exclude_none=True)
class ActionInputHandle(_ActionHandleBase):
"""
动作输入端口, 用于 @action handles, 序列化后归入 "input"
Example:
ActionInputHandle(
key="material_input", data_type="workbench_material",
label="物料编号", data_key="material_number", data_source="handle",
)
"""
pass
class ActionOutputHandle(_ActionHandleBase):
"""
动作输出端口, 用于 @action handles, 序列化后归入 "output"
Example:
ActionOutputHandle(
key="station_output", data_type="workbench_station",
label="加热台ID", data_key="station_id", data_source="executor",
)
"""
pass
# ---------------------------------------------------------------------------
# HardwareInterface
# ---------------------------------------------------------------------------
class HardwareInterface(BaseModel):
"""
硬件通信接口定义
描述设备与底层硬件通信的方式 (串口、Modbus 等)。
Example:
HardwareInterface(name="hardware_interface", read="send_command", write="send_command")
"""
name: str
read: Optional[str] = None
write: Optional[str] = None
extra_info: Optional[List[str]] = None
# ---------------------------------------------------------------------------
# 全局注册表 -- 记录所有被装饰器标记的类/函数
# ---------------------------------------------------------------------------
_registered_devices: Dict[str, type] = {} # device_id -> class
_registered_resources: Dict[str, Any] = {} # resource_id -> class or function
def _device_handles_to_list(
handles: Optional[List[_DeviceHandleBase]],
) -> List[Dict[str, Any]]:
"""将设备/资源 Handle 列表序列化为字典列表 (含 io_type)"""
if handles is None:
return []
return [h.to_registry_dict() for h in handles]
def _action_handles_to_dict(
handles: Optional[List[_ActionHandleBase]],
) -> Dict[str, Any]:
"""
将动作 Handle 列表序列化为 {"input": [...], "output": [...]} 格式。
ActionInputHandle => "input", ActionOutputHandle => "output"
"""
if handles is None:
return {}
input_list = [h.to_registry_dict() for h in handles if isinstance(h, ActionInputHandle)]
output_list = [h.to_registry_dict() for h in handles if isinstance(h, ActionOutputHandle)]
result: Dict[str, Any] = {}
if input_list:
result["input"] = input_list
if output_list:
result["output"] = output_list
return result
# ---------------------------------------------------------------------------
# @device 类装饰器
# ---------------------------------------------------------------------------
# noinspection PyShadowingBuiltins
def device(
id: Optional[str] = None,
ids: Optional[List[str]] = None,
id_meta: Optional[Dict[str, Dict[str, Any]]] = None,
category: Optional[List[str]] = None,
description: str = "",
display_name: str = "",
icon: str = "",
version: str = "1.0.0",
handles: Optional[List[_DeviceHandleBase]] = None,
model: Optional[Dict[str, Any]] = None,
device_type: str = "python",
hardware_interface: Optional[HardwareInterface] = None,
):
"""
设备类装饰器
将类标记为一个 UniLab-OS 设备,并附加注册表元数据。
支持两种模式:
1. 单设备: id="xxx", category=[...]
2. 多设备: ids=["id1","id2"], id_meta={"id1":{handles:[...]}, "id2":{...}}
Args:
id: 单设备时的注册表唯一标识
ids: 多设备时的 id 列表,与 id_meta 配合使用
id_meta: 每个 device_id 的覆盖元数据 (handles/description/icon/model)
category: 设备分类标签列表 (必填)
description: 设备描述
display_name: 人类可读的设备显示名称,缺失时默认使用 id
icon: 图标路径
version: 版本号
handles: 设备端口列表 (单设备或 id_meta 未覆盖时使用)
model: 可选的 3D 模型配置
device_type: 设备实现类型 ("python" / "ros2")
hardware_interface: 硬件通信接口 (HardwareInterface)
"""
# Resolve device ids
if ids is not None:
device_ids = list(ids)
if not device_ids:
raise ValueError("@device ids 不能为空")
id_meta = id_meta or {}
elif id is not None:
device_ids = [id]
id_meta = {}
else:
raise ValueError("@device 必须提供 id 或 ids")
if category is None:
raise ValueError("@device category 必填")
base_meta = {
"category": category,
"description": description,
"display_name": display_name,
"icon": icon,
"version": version,
"handles": _device_handles_to_list(handles),
"model": model,
"device_type": device_type,
"hardware_interface": (hardware_interface.model_dump(exclude_none=True) if hardware_interface else None),
}
def decorator(cls):
cls._device_registry_meta = base_meta
cls._device_registry_id_meta = id_meta
cls._device_registry_ids = device_ids
for did in device_ids:
if did in _registered_devices:
raise ValueError(f"@device id 重复: '{did}' 已被 {_registered_devices[did]} 注册")
_registered_devices[did] = cls
return cls
return decorator
# ---------------------------------------------------------------------------
# @action 方法装饰器
# ---------------------------------------------------------------------------
# 区分 "用户没传 action_type" 和 "用户传了 None"
_ACTION_TYPE_UNSET = object()
# noinspection PyShadowingNames
def action(
action_type: Any = _ACTION_TYPE_UNSET,
goal: Optional[Dict[str, str]] = None,
feedback: Optional[Dict[str, str]] = None,
result: Optional[Dict[str, str]] = None,
handles: Optional[List[_ActionHandleBase]] = None,
goal_default: Optional[Dict[str, Any]] = None,
placeholder_keys: Optional[Dict[str, str]] = None,
always_free: bool = False,
is_protocol: bool = False,
description: str = "",
auto_prefix: bool = False,
parent: bool = False,
):
"""
动作方法装饰器
标记方法为注册表动作。有三种用法:
1. @action(action_type=EmptyIn, ...) -- 非 auto, 使用指定 ROS Action 类型
2. @action() -- 非 auto, UniLabJsonCommand (从方法签名生成 schema)
3. 不加 @action -- auto- 前缀, UniLabJsonCommand
Protocol 用法:
@action(action_type=Add, is_protocol=True)
def AddProtocol(self): ...
标记该动作为高级协议 (protocol),运行时通过 ROS Action 路由到
protocol generator 执行。action_type 指向 unilabos_msgs 的 Action 类型。
Args:
action_type: ROS Action 消息类型 (如 EmptyIn, SendCmd, HeatChill).
不传/默认 = UniLabJsonCommand (非 auto).
goal: Goal 字段映射 (ROS字段名 -> 设备参数名).
protocol 模式下可留空,系统自动生成 identity 映射.
feedback: Feedback 字段映射
result: Result 字段映射
handles: 动作端口列表 (ActionInputHandle / ActionOutputHandle)
goal_default: Goal 字段默认值映射 (字段名 -> 默认值), 与自动生成的 goal_default 合并
placeholder_keys: 参数占位符配置
always_free: 是否为永久闲置动作 (不受排队限制)
is_protocol: 是否为工作站协议 (protocol)。True 时运行时走 protocol generator 路径。
description: 动作描述
auto_prefix: 若为 True动作名使用 auto-{method_name} 形式(与无 @action 时一致)
parent: 若为 True当方法参数为空 (*args, **kwargs) 时,通过 MRO 从父类获取真实方法参数
"""
def decorator(func: F) -> F:
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
# action_type 为哨兵值 => 用户没传, 视为 None (UniLabJsonCommand)
resolved_type = None if action_type is _ACTION_TYPE_UNSET else action_type
meta = {
"action_type": resolved_type,
"goal": goal or {},
"feedback": feedback or {},
"result": result or {},
"handles": _action_handles_to_dict(handles),
"goal_default": goal_default or {},
"placeholder_keys": placeholder_keys or {},
"always_free": always_free,
"is_protocol": is_protocol,
"description": description,
"auto_prefix": auto_prefix,
"parent": parent,
}
wrapper._action_registry_meta = meta # type: ignore[attr-defined]
# 设置 _is_always_free 保持与旧 @always_free 装饰器兼容
if always_free:
wrapper._is_always_free = True # type: ignore[attr-defined]
return wrapper # type: ignore[return-value]
return decorator
def get_action_meta(func) -> Optional[Dict[str, Any]]:
"""获取方法上的 @action 装饰器元数据"""
return getattr(func, "_action_registry_meta", None)
def has_action_decorator(func) -> bool:
"""检查函数是否带有 @action 装饰器"""
return hasattr(func, "_action_registry_meta")
# ---------------------------------------------------------------------------
# @resource 类/函数装饰器
# ---------------------------------------------------------------------------
def resource(
id: str,
category: List[str],
description: str = "",
icon: str = "",
version: str = "1.0.0",
handles: Optional[List[_DeviceHandleBase]] = None,
model: Optional[Dict[str, Any]] = None,
class_type: str = "pylabrobot",
):
"""
资源类/函数装饰器
将类或工厂函数标记为一个 UniLab-OS 资源,附加注册表元数据。
Args:
id: 注册表唯一标识 (必填, 不可重复)
category: 资源分类标签列表 (必填)
description: 资源描述
icon: 图标路径
version: 版本号
handles: 端口列表 (InputHandle / OutputHandle)
model: 可选的 3D 模型配置
class_type: 资源实现类型 ("python" / "pylabrobot" / "unilabos")
"""
def decorator(obj):
meta = {
"resource_id": id,
"category": category,
"description": description,
"icon": icon,
"version": version,
"handles": _device_handles_to_list(handles),
"model": model,
"class_type": class_type,
}
obj._resource_registry_meta = meta
if id in _registered_resources:
raise ValueError(f"@resource id 重复: '{id}' 已被 {_registered_resources[id]} 注册")
_registered_resources[id] = obj
return obj
return decorator
def get_device_meta(cls, device_id: Optional[str] = None) -> Optional[Dict[str, Any]]:
"""
获取类上的 @device 装饰器元数据。
当 device_id 存在且类使用 ids+id_meta 时,返回合并后的 meta
(base_meta 与 id_meta[device_id] 深度合并)。
"""
base = getattr(cls, "_device_registry_meta", None)
if base is None:
return None
id_meta = getattr(cls, "_device_registry_id_meta", None) or {}
if device_id is None or device_id not in id_meta:
result = dict(base)
ids = getattr(cls, "_device_registry_ids", None)
result["device_id"] = device_id if device_id is not None else (ids[0] if ids else None)
return result
overrides = id_meta[device_id]
result = dict(base)
result["device_id"] = device_id
for key in ["handles", "description", "icon", "model"]:
if key in overrides:
val = overrides[key]
if key == "handles" and isinstance(val, list):
# handles 必须是 Handle 对象列表
result[key] = [h.to_registry_dict() for h in val]
else:
result[key] = val
return result
def get_resource_meta(obj) -> Optional[Dict[str, Any]]:
"""获取对象上的 @resource 装饰器元数据"""
return getattr(obj, "_resource_registry_meta", None)
def get_all_registered_devices() -> Dict[str, type]:
"""获取所有已注册的设备类"""
return _registered_devices.copy()
def get_all_registered_resources() -> Dict[str, Any]:
"""获取所有已注册的资源"""
return _registered_resources.copy()
def clear_registry():
"""清空全局注册表 (用于测试)"""
_registered_devices.clear()
_registered_resources.clear()
# ---------------------------------------------------------------------------
# topic_config / not_action / always_free 装饰器
# ---------------------------------------------------------------------------
def topic_config(
period: Optional[float] = None,
print_publish: Optional[bool] = None,
qos: Optional[int] = None,
name: Optional[str] = None,
) -> Callable[[F], F]:
"""
Topic发布配置装饰器
用于装饰 get_{attr_name} 方法或 @property控制对应属性的ROS topic发布行为。
Args:
period: 发布周期。None 表示使用默认值 5.0
print_publish: 是否打印发布日志。None 表示使用节点默认配置
qos: QoS深度配置。None 表示使用默认值 10
name: 自定义发布名称。None 表示使用方法名(去掉 get_ 前缀)
Note:
与 @property 连用时,@topic_config 必须放在 @property 下面,
这样装饰器执行顺序为:先 topic_config 添加配置,再 property 包装。
"""
def decorator(func: F) -> F:
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper._topic_period = period # type: ignore[attr-defined]
wrapper._topic_print_publish = print_publish # type: ignore[attr-defined]
wrapper._topic_qos = qos # type: ignore[attr-defined]
wrapper._topic_name = name # type: ignore[attr-defined]
wrapper._has_topic_config = True # type: ignore[attr-defined]
return wrapper # type: ignore[return-value]
return decorator
def get_topic_config(func) -> dict:
"""获取函数上的 topic 配置 (period, print_publish, qos, name)"""
if hasattr(func, "_has_topic_config") and getattr(func, "_has_topic_config", False):
return {
"period": getattr(func, "_topic_period", None),
"print_publish": getattr(func, "_topic_print_publish", None),
"qos": getattr(func, "_topic_qos", None),
"name": getattr(func, "_topic_name", None),
}
return {}
def always_free(func: F) -> F:
"""
标记动作为永久闲置(不受busy队列限制)的装饰器
被此装饰器标记的 action 方法,在执行时不会受到设备级别的排队限制,
任何时候请求都可以立即执行。适用于查询类、状态读取类等轻量级操作。
"""
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper._is_always_free = True # type: ignore[attr-defined]
return wrapper # type: ignore[return-value]
def is_always_free(func) -> bool:
"""检查函数是否被标记为永久闲置"""
return getattr(func, "_is_always_free", False)
def not_action(func: F) -> F:
"""
标记方法为非动作的装饰器
用于装饰 driver 类中的方法,使其在注册表扫描时不被识别为动作。
适用于辅助方法、内部工具方法等不应暴露为设备动作的公共方法。
"""
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper._is_not_action = True # type: ignore[attr-defined]
return wrapper # type: ignore[return-value]
def is_not_action(func) -> bool:
"""检查函数是否被标记为非动作"""
return getattr(func, "_is_not_action", False)

View File

@@ -13,18 +13,21 @@ Qone_nmr:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -68,6 +71,31 @@ Qone_nmr:
title: monitor_folder_for_new_content参数 title: monitor_folder_for_new_content参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
ros_node:
type: string
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-strings_to_txt: auto-strings_to_txt:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -110,18 +138,21 @@ Qone_nmr:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -136,31 +167,32 @@ Qone_nmr:
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:

View File

@@ -22,8 +22,7 @@ bioyond_cell:
required: required:
- xlsx_path - xlsx_path
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: auto_batch_outbound_from_xlsx参数 title: auto_batch_outbound_from_xlsx参数
@@ -491,9 +490,7 @@ bioyond_cell:
goal: goal:
properties: properties:
material_names: material_names:
items: type: string
type: string
type: array
type_id: type_id:
default: 3a190ca0-b2f6-9aeb-8067-547e72c11469 default: 3a190ca0-b2f6-9aeb-8067-547e72c11469
type: string type: string
@@ -502,8 +499,7 @@ bioyond_cell:
type: string type: string
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: create_and_inbound_materials参数 title: create_and_inbound_materials参数
@@ -539,8 +535,7 @@ bioyond_cell:
- type_id - type_id
- warehouse_name - warehouse_name
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: create_material参数 title: create_material参数
@@ -561,16 +556,11 @@ bioyond_cell:
goal: goal:
properties: properties:
mappings: mappings:
additionalProperties:
type: object
type: object type: object
required: required:
- mappings - mappings
type: object type: object
result: result: {}
items:
type: object
type: array
required: required:
- goal - goal
title: create_materials参数 title: create_materials参数
@@ -602,8 +592,7 @@ bioyond_cell:
required: required:
- xlsx_path - xlsx_path
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: create_orders参数 title: create_orders参数
@@ -635,8 +624,7 @@ bioyond_cell:
required: required:
- xlsx_path - xlsx_path
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: create_orders_v2参数 title: create_orders_v2参数
@@ -677,8 +665,7 @@ bioyond_cell:
- bottle_type - bottle_type
- location_code - location_code
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: create_sample参数 title: create_sample参数
@@ -731,8 +718,7 @@ bioyond_cell:
type: string type: string
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: order_list_v2参数 title: order_list_v2参数
@@ -835,8 +821,7 @@ bioyond_cell:
required: required:
- material_obj - material_obj
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: report_material_change参数 title: report_material_change参数
@@ -890,8 +875,7 @@ bioyond_cell:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: scheduler_continue参数 title: scheduler_continue参数
@@ -912,8 +896,7 @@ bioyond_cell:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: scheduler_reset参数 title: scheduler_reset参数
@@ -934,8 +917,7 @@ bioyond_cell:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: scheduler_start参数 title: scheduler_start参数
@@ -1380,8 +1362,7 @@ bioyond_cell:
type: string type: string
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: scheduler_start_and_auto_feeding参数 title: scheduler_start_and_auto_feeding参数
@@ -1826,8 +1807,7 @@ bioyond_cell:
type: string type: string
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: scheduler_start_and_auto_feeding_v2参数 title: scheduler_start_and_auto_feeding_v2参数
@@ -1848,8 +1828,7 @@ bioyond_cell:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: scheduler_stop参数 title: scheduler_stop参数
@@ -1871,15 +1850,12 @@ bioyond_cell:
properties: properties:
items: items:
items: items:
additionalProperties:
type: string
type: object type: object
type: array type: array
required: required:
- items - items
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: storage_batch_inbound参数 title: storage_batch_inbound参数
@@ -1908,8 +1884,7 @@ bioyond_cell:
- material_id - material_id
- location_id - location_id
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: storage_inbound参数 title: storage_inbound参数
@@ -1930,8 +1905,7 @@ bioyond_cell:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: transfer_1_to_2参数 title: transfer_1_to_2参数
@@ -1972,8 +1946,7 @@ bioyond_cell:
type: integer type: integer
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: transfer_3_to_2参数 title: transfer_3_to_2参数
@@ -2010,8 +1983,7 @@ bioyond_cell:
type: integer type: integer
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: transfer_3_to_2_to_1参数 title: transfer_3_to_2_to_1参数
@@ -2035,11 +2007,10 @@ bioyond_cell:
ip: ip:
type: string type: string
port: port:
type: integer type: string
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: update_push_ip参数 title: update_push_ip参数
@@ -2068,8 +2039,7 @@ bioyond_cell:
required: required:
- order_code - order_code
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: wait_for_order_finish参数 title: wait_for_order_finish参数
@@ -2102,8 +2072,7 @@ bioyond_cell:
required: required:
- order_code - order_code
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: wait_for_order_finish_polling参数 title: wait_for_order_finish_polling参数
@@ -2135,8 +2104,7 @@ bioyond_cell:
type: integer type: integer
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: wait_for_transfer_task参数 title: wait_for_transfer_task参数
@@ -2144,7 +2112,8 @@ bioyond_cell:
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.workstation.bioyond_studio.bioyond_cell.bioyond_cell_workstation:BioyondCellWorkstation module: unilabos.devices.workstation.bioyond_studio.bioyond_cell.bioyond_cell_workstation:BioyondCellWorkstation
status_types: status_types:
device_id: '' device_id: String
material_info: dict
type: python type: python
config_info: [] config_info: []
description: '' description: ''
@@ -2165,7 +2134,11 @@ bioyond_cell:
properties: properties:
device_id: device_id:
type: string type: string
material_info:
type: object
required: required:
- device_id - device_id
- material_info
type: object type: object
registry_type: device
version: 1.0.0 version: 1.0.0

View File

@@ -24,8 +24,7 @@ bioyond_dispensing_station:
required: required:
- data - data
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: brief_step_parameters参数 title: brief_step_parameters参数
@@ -54,8 +53,7 @@ bioyond_dispensing_station:
- report_request - report_request
- used_materials - used_materials
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: process_order_finish_report参数 title: process_order_finish_report参数
@@ -80,8 +78,7 @@ bioyond_dispensing_station:
required: required:
- order_id - order_id
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: project_order_report参数 title: project_order_report参数
@@ -131,8 +128,7 @@ bioyond_dispensing_station:
required: required:
- workflow_id - workflow_id
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: workflow_sample_locations参数 title: workflow_sample_locations参数
@@ -148,12 +144,12 @@ bioyond_dispensing_station:
temperature: temperature temperature: temperature
titration: titration titration: titration
goal_default: goal_default:
delay_time: null delay_time: '600'
hold_m_name: null hold_m_name: ''
liquid_material_name: NMP liquid_material_name: NMP
speed: null speed: '400'
temperature: null temperature: '40'
titration: null titration: ''
handles: handles:
input: input:
- data_key: titration - data_key: titration
@@ -169,16 +165,20 @@ bioyond_dispensing_station:
handler_key: BATCH_CREATE_RESULT handler_key: BATCH_CREATE_RESULT
io_type: sink io_type: sink
label: Complete Batch Create Result JSON (contains order_codes and order_ids) label: Complete Batch Create Result JSON (contains order_codes and order_ids)
placeholder_keys: {} result:
result: {} return_info: return_info
schema: schema:
description: 批量创建90%10%小瓶投料任务。从计算节点接收titration数据,包含物料名称、主称固体质量、滴定固体质量和滴定溶剂体积。返回的return_info中包含order_codes和order_ids列表。 description: 批量创建90%10%小瓶投料任务。从计算节点接收titration数据,包含物料名称、主称固体质量、滴定固体质量和滴定溶剂体积。返回的return_info中包含order_codes和order_ids列表。
properties: properties:
feedback: feedback:
properties: {}
required: []
title: BatchCreate9010VialFeedingTasks_Feedback title: BatchCreate9010VialFeedingTasks_Feedback
type: object
goal: goal:
properties: properties:
delay_time: delay_time:
default: '600'
description: 延迟时间(秒),默认600 description: 延迟时间(秒),默认600
type: string type: string
hold_m_name: hold_m_name:
@@ -189,9 +189,11 @@ bioyond_dispensing_station:
description: 10%物料的液体物料名称,默认为"NMP" description: 10%物料的液体物料名称,默认为"NMP"
type: string type: string
speed: speed:
default: '400'
description: 搅拌速度,默认400 description: 搅拌速度,默认400
type: string type: string
temperature: temperature:
default: '40'
description: 温度(℃),默认40 description: 温度(℃),默认40
type: string type: string
titration: titration:
@@ -200,14 +202,21 @@ bioyond_dispensing_station:
type: string type: string
required: required:
- titration - titration
- hold_m_name
title: BatchCreate9010VialFeedingTasks_Goal title: BatchCreate9010VialFeedingTasks_Goal
type: object type: object
result: result:
properties:
return_info:
description: 批量任务创建结果汇总JSON字符串包含total(总数)、success(成功数)、failed(失败数)、order_codes(任务编码数组)、order_ids(任务ID数组)、details(每个任务的详细信息)
type: string
required:
- return_info
title: BatchCreate9010VialFeedingTasks_Result title: BatchCreate9010VialFeedingTasks_Result
type: string type: object
required: required:
- goal - goal
title: batch_create_90_10_vial_feeding_tasks参数 title: BatchCreate9010VialFeedingTasks
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
batch_create_diamine_solution_tasks: batch_create_diamine_solution_tasks:
@@ -219,11 +228,11 @@ bioyond_dispensing_station:
speed: speed speed: speed
temperature: temperature temperature: temperature
goal_default: goal_default:
delay_time: null delay_time: '600'
liquid_material_name: NMP liquid_material_name: NMP
solutions: null solutions: ''
speed: null speed: '400'
temperature: null temperature: '20'
handles: handles:
input: input:
- data_key: solutions - data_key: solutions
@@ -239,16 +248,20 @@ bioyond_dispensing_station:
handler_key: BATCH_CREATE_RESULT handler_key: BATCH_CREATE_RESULT
io_type: sink io_type: sink
label: Complete Batch Create Result JSON (contains order_codes and order_ids) label: Complete Batch Create Result JSON (contains order_codes and order_ids)
placeholder_keys: {} result:
result: {} return_info: return_info
schema: schema:
description: 批量创建二胺溶液配置任务。自动为多个二胺样品创建溶液配置任务每个任务包含固体物料称量、溶剂添加、搅拌混合等步骤。返回的return_info中包含order_codes和order_ids列表。 description: 批量创建二胺溶液配置任务。自动为多个二胺样品创建溶液配置任务每个任务包含固体物料称量、溶剂添加、搅拌混合等步骤。返回的return_info中包含order_codes和order_ids列表。
properties: properties:
feedback: feedback:
properties: {}
required: []
title: BatchCreateDiamineSolutionTasks_Feedback title: BatchCreateDiamineSolutionTasks_Feedback
type: object
goal: goal:
properties: properties:
delay_time: delay_time:
default: '600'
description: 溶液配置完成后的延迟时间用于充分混合和溶解默认600秒 description: 溶液配置完成后的延迟时间用于充分混合和溶解默认600秒
type: string type: string
liquid_material_name: liquid_material_name:
@@ -262,9 +275,11 @@ bioyond_dispensing_station:
4.5, "solvent_volume": 18}]' 4.5, "solvent_volume": 18}]'
type: string type: string
speed: speed:
default: '400'
description: 搅拌速度rpm用于混合溶液默认400转/分钟 description: 搅拌速度rpm用于混合溶液默认400转/分钟
type: string type: string
temperature: temperature:
default: '20'
description: 配置温度溶液配置过程的目标温度默认20℃室温 description: 配置温度溶液配置过程的目标温度默认20℃室温
type: string type: string
required: required:
@@ -272,11 +287,17 @@ bioyond_dispensing_station:
title: BatchCreateDiamineSolutionTasks_Goal title: BatchCreateDiamineSolutionTasks_Goal
type: object type: object
result: result:
properties:
return_info:
description: 批量任务创建结果汇总JSON字符串包含total(总数)、success(成功数)、failed(失败数)、order_codes(任务编码数组)、order_ids(任务ID数组)、details(每个任务的详细信息)
type: string
required:
- return_info
title: BatchCreateDiamineSolutionTasks_Result title: BatchCreateDiamineSolutionTasks_Result
type: string type: object
required: required:
- goal - goal
title: batch_create_diamine_solution_tasks参数 title: BatchCreateDiamineSolutionTasks
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
compute_experiment_design: compute_experiment_design:
@@ -288,7 +309,7 @@ bioyond_dispensing_station:
wt_percent: wt_percent wt_percent: wt_percent
goal_default: goal_default:
m_tot: '70' m_tot: '70'
ratio: null ratio: ''
titration_percent: '0.03' titration_percent: '0.03'
wt_percent: '0.25' wt_percent: '0.25'
handles: handles:
@@ -317,8 +338,12 @@ bioyond_dispensing_station:
handler_key: feeding_order handler_key: feeding_order
io_type: sink io_type: sink
label: Feeding Order Data From Calculation Node label: Feeding Order Data From Calculation Node
placeholder_keys: {} result:
result: {} feeding_order: feeding_order
return_info: return_info
solutions: solutions
solvents: solvents
titration: titration
schema: schema:
description: 计算实验设计输出solutions/titration/solvents/feeding_order用于后续节点。 description: 计算实验设计输出solutions/titration/solvents/feeding_order用于后续节点。
properties: properties:
@@ -331,7 +356,7 @@ bioyond_dispensing_station:
type: string type: string
ratio: ratio:
description: 组分摩尔比的对象,保持输入顺序,如{"MDA":1,"BTDA":1} description: 组分摩尔比的对象,保持输入顺序,如{"MDA":1,"BTDA":1}
type: object type: string
titration_percent: titration_percent:
default: '0.03' default: '0.03'
description: 滴定比例(10%部分) description: 滴定比例(10%部分)
@@ -346,23 +371,14 @@ bioyond_dispensing_station:
result: result:
properties: properties:
feeding_order: feeding_order:
items: {}
title: Feeding Order
type: array type: array
return_info: return_info:
title: Return Info
type: string type: string
solutions: solutions:
items: {}
title: Solutions
type: array type: array
solvents: solvents:
additionalProperties: true
title: Solvents
type: object type: object
titration: titration:
additionalProperties: true
title: Titration
type: object type: object
required: required:
- solutions - solutions
@@ -370,11 +386,11 @@ bioyond_dispensing_station:
- solvents - solvents
- feeding_order - feeding_order
- return_info - return_info
title: ComputeExperimentDesignReturn title: ComputeExperimentDesign_Result
type: object type: object
required: required:
- goal - goal
title: compute_experiment_design参数 title: ComputeExperimentDesign
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
create_90_10_vial_feeding_task: create_90_10_vial_feeding_task:
@@ -428,18 +444,17 @@ bioyond_dispensing_station:
speed: '' speed: ''
temperature: '' temperature: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: DispenStationVialFeed_Feedback title: DispenStationVialFeed_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
delay_time: delay_time:
type: string type: string
@@ -487,13 +502,38 @@ bioyond_dispensing_station:
type: string type: string
temperature: temperature:
type: string type: string
required:
- order_name
- percent_90_1_assign_material_name
- percent_90_1_target_weigh
- percent_90_2_assign_material_name
- percent_90_2_target_weigh
- percent_90_3_assign_material_name
- percent_90_3_target_weigh
- percent_10_1_assign_material_name
- percent_10_1_target_weigh
- percent_10_1_volume
- percent_10_1_liquid_material_name
- percent_10_2_assign_material_name
- percent_10_2_target_weigh
- percent_10_2_volume
- percent_10_2_liquid_material_name
- percent_10_3_assign_material_name
- percent_10_3_target_weigh
- percent_10_3_volume
- percent_10_3_liquid_material_name
- speed
- temperature
- delay_time
- hold_m_name
title: DispenStationVialFeed_Goal title: DispenStationVialFeed_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: DispenStationVialFeed_Result title: DispenStationVialFeed_Result
type: object type: object
required: required:
@@ -524,18 +564,17 @@ bioyond_dispensing_station:
temperature: '' temperature: ''
volume: '' volume: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: DispenStationSolnPrep_Feedback title: DispenStationSolnPrep_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
delay_time: delay_time:
type: string type: string
@@ -555,13 +594,24 @@ bioyond_dispensing_station:
type: string type: string
volume: volume:
type: string type: string
required:
- order_name
- material_name
- target_weigh
- volume
- liquid_material_name
- speed
- temperature
- delay_time
- hold_m_name
title: DispenStationSolnPrep_Goal title: DispenStationSolnPrep_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: DispenStationSolnPrep_Result title: DispenStationSolnPrep_Result
type: object type: object
required: required:
@@ -574,8 +624,8 @@ bioyond_dispensing_station:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
schema: schema:
description: 启动调度器 - 启动Bioyond配液站的任务调度器开始执行队列中的任务 description: 启动调度器 - 启动Bioyond配液站的任务调度器开始执行队列中的任务
properties: properties:
@@ -585,6 +635,12 @@ bioyond_dispensing_station:
required: [] required: []
type: object type: object
result: result:
properties:
return_info:
description: 调度器启动结果成功返回1失败返回0
type: integer
required:
- return_info
title: scheduler_start结果 title: scheduler_start结果
type: object type: object
required: required:
@@ -598,8 +654,8 @@ bioyond_dispensing_station:
target_device_id: target_device_id target_device_id: target_device_id
transfer_groups: transfer_groups transfer_groups: transfer_groups
goal_default: goal_default:
target_device_id: null target_device_id: ''
transfer_groups: null transfer_groups: ''
handles: {} handles: {}
placeholder_keys: placeholder_keys:
target_device_id: unilabos_devices target_device_id: unilabos_devices
@@ -615,13 +671,32 @@ bioyond_dispensing_station:
type: string type: string
transfer_groups: transfer_groups:
description: 转移任务组列表,每组包含物料名称、目标堆栈和目标库位,可以添加多组 description: 转移任务组列表,每组包含物料名称、目标堆栈和目标库位,可以添加多组
items:
properties:
materials:
description: 物料名称手动输入系统将通过RPC查询验证
type: string
target_sites:
description: 目标库位(手动输入,如"A01"
type: string
target_stack:
description: 目标堆栈名称(从列表选择)
enum:
- 堆栈1左
- 堆栈1右
- 站内试剂存放堆栈
type: string
required:
- materials
- target_stack
- target_sites
type: object
type: array type: array
required: required:
- target_device_id - target_device_id
- transfer_groups - transfer_groups
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: transfer_materials_to_reaction_station参数 title: transfer_materials_to_reaction_station参数
@@ -634,9 +709,9 @@ bioyond_dispensing_station:
check_interval: check_interval check_interval: check_interval
timeout: timeout timeout: timeout
goal_default: goal_default:
batch_create_result: null batch_create_result: ''
check_interval: 10 check_interval: '10'
timeout: 7200 timeout: '7200'
handles: handles:
input: input:
- data_key: batch_create_result - data_key: batch_create_result
@@ -652,35 +727,47 @@ bioyond_dispensing_station:
handler_key: batch_reports_result handler_key: batch_reports_result
io_type: sink io_type: sink
label: Batch Order Completion Reports label: Batch Order Completion Reports
placeholder_keys: {} result:
result: {} return_info: return_info
schema: schema:
description: 同时等待多个任务完成并获取所有实验报告。从上游batch_create任务接收包含order_codes和order_ids的结果对象并行监控所有任务状态并返回每个任务的报告。 description: 同时等待多个任务完成并获取所有实验报告。从上游batch_create任务接收包含order_codes和order_ids的结果对象并行监控所有任务状态并返回每个任务的报告。
properties: properties:
feedback: feedback:
properties: {}
required: []
title: WaitForMultipleOrdersAndGetReports_Feedback title: WaitForMultipleOrdersAndGetReports_Feedback
type: object
goal: goal:
properties: properties:
batch_create_result: batch_create_result:
description: 批量创建任务的返回结果对象包含order_codes和order_ids数组。从上游batch_create节点通过handle传递 description: 批量创建任务的返回结果对象包含order_codes和order_ids数组。从上游batch_create节点通过handle传递
type: string type: string
check_interval: check_interval:
default: 10 default: '10'
description: 检查任务状态的时间间隔默认每10秒检查一次所有待完成任务 description: 检查任务状态的时间间隔默认每10秒检查一次所有待完成任务
type: integer type: string
timeout: timeout:
default: 7200 default: '7200'
description: 等待超时时间默认7200秒2小时。超过此时间未完成的任务将标记为timeout description: 等待超时时间默认7200秒2小时。超过此时间未完成的任务将标记为timeout
type: integer type: string
required: [] required:
- batch_create_result
title: WaitForMultipleOrdersAndGetReports_Goal title: WaitForMultipleOrdersAndGetReports_Goal
type: object type: object
result: result:
properties:
return_info:
description: 'JSON格式的批量任务完成信息包含: total(总数), completed(成功数), timeout(超时数),
error(错误数), elapsed_time(总耗时), reports(报告数组每个元素包含order_code,
order_id, status, completion_status, report, elapsed_time)'
type: string
required:
- return_info
title: WaitForMultipleOrdersAndGetReports_Result title: WaitForMultipleOrdersAndGetReports_Result
type: object type: object
required: required:
- goal - goal
title: wait_for_multiple_orders_and_get_reports参数 title: WaitForMultipleOrdersAndGetReports
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.workstation.bioyond_studio.dispensing_station.dispensing_station:BioyondDispensingStation module: unilabos.devices.workstation.bioyond_studio.dispensing_station.dispensing_station:BioyondDispensingStation

View File

@@ -0,0 +1,81 @@
camera:
category:
- camera
class:
action_value_mappings:
auto-destroy_node:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 用于安全地关闭摄像头设备释放摄像头资源停止视频采集和发布服务。调用此函数将清理OpenCV摄像头连接并销毁ROS2节点。
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: destroy_node参数
type: object
type: UniLabJsonCommand
auto-timer_callback:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 定时器回调函数的参数schema。此函数负责定期采集摄像头视频帧将OpenCV格式的图像转换为ROS Image消息格式并发布到指定的视频话题。默认以10Hz频率执行确保视频流的连续性和实时性。
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: timer_callback参数
type: object
type: UniLabJsonCommand
module: unilabos.ros.nodes.presets.camera:VideoPublisher
status_types: {}
type: ros2
config_info: []
description: VideoPublisher摄像头设备节点用于实时视频采集和流媒体发布。该设备通过OpenCV连接本地摄像头如USB摄像头、内置摄像头等定时采集视频帧并将其转换为ROS2的sensor_msgs/Image消息格式发布到视频话题。主要用于实验室自动化系统中的视觉监控、图像分析、实时观察等应用场景。支持可配置的摄像头索引、发布频率等参数。
handles: []
icon: ''
init_param_schema:
config:
properties:
camera_index:
default: 0
type: string
device_id:
default: video_publisher
type: string
device_uuid:
default: ''
type: string
period:
default: 0.1
type: number
registry_name:
default: ''
type: string
resource_tracker:
type: object
required: []
type: object
data:
properties: {}
required: []
type: object
version: 1.0.0

View File

@@ -18,7 +18,7 @@ cameracontroller_device:
goal: goal:
properties: properties:
config: config:
type: object type: string
required: [] required: []
type: object type: object
result: {} result: {}
@@ -42,8 +42,7 @@ cameracontroller_device:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: stop参数 title: stop参数
@@ -51,7 +50,7 @@ cameracontroller_device:
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.cameraSII.cameraUSB:CameraController module: unilabos.devices.cameraSII.cameraUSB:CameraController
status_types: status_types:
status: Dict[str, Any] status: dict
type: python type: python
config_info: [] config_info: []
description: Uni-Lab-OS 摄像头驱动Linux USB 摄像头版,无 PTZ description: Uni-Lab-OS 摄像头驱动Linux USB 摄像头版,无 PTZ
@@ -104,4 +103,5 @@ cameracontroller_device:
required: required:
- status - status
type: object type: object
registry_type: device
version: 1.0.0 version: 1.0.0

View File

@@ -141,26 +141,30 @@ hplc.agilent:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -171,6 +175,7 @@ hplc.agilent:
module: unilabos.devices.hplc.AgilentHPLC:HPLCDriver module: unilabos.devices.hplc.AgilentHPLC:HPLCDriver
status_types: status_types:
could_run: bool could_run: bool
data_file: String
device_status: str device_status: str
driver_init_ok: bool driver_init_ok: bool
finish_status: str finish_status: str
@@ -194,6 +199,10 @@ hplc.agilent:
properties: properties:
could_run: could_run:
type: boolean type: boolean
data_file:
items:
type: string
type: array
device_status: device_status:
type: string type: string
driver_init_ok: driver_init_ok:
@@ -207,13 +216,14 @@ hplc.agilent:
success: success:
type: boolean type: boolean
required: required:
- could_run
- device_status
- driver_init_ok
- finish_status
- is_running
- status_text - status_text
- device_status
- could_run
- driver_init_ok
- is_running
- success - success
- finish_status
- data_file
type: object type: object
version: 1.0.0 version: 1.0.0
hplc.agilent-zhida: hplc.agilent-zhida:
@@ -226,25 +236,26 @@ hplc.agilent-zhida:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -304,18 +315,21 @@ hplc.agilent-zhida:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -327,35 +341,35 @@ hplc.agilent-zhida:
feedback: {} feedback: {}
goal: goal:
string: string string: string
text: text
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -393,7 +407,7 @@ hplc.agilent-zhida:
status: status:
type: object type: object
required: required:
- methods
- status - status
- methods
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -120,41 +120,42 @@ raman.home_made:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
raman_cmd: raman_cmd:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:

View File

@@ -19,8 +19,7 @@ separator.chinwe:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: connect参数 title: connect参数
@@ -66,145 +65,135 @@ separator.chinwe:
required: required:
- command_dict - command_dict
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: execute_command_from_outer参数 title: execute_command_from_outer参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
motor_rotate_quarter: motor_rotate_quarter:
feedback: {}
goal: goal:
direction: 顺时针 direction: 顺时针
motor_id: 4 motor_id: 4
speed: 60 speed: 60
goal_default:
direction: 顺时针
motor_id: null
speed: 60
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 电机旋转 1/4 圈 description: 电机旋转 1/4 圈
properties: properties:
feedback: {}
goal: goal:
properties: properties:
direction: direction:
default: 顺时针 default: 顺时针
description: 旋转方向 description: 旋转方向
enum:
- 顺时针
- 逆时针
type: string type: string
motor_id: motor_id:
default: '4'
description: 选择电机 (4:搅拌, 5:旋钮) description: 选择电机 (4:搅拌, 5:旋钮)
type: integer enum:
- '4'
- '5'
type: string
speed: speed:
default: 60 default: 60
description: 速度 (RPM) description: 速度 (RPM)
type: integer type: integer
required: required:
- motor_id - motor_id
- speed
type: object type: object
result: {}
required:
- goal
title: motor_rotate_quarter参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
motor_run_continuous: motor_run_continuous:
feedback: {}
goal: goal:
direction: 顺时针 direction: 顺时针
motor_id: 4 motor_id: 4
speed: 60 speed: 60
goal_default:
direction: 顺时针
motor_id: null
speed: null
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 电机一直旋转 (速度模式) description: 电机一直旋转 (速度模式)
properties: properties:
feedback: {}
goal: goal:
properties: properties:
direction: direction:
default: 顺时针 default: 顺时针
description: 旋转方向 description: 旋转方向
enum:
- 顺时针
- 逆时针
type: string type: string
motor_id: motor_id:
default: '4'
description: 选择电机 (4:搅拌, 5:旋钮) description: 选择电机 (4:搅拌, 5:旋钮)
type: integer enum:
- '4'
- '5'
type: string
speed: speed:
default: 60
description: 速度 (RPM) description: 速度 (RPM)
type: integer type: integer
required: required:
- motor_id - motor_id
- speed - speed
type: object type: object
result: {}
required:
- goal
title: motor_run_continuous参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
motor_stop: motor_stop:
feedback: {}
goal: goal:
motor_id: 4 motor_id: 4
goal_default:
motor_id: null
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 停止指定步进电机 description: 停止指定步进电机
properties: properties:
feedback: {}
goal: goal:
properties: properties:
motor_id: motor_id:
default: '4'
description: 选择电机 description: 选择电机
enum:
- '4'
- '5'
title: '注: 4=搅拌, 5=旋钮' title: '注: 4=搅拌, 5=旋钮'
type: integer type: string
required: required:
- motor_id - motor_id
type: object type: object
result: {}
required:
- goal
title: motor_stop参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
pump_aspirate: pump_aspirate:
feedback: {}
goal: goal:
pump_id: 1 pump_id: 1
valve_port: 1 valve_port: 1
volume: 1000 volume: 1000
goal_default:
pump_id: null
valve_port: null
volume: null
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 注射泵吸液 description: 注射泵吸液
properties: properties:
feedback: {}
goal: goal:
properties: properties:
pump_id: pump_id:
default: '1'
description: 选择泵 description: 选择泵
type: integer enum:
- '1'
- '2'
- '3'
type: string
valve_port: valve_port:
default: '1'
description: 阀门端口 description: 阀门端口
type: integer enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
type: string
volume: volume:
default: 1000
description: 吸液步数 description: 吸液步数
type: integer type: integer
required: required:
@@ -212,38 +201,41 @@ separator.chinwe:
- volume - volume
- valve_port - valve_port
type: object type: object
result: {}
required:
- goal
title: pump_aspirate参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
pump_dispense: pump_dispense:
feedback: {}
goal: goal:
pump_id: 1 pump_id: 1
valve_port: 1 valve_port: 1
volume: 1000 volume: 1000
goal_default:
pump_id: null
valve_port: null
volume: null
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 注射泵排液 description: 注射泵排液
properties: properties:
feedback: {}
goal: goal:
properties: properties:
pump_id: pump_id:
default: '1'
description: 选择泵 description: 选择泵
type: integer enum:
- '1'
- '2'
- '3'
type: string
valve_port: valve_port:
default: '1'
description: 阀门端口 description: 阀门端口
type: integer enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
type: string
volume: volume:
default: 1000
description: 排液步数 description: 排液步数
type: integer type: integer
required: required:
@@ -251,152 +243,162 @@ separator.chinwe:
- volume - volume
- valve_port - valve_port
type: object type: object
result: {}
required:
- goal
title: pump_dispense参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
pump_initialize: pump_initialize:
feedback: {}
goal: goal:
drain_port: 0 drain_port: 0
output_port: 0 output_port: 0
pump_id: 1 pump_id: 1
speed: 10 speed: 10
goal_default:
drain_port: 0
output_port: 0
pump_id: null
speed: 10
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 初始化指定注射泵 description: 初始化指定注射泵
properties: properties:
feedback: {}
goal: goal:
properties: properties:
drain_port: drain_port:
default: 0 default: 0
description: 排液口索引 description: 排液口索引
type: string type: integer
output_port: output_port:
default: 0 default: 0
description: 输出口索引 description: 输出口索引
type: string
pump_id:
description: 选择泵
title: '注: 1号泵, 2号泵, 3号泵'
type: integer type: integer
pump_id:
default: '1'
description: 选择泵
enum:
- '1'
- '2'
- '3'
title: '注: 1号泵, 2号泵, 3号泵'
type: string
speed: speed:
default: 10 default: 10
description: 运动速度 description: 运动速度
type: string type: integer
required: required:
- pump_id - pump_id
type: object type: object
result: {}
required:
- goal
title: pump_initialize参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
pump_valve: pump_valve:
feedback: {}
goal: goal:
port: 1 port: 1
pump_id: 1 pump_id: 1
goal_default:
port: null
pump_id: null
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 切换指定泵的阀门端口 description: 切换指定泵的阀门端口
properties: properties:
feedback: {}
goal: goal:
properties: properties:
port: port:
default: '1'
description: 阀门端口号 (1-8) description: 阀门端口号 (1-8)
type: integer enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
type: string
pump_id: pump_id:
default: '1'
description: 选择泵 description: 选择泵
type: integer enum:
- '1'
- '2'
- '3'
type: string
required: required:
- pump_id - pump_id
- port - port
type: object type: object
result: {} type: UniLabJsonCommand
required: separation_step:
- goal goal:
title: pump_valve参数 max_cycles: 0
type: object motor_id: 5
pulses: 700
speed: 60
timeout: 300
handles: {}
schema:
description: 分液步骤 - 液位传感器与电机联动 (有液→顺时针, 无液→逆时针)
properties:
goal:
properties:
max_cycles:
default: 0
description: 最大循环次数 (0=无限制)
type: integer
motor_id:
default: '5'
description: 选择电机
enum:
- '4'
- '5'
title: '注: 4=搅拌, 5=旋钮'
type: string
pulses:
default: 700
description: 每次旋转脉冲数 (约1/4圈)
type: integer
speed:
default: 60
description: 电机转速 (RPM)
type: integer
timeout:
default: 300
description: 超时时间 (秒)
type: integer
required:
- motor_id
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
wait_sensor_level: wait_sensor_level:
feedback: {}
goal: goal:
target_state: 有液 target_state: 有液
timeout: 30 timeout: 30
goal_default:
target_state: 有液
timeout: 30
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 等待传感器液位条件 description: 等待传感器液位条件
properties: properties:
feedback: {}
goal: goal:
properties: properties:
target_state: target_state:
default: 有液 default: 有液
description: 目标液位状态 description: 目标液位状态
enum:
- 有液
- 无液
type: string type: string
timeout: timeout:
default: 30 default: 30
description: 超时时间 (秒) description: 超时时间 (秒)
type: integer type: integer
required: [] required:
- target_state
type: object type: object
result:
type: boolean
required:
- goal
title: wait_sensor_level参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
wait_time: wait_time:
feedback: {}
goal: goal:
duration: 10 duration: 10
goal_default:
duration: null
handles: {} handles: {}
placeholder_keys: {}
result: {}
schema: schema:
description: 等待指定时间 description: 等待指定时间
properties: properties:
feedback: {}
goal: goal:
properties: properties:
duration: duration:
default: 10
description: 等待时间 (秒) description: 等待时间 (秒)
type: integer type: integer
required: required:
- duration - duration
type: object type: object
result:
type: boolean
required:
- goal
title: wait_time参数
type: object
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.separator.chinwe:ChinweDevice module: unilabos.devices.separator.chinwe:ChinweDevice
status_types: status_types:
@@ -445,8 +447,8 @@ separator.chinwe:
sensor_rssi: sensor_rssi:
type: integer type: integer
required: required:
- is_connected
- sensor_level - sensor_level
- sensor_rssi - sensor_rssi
- is_connected
type: object type: object
version: 2.1.0 version: 2.1.0

View File

@@ -64,8 +64,7 @@ coincellassemblyworkstation_device:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: fun_wuliao_test参数 title: fun_wuliao_test参数
@@ -110,8 +109,7 @@ coincellassemblyworkstation_device:
- elec_num - elec_num
- elec_use_num - elec_use_num
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: func_allpack_cmd参数 title: func_allpack_cmd参数
@@ -222,8 +220,7 @@ coincellassemblyworkstation_device:
- elec_num - elec_num
- elec_use_num - elec_use_num
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: func_allpack_cmd_simp参数 title: func_allpack_cmd_simp参数
@@ -312,8 +309,7 @@ coincellassemblyworkstation_device:
type: boolean type: boolean
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: func_pack_device_init_auto_start_combined参数 title: func_pack_device_init_auto_start_combined参数
@@ -355,8 +351,7 @@ coincellassemblyworkstation_device:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: func_pack_device_stop参数 title: func_pack_device_stop参数
@@ -381,8 +376,7 @@ coincellassemblyworkstation_device:
type: string type: string
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: func_pack_get_msg_cmd参数 title: func_pack_get_msg_cmd参数
@@ -436,8 +430,7 @@ coincellassemblyworkstation_device:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: func_pack_send_finished_cmd参数 title: func_pack_send_finished_cmd参数
@@ -474,8 +467,7 @@ coincellassemblyworkstation_device:
- assembly_type - assembly_type
- assembly_pressure - assembly_pressure
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: func_pack_send_msg_cmd参数 title: func_pack_send_msg_cmd参数
@@ -619,8 +611,7 @@ coincellassemblyworkstation_device:
- elec_num - elec_num
- elec_use_num - elec_use_num
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: func_sendbottle_allpack_multi参数 title: func_sendbottle_allpack_multi参数
@@ -672,6 +663,31 @@ coincellassemblyworkstation_device:
title: modify_deck_name参数 title: modify_deck_name参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
ros_node:
type: object
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-qiming_coin_cell_code: auto-qiming_coin_cell_code:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -719,8 +735,7 @@ coincellassemblyworkstation_device:
required: required:
- fujipian_panshu - fujipian_panshu
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: qiming_coin_cell_code参数 title: qiming_coin_cell_code参数
@@ -811,24 +826,25 @@ coincellassemblyworkstation_device:
sys_status: sys_status:
type: string type: string
required: required:
- sys_status
- sys_mode
- request_rec_msg_status
- request_send_msg_status
- data_assembly_coin_cell_num - data_assembly_coin_cell_num
- data_assembly_pressure
- data_assembly_time - data_assembly_time
- data_open_circuit_voltage
- data_axis_x_pos - data_axis_x_pos
- data_axis_y_pos - data_axis_y_pos
- data_axis_z_pos - data_axis_z_pos
- data_coin_cell_code
- data_coin_num
- data_electrolyte_code
- data_electrolyte_volume
- data_glove_box_o2_content
- data_glove_box_pressure
- data_glove_box_water_content
- data_open_circuit_voltage
- data_pole_weight - data_pole_weight
- request_rec_msg_status - data_assembly_pressure
- request_send_msg_status - data_electrolyte_volume
- sys_mode - data_coin_num
- sys_status - data_coin_cell_code
- data_electrolyte_code
- data_glove_box_pressure
- data_glove_box_o2_content
- data_glove_box_water_content
type: object type: object
registry_type: device
version: 1.0.0 version: 1.0.0

View File

@@ -50,25 +50,26 @@ gas_source.mock:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -81,25 +82,26 @@ gas_source.mock:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -114,31 +116,32 @@ gas_source.mock:
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -229,25 +232,26 @@ vacuum_pump.mock:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -260,25 +264,26 @@ vacuum_pump.mock:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -293,31 +298,32 @@ vacuum_pump.mock:
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:

View File

@@ -5,7 +5,7 @@ hotel.thermo_orbitor_rs2_hotel:
action_value_mappings: {} action_value_mappings: {}
module: unilabos.devices.resource_container.container:HotelContainer module: unilabos.devices.resource_container.container:HotelContainer
status_types: status_types:
rotation: '' rotation: String
type: python type: python
config_info: [] config_info: []
description: Thermo Orbitor RS2 Hotel容器设备用于实验室样品的存储和管理。该设备通过HotelContainer类实现容器的旋转控制和状态监控主要用于存储实验样品、试剂瓶或其他实验器具支持旋转功能以便于样品的自动化存取。适用于需要有序存储和快速访问大量样品的实验室自动化场景。 description: Thermo Orbitor RS2 Hotel容器设备用于实验室样品的存储和管理。该设备通过HotelContainer类实现容器的旋转控制和状态监控主要用于存储实验样品、试剂瓶或其他实验器具支持旋转功能以便于样品的自动化存取。适用于需要有序存储和快速访问大量样品的实验室自动化场景。

View File

@@ -22,8 +22,7 @@ xyz_stepper_controller:
required: required:
- degrees - degrees
type: object type: object
result: result: {}
type: integer
required: required:
- goal - goal
title: degrees_to_steps参数 title: degrees_to_steps参数
@@ -48,8 +47,7 @@ xyz_stepper_controller:
required: required:
- axis - axis
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: emergency_stop参数 title: emergency_stop参数
@@ -74,10 +72,7 @@ xyz_stepper_controller:
type: boolean type: boolean
required: [] required: []
type: object type: object
result: result: {}
additionalProperties:
type: boolean
type: object
required: required:
- goal - goal
title: enable_all_axes参数 title: enable_all_axes参数
@@ -106,8 +101,7 @@ xyz_stepper_controller:
required: required:
- axis - axis
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: enable_motor参数 title: enable_motor参数
@@ -128,10 +122,7 @@ xyz_stepper_controller:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
additionalProperties:
type: boolean
type: object
required: required:
- goal - goal
title: home_all_axes参数 title: home_all_axes参数
@@ -156,8 +147,7 @@ xyz_stepper_controller:
required: required:
- axis - axis
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: home_axis参数 title: home_axis参数
@@ -198,8 +188,7 @@ xyz_stepper_controller:
- axis - axis
- position - position
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: move_to_position参数 title: move_to_position参数
@@ -240,8 +229,7 @@ xyz_stepper_controller:
- axis - axis
- degrees - degrees
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: move_to_position_degrees参数 title: move_to_position_degrees参数
@@ -282,8 +270,7 @@ xyz_stepper_controller:
- axis - axis
- revolutions - revolutions
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: move_to_position_revolutions参数 title: move_to_position_revolutions参数
@@ -314,17 +301,14 @@ xyz_stepper_controller:
default: 5000 default: 5000
type: integer type: integer
x: x:
type: integer type: string
y: y:
type: integer type: string
z: z:
type: integer type: string
required: [] required: []
type: object type: object
result: result: {}
additionalProperties:
type: boolean
type: object
required: required:
- goal - goal
title: move_xyz参数 title: move_xyz参数
@@ -355,17 +339,14 @@ xyz_stepper_controller:
default: 5000 default: 5000
type: integer type: integer
x_deg: x_deg:
type: number type: string
y_deg: y_deg:
type: number type: string
z_deg: z_deg:
type: number type: string
required: [] required: []
type: object type: object
result: result: {}
additionalProperties:
type: boolean
type: object
required: required:
- goal - goal
title: move_xyz_degrees参数 title: move_xyz_degrees参数
@@ -396,17 +377,14 @@ xyz_stepper_controller:
default: 5000 default: 5000
type: integer type: integer
x_rev: x_rev:
type: number type: string
y_rev: y_rev:
type: number type: string
z_rev: z_rev:
type: number type: string
required: [] required: []
type: object type: object
result: result: {}
additionalProperties:
type: boolean
type: object
required: required:
- goal - goal
title: move_xyz_revolutions参数 title: move_xyz_revolutions参数
@@ -431,8 +409,7 @@ xyz_stepper_controller:
required: required:
- revolutions - revolutions
type: object type: object
result: result: {}
type: integer
required: required:
- goal - goal
title: revolutions_to_steps参数 title: revolutions_to_steps参数
@@ -465,8 +442,7 @@ xyz_stepper_controller:
- axis - axis
- speed - speed
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: set_speed_mode参数 title: set_speed_mode参数
@@ -491,8 +467,7 @@ xyz_stepper_controller:
required: required:
- steps - steps
type: object type: object
result: result: {}
type: number
required: required:
- goal - goal
title: steps_to_degrees参数 title: steps_to_degrees参数
@@ -517,8 +492,7 @@ xyz_stepper_controller:
required: required:
- steps - steps
type: object type: object
result: result: {}
type: number
required: required:
- goal - goal
title: steps_to_revolutions参数 title: steps_to_revolutions参数
@@ -539,10 +513,7 @@ xyz_stepper_controller:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
additionalProperties:
type: boolean
type: object
required: required:
- goal - goal
title: stop_all_axes参数 title: stop_all_axes参数
@@ -571,8 +542,7 @@ xyz_stepper_controller:
required: required:
- axis - axis
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: wait_for_completion参数 title: wait_for_completion参数
@@ -580,7 +550,8 @@ xyz_stepper_controller:
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.liquid_handling.laiyu.drivers.xyz_stepper_driver:XYZStepperController module: unilabos.devices.liquid_handling.laiyu.drivers.xyz_stepper_driver:XYZStepperController
status_types: status_types:
all_positions: Dict[MotorAxis, MotorPosition] all_positions: dict
motor_status: unilabos.devices.liquid_handling.laiyu.drivers.xyz_stepper_driver:MotorPosition
type: python type: python
config_info: [] config_info: []
description: 新XYZ控制器 description: 新XYZ控制器
@@ -603,10 +574,12 @@ xyz_stepper_controller:
data: data:
properties: properties:
all_positions: all_positions:
additionalProperties: type: object
type: object motor_status:
type: object type: object
required: required:
- motor_status
- all_positions - all_positions
type: object type: object
registry_type: device
version: 1.0.0 version: 1.0.0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,286 @@
motor.zdt_x42:
category:
- motor
class:
action_value_mappings:
auto-enable:
feedback: {}
goal: {}
goal_default:
'on': true
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 使能或禁用电机。使能后电机进入锁轴状态,可接收运动指令;禁用后电机进入松轴状态。
properties:
feedback: {}
goal:
properties:
'on':
default: true
type: boolean
required: []
type: object
result: {}
required:
- goal
title: enable参数
type: object
type: UniLabJsonCommand
auto-get_position:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 获取当前电机脉冲位置。
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result:
properties:
position:
type: integer
type: object
required:
- goal
title: get_position参数
type: object
type: UniLabJsonCommand
auto-move_position:
feedback: {}
goal: {}
goal_default:
absolute: false
acceleration: 10
direction: CW
pulses: 1000
speed_rpm: 60
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 位置模式运行。控制电机移动到指定脉冲位置或相对于当前位置移动指定脉冲数。
properties:
feedback: {}
goal:
properties:
absolute:
default: false
type: boolean
acceleration:
default: 10
maximum: 255
minimum: 0
type: integer
direction:
default: CW
enum:
- CW
- CCW
type: string
pulses:
default: 1000
type: integer
speed_rpm:
default: 60
minimum: 0
type: integer
required:
- pulses
- speed_rpm
type: object
result: {}
required:
- goal
title: move_position参数
type: object
type: UniLabJsonCommand
auto-move_speed:
feedback: {}
goal: {}
goal_default:
acceleration: 10
direction: CW
speed_rpm: 60
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 速度模式运行。控制电机以指定转速和方向持续转动。
properties:
feedback: {}
goal:
properties:
acceleration:
default: 10
maximum: 255
minimum: 0
type: integer
direction:
default: CW
enum:
- CW
- CCW
type: string
speed_rpm:
default: 60
minimum: 0
type: integer
required:
- speed_rpm
type: object
result: {}
required:
- goal
title: move_speed参数
type: object
type: UniLabJsonCommand
auto-rotate_quarter:
feedback: {}
goal: {}
goal_default:
direction: CW
speed_rpm: 60
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 电机旋转 1/4 圈 (阻塞式)。
properties:
feedback: {}
goal:
properties:
direction:
default: CW
enum:
- CW
- CCW
type: string
speed_rpm:
default: 60
minimum: 1
type: integer
required: []
type: object
result: {}
required:
- goal
title: rotate_quarter参数
type: object
type: UniLabJsonCommand
auto-set_zero:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 将当前电机位置设为零点。
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: set_zero参数
type: object
type: UniLabJsonCommand
auto-stop:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 立即停止电机运动。
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: stop参数
type: object
type: UniLabJsonCommand
auto-wait_time:
feedback: {}
goal: {}
goal_default:
duration_s: 1.0
handles: {}
placeholder_keys: {}
result: {}
schema:
description: 等待指定时间 (秒)。
properties:
feedback: {}
goal:
properties:
duration_s:
default: 1.0
minimum: 0
type: number
required:
- duration_s
type: object
result: {}
required:
- goal
title: wait_time参数
type: object
type: UniLabJsonCommand
module: unilabos.devices.motor.ZDT_X42:ZDTX42Driver
status_types:
position: int
status: str
type: python
config_info: []
description: ZDT X42 闭环步进电机驱动。支持速度运行、精确位置控制、位置查询和清零功能。适用于各种需要精确运动控制的实验室自动化场景。
handles: []
icon: ''
init_param_schema:
config:
properties:
baudrate:
default: 115200
type: integer
debug:
default: false
type: boolean
device_id:
default: 1
type: integer
port:
type: string
timeout:
default: 0.5
type: number
required:
- port
type: object
data:
properties:
position:
type: integer
status:
type: string
required:
- status
- position
type: object
version: 1.0.0

View File

@@ -5,6 +5,31 @@ neware_battery_test_system:
- battery_test - battery_test
class: class:
action_value_mappings: action_value_mappings:
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
ros_node:
type: string
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-print_status_summary: auto-print_status_summary:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -41,8 +66,7 @@ neware_battery_test_system:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: boolean
required: required:
- goal - goal
title: test_connection参数 title: test_connection参数
@@ -53,8 +77,9 @@ neware_battery_test_system:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
success: success
schema: schema:
description: 调试方法:显示所有资源的实际名称 description: 调试方法:显示所有资源的实际名称
properties: properties:
@@ -64,10 +89,19 @@ neware_battery_test_system:
required: [] required: []
type: object type: object
result: result:
properties:
return_info:
description: 资源调试信息
type: string
success:
description: 是否成功
type: boolean
required:
- return_info
- success
type: object type: object
required: required:
- goal - goal
title: debug_resource_names参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
export_status_json: export_status_json:
@@ -77,8 +111,9 @@ neware_battery_test_system:
goal_default: goal_default:
filepath: bts_status.json filepath: bts_status.json
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
success: success
schema: schema:
description: 导出当前状态数据到JSON文件 description: 导出当前状态数据到JSON文件
properties: properties:
@@ -92,10 +127,19 @@ neware_battery_test_system:
required: [] required: []
type: object type: object
result: result:
properties:
return_info:
description: 导出操作结果信息
type: string
success:
description: 导出是否成功
type: boolean
required:
- return_info
- success
type: object type: object
required: required:
- goal - goal
title: export_status_json参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
get_device_summary: get_device_summary:
@@ -137,8 +181,10 @@ neware_battery_test_system:
goal_default: goal_default:
plate_num: null plate_num: null
handles: {} handles: {}
placeholder_keys: {} result:
result: {} plate_data: plate_data
return_info: return_info
success: success
schema: schema:
description: 获取指定盘或所有盘的状态信息 description: 获取指定盘或所有盘的状态信息
properties: properties:
@@ -147,14 +193,29 @@ neware_battery_test_system:
properties: properties:
plate_num: plate_num:
description: 盘号 (1 或 2)如果为null则返回所有盘的状态 description: 盘号 (1 或 2)如果为null则返回所有盘的状态
maximum: 2
minimum: 1
type: integer type: integer
required: [] required: []
type: object type: object
result: result:
properties:
plate_data:
description: 盘状态数据(单盘或所有盘)
type: object
return_info:
description: 操作结果信息
type: string
success:
description: 查询是否成功
type: boolean
required:
- return_info
- success
- plate_data
type: object type: object
required: required:
- goal - goal
title: get_plate_status参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
print_status_summary_action: print_status_summary_action:
@@ -162,8 +223,9 @@ neware_battery_test_system:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
success: success
schema: schema:
description: 打印通道状态摘要信息到控制台 description: 打印通道状态摘要信息到控制台
properties: properties:
@@ -173,21 +235,28 @@ neware_battery_test_system:
required: [] required: []
type: object type: object
result: result:
properties:
return_info:
description: 打印操作结果信息
type: string
success:
description: 打印是否成功
type: boolean
required:
- return_info
- success
type: object type: object
required: required:
- goal - goal
title: print_status_summary_action参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
query_plate_action: query_plate_action:
feedback: {} feedback: {}
goal: goal:
plate_id: plate_id string: plate_id
string: string
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info return_info: return_info
success: success success: success
@@ -195,23 +264,27 @@ neware_battery_test_system:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -225,11 +298,13 @@ neware_battery_test_system:
csv_path: string csv_path: string
output_dir: string output_dir: string
goal_default: goal_default:
csv_path: null csv_path: ''
output_dir: . output_dir: .
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
submitted_count: submitted_count
success: success
schema: schema:
description: 从CSV文件批量提交Neware测试任务 description: 从CSV文件批量提交Neware测试任务
properties: properties:
@@ -240,17 +315,31 @@ neware_battery_test_system:
description: 输入CSV文件的绝对路径 description: 输入CSV文件的绝对路径
type: string type: string
output_dir: output_dir:
default: .
description: 输出目录用于存储XML和备份文件默认当前目录 description: 输出目录用于存储XML和备份文件默认当前目录
type: string type: string
required: required:
- csv_path - csv_path
type: object type: object
result: result:
properties:
return_info:
description: 执行结果详细信息
type: string
submitted_count:
description: 成功提交的任务数量
type: integer
success:
description: 是否成功
type: boolean
total_count:
description: CSV文件中的总行数
type: integer
required:
- return_info
- success
type: object type: object
required: required:
- goal - goal
title: submit_from_csv参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
test_connection_action: test_connection_action:
@@ -258,8 +347,9 @@ neware_battery_test_system:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
success: success
schema: schema:
description: 测试与电池测试系统的TCP连接 description: 测试与电池测试系统的TCP连接
properties: properties:
@@ -269,10 +359,19 @@ neware_battery_test_system:
required: [] required: []
type: object type: object
result: result:
properties:
return_info:
description: 连接测试结果信息
type: string
success:
description: 连接测试是否成功
type: boolean
required:
- return_info
- success
type: object type: object
required: required:
- goal - goal
title: test_connection_action参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
upload_backup_to_oss: upload_backup_to_oss:
@@ -293,8 +392,12 @@ neware_battery_test_system:
handler_key: uploaded_files handler_key: uploaded_files
io_type: sink io_type: sink
label: Uploaded Files (with standard flow info) label: Uploaded Files (with standard flow info)
placeholder_keys: {} result:
result: {} failed_files: failed_files
return_info: return_info
success: success
total_count: total_count
uploaded_count: uploaded_count
schema: schema:
description: 上传备份文件到阿里云OSS description: 上传备份文件到阿里云OSS
properties: properties:
@@ -314,17 +417,65 @@ neware_battery_test_system:
required: [] required: []
type: object type: object
result: result:
properties:
failed_files:
description: 上传失败的文件名列表
items:
type: string
type: array
return_info:
description: 上传操作结果信息
type: string
success:
description: 上传是否成功
type: boolean
total_count:
description: 总文件数
type: integer
uploaded_count:
description: 成功上传的文件数
type: integer
uploaded_files:
description: 成功上传的文件详情列表
items:
properties:
Battery_Code:
description: 电池编码
type: string
Electrolyte_Code:
description: 电解液编码
type: string
filename:
description: 文件名
type: string
url:
description: OSS下载链接
type: string
required:
- filename
- url
- Battery_Code
- Electrolyte_Code
type: object
type: array
required:
- return_info
- success
- uploaded_count
- total_count
- failed_files
- uploaded_files
type: object type: object
required: required:
- goal - goal
title: upload_backup_to_oss参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.neware_battery_test_system.neware_battery_test_system:NewareBatteryTestSystem module: unilabos.devices.neware_battery_test_system.neware_battery_test_system:NewareBatteryTestSystem
status_types: status_types:
channel_status: Dict[int, Dict] channel_status: dict
connection_info: Dict[str, str] connection_info: dict
device_summary: dict device_summary: dict
plate_status: dict
status: str status: str
total_channels: int total_channels: int
type: python type: python
@@ -366,24 +517,23 @@ neware_battery_test_system:
data: data:
properties: properties:
channel_status: channel_status:
additionalProperties:
type: object
type: object type: object
connection_info: connection_info:
additionalProperties:
type: string
type: object type: object
device_summary: device_summary:
type: object type: object
plate_status:
type: object
status: status:
type: string type: string
total_channels: total_channels:
type: integer type: integer
required: required:
- status
- channel_status - channel_status
- connection_info - connection_info
- device_summary
- status
- total_channels - total_channels
- plate_status
- device_summary
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -142,7 +142,8 @@ opcua_example:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.device_comms.opcua_client.client:OpcUaClient module: unilabos.device_comms.opcua_client.client:OpcUaClient
status_types: {} status_types:
node_value: String
type: python type: python
config_info: [] config_info: []
description: null description: null
@@ -166,7 +167,10 @@ opcua_example:
- url - url
type: object type: object
data: data:
properties: {} properties:
required: [] node_value:
type: string
required:
- node_value
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -80,8 +80,7 @@ opsky_ATR30007:
type: string type: string
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: run_once参数 title: run_once参数

View File

@@ -100,41 +100,42 @@ rotavap.one:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
set_timer: set_timer:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -249,13 +250,9 @@ separator.homemade:
feedback: feedback:
status: status status: status
goal: goal:
event: event
settling_time: settling_time settling_time: settling_time
stir_speed: stir_speed stir_speed: stir_speed
stir_time: stir_time stir_time: stir_time,
time: time
time_spec: time_spec
vessel: vessel
goal_default: goal_default:
event: '' event: ''
settling_time: '' settling_time: ''
@@ -284,42 +281,34 @@ separator.homemade:
sample_id: '' sample_id: ''
type: '' type: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
message: message
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: Stir_Feedback title: Stir_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
event: event:
type: string type: string
settling_time: settling_time:
type: string type: string
stir_speed: stir_speed:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
stir_time: stir_time:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
time: time:
type: string type: string
time_spec: time_spec:
type: string type: string
vessel: vessel:
additionalProperties: false
properties: properties:
category: category:
type: string type: string
@@ -338,26 +327,16 @@ separator.homemade:
parent: parent:
type: string type: string
pose: pose:
additionalProperties: false
properties: properties:
orientation: orientation:
additionalProperties: false
properties: properties:
w: w:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- x - x
@@ -367,19 +346,12 @@ separator.homemade:
title: orientation title: orientation
type: object type: object
position: position:
additionalProperties: false
properties: properties:
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- x - x
@@ -409,10 +381,17 @@ separator.homemade:
- data - data
title: vessel title: vessel
type: object type: object
required:
- vessel
- time
- event
- time_spec
- stir_time
- stir_speed
- settling_time
title: Stir_Goal title: Stir_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
message: message:
type: string type: string
@@ -420,6 +399,10 @@ separator.homemade:
type: string type: string
success: success:
type: boolean type: boolean
required:
- success
- message
- return_info
title: Stir_Result title: Stir_Result
type: object type: object
required: required:
@@ -435,34 +418,36 @@ separator.homemade:
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:

View File

@@ -28,6 +28,31 @@ post_process_station:
title: load_config参数 title: load_config参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
ros_node:
type: string
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-print_cache_stats: auto-print_cache_stats:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -79,41 +104,42 @@ post_process_station:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
disconnect: disconnect:
feedback: feedback: {}
status: status
goal: goal:
command: command command: {}
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -123,41 +149,42 @@ post_process_station:
type: SendCmd type: SendCmd
read_node: read_node:
feedback: feedback:
status: status result: result
goal: goal:
command: command command: node_name
node_name: node_name
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -256,19 +283,17 @@ post_process_station:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: PostProcessTriggerClean_Feedback title: PostProcessTriggerClean_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
acetone_inner_wall_cleaning_count: acetone_inner_wall_cleaning_count:
maximum: 2147483647 maximum: 2147483647
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
acetone_inner_wall_cleaning_injection: acetone_inner_wall_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
acetone_inner_wall_cleaning_waste_time: acetone_inner_wall_cleaning_waste_time:
maximum: 2147483647 maximum: 2147483647
@@ -279,8 +304,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
acetone_outer_wall_cleaning_injection: acetone_outer_wall_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
acetone_outer_wall_cleaning_wait_time: acetone_outer_wall_cleaning_wait_time:
maximum: 2147483647 maximum: 2147483647
@@ -299,8 +322,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
acetone_stirrer_cleaning_injection: acetone_stirrer_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
acetone_stirrer_cleaning_wait_time: acetone_stirrer_cleaning_wait_time:
maximum: 2147483647 maximum: 2147483647
@@ -327,8 +348,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
nmp_inner_wall_cleaning_injection: nmp_inner_wall_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
nmp_inner_wall_cleaning_waste_time: nmp_inner_wall_cleaning_waste_time:
maximum: 2147483647 maximum: 2147483647
@@ -339,8 +358,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
nmp_outer_wall_cleaning_injection: nmp_outer_wall_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
nmp_outer_wall_cleaning_wait_time: nmp_outer_wall_cleaning_wait_time:
maximum: 2147483647 maximum: 2147483647
@@ -359,8 +376,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
nmp_stirrer_cleaning_injection: nmp_stirrer_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
nmp_stirrer_cleaning_wait_time: nmp_stirrer_cleaning_wait_time:
maximum: 2147483647 maximum: 2147483647
@@ -379,8 +394,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
water_inner_wall_cleaning_injection: water_inner_wall_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
water_inner_wall_cleaning_waste_time: water_inner_wall_cleaning_waste_time:
maximum: 2147483647 maximum: 2147483647
@@ -391,8 +404,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
water_outer_wall_cleaning_injection: water_outer_wall_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
water_outer_wall_cleaning_wait_time: water_outer_wall_cleaning_wait_time:
maximum: 2147483647 maximum: 2147483647
@@ -411,8 +422,6 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
water_stirrer_cleaning_injection: water_stirrer_cleaning_injection:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
water_stirrer_cleaning_wait_time: water_stirrer_cleaning_wait_time:
maximum: 2147483647 maximum: 2147483647
@@ -422,13 +431,55 @@ post_process_station:
maximum: 2147483647 maximum: 2147483647
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
required:
- nmp_outer_wall_cleaning_injection
- nmp_outer_wall_cleaning_count
- nmp_outer_wall_cleaning_wait_time
- nmp_outer_wall_cleaning_waste_time
- nmp_inner_wall_cleaning_injection
- nmp_inner_wall_cleaning_count
- nmp_pump_cleaning_suction_count
- nmp_inner_wall_cleaning_waste_time
- nmp_stirrer_cleaning_injection
- nmp_stirrer_cleaning_count
- nmp_stirrer_cleaning_wait_time
- nmp_stirrer_cleaning_waste_time
- water_outer_wall_cleaning_injection
- water_outer_wall_cleaning_count
- water_outer_wall_cleaning_wait_time
- water_outer_wall_cleaning_waste_time
- water_inner_wall_cleaning_injection
- water_inner_wall_cleaning_count
- water_pump_cleaning_suction_count
- water_inner_wall_cleaning_waste_time
- water_stirrer_cleaning_injection
- water_stirrer_cleaning_count
- water_stirrer_cleaning_wait_time
- water_stirrer_cleaning_waste_time
- acetone_outer_wall_cleaning_injection
- acetone_outer_wall_cleaning_count
- acetone_outer_wall_cleaning_wait_time
- acetone_outer_wall_cleaning_waste_time
- acetone_inner_wall_cleaning_injection
- acetone_inner_wall_cleaning_count
- acetone_pump_cleaning_suction_count
- acetone_inner_wall_cleaning_waste_time
- acetone_stirrer_cleaning_injection
- acetone_stirrer_cleaning_count
- acetone_stirrer_cleaning_wait_time
- acetone_stirrer_cleaning_waste_time
- pipe_blowing_time
- injection_pump_forward_empty_suction_count
- injection_pump_reverse_empty_suction_count
- filtration_liquid_selection
title: PostProcessTriggerClean_Goal title: PostProcessTriggerClean_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: PostProcessTriggerClean_Result title: PostProcessTriggerClean_Result
type: object type: object
required: required:
@@ -451,11 +502,11 @@ post_process_station:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: PostProcessGrab_Feedback title: PostProcessGrab_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
raw_tank_number: raw_tank_number:
maximum: 2147483647 maximum: 2147483647
@@ -465,13 +516,17 @@ post_process_station:
maximum: 2147483647 maximum: 2147483647
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
required:
- reaction_tank_number
- raw_tank_number
title: PostProcessGrab_Goal title: PostProcessGrab_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: PostProcessGrab_Result title: PostProcessGrab_Result
type: object type: object
required: required:
@@ -518,15 +573,13 @@ post_process_station:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: PostProcessTriggerPostPro_Feedback title: PostProcessTriggerPostPro_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
atomization_fast_speed: atomization_fast_speed:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
atomization_pressure_kpa: atomization_pressure_kpa:
maximum: 2147483647 maximum: 2147483647
@@ -541,12 +594,8 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
first_wash_water_amount: first_wash_water_amount:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
initial_water_amount: initial_water_amount:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
injection_pump_push_speed: injection_pump_push_speed:
maximum: 2147483647 maximum: 2147483647
@@ -573,20 +622,32 @@ post_process_station:
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
second_wash_water_amount: second_wash_water_amount:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
wash_slow_speed: wash_slow_speed:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required:
- atomization_fast_speed
- wash_slow_speed
- injection_pump_suction_speed
- injection_pump_push_speed
- raw_liquid_suction_count
- first_wash_water_amount
- second_wash_water_amount
- first_powder_mixing_tim
- second_powder_mixing_time
- first_powder_wash_count
- second_powder_wash_count
- initial_water_amount
- pre_filtration_mixing_time
- atomization_pressure_kpa
title: PostProcessTriggerPostPro_Goal title: PostProcessTriggerPostPro_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: PostProcessTriggerPostPro_Result title: PostProcessTriggerPostPro_Result
type: object type: object
required: required:
@@ -608,26 +669,30 @@ post_process_station:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -637,7 +702,8 @@ post_process_station:
type: SendCmd type: SendCmd
module: unilabos.devices.workstation.post_process.post_process:OpcUaClient module: unilabos.devices.workstation.post_process.post_process:OpcUaClient
status_types: status_types:
cache_stats: Dict[str, Any] cache_stats: dict
node_value: String
type: python type: python
config_info: [] config_info: []
description: 后处理站 description: 后处理站
@@ -652,9 +718,7 @@ post_process_station:
config_path: config_path:
type: string type: string
deck: deck:
anyOf: type: string
- type: object
- type: object
password: password:
type: string type: string
subscription_interval: subscription_interval:
@@ -674,7 +738,10 @@ post_process_station:
properties: properties:
cache_stats: cache_stats:
type: object type: object
node_value:
type: string
required: required:
- node_value
- cache_stats - cache_stats
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -136,36 +136,36 @@ solenoid_valve:
set_valve_position: set_valve_position:
feedback: {} feedback: {}
goal: goal:
position: position string: position
string: string
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -278,25 +278,26 @@ solenoid_valve.mock:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -309,25 +310,26 @@ solenoid_valve.mock:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -420,27 +422,6 @@ syringe_pump_with_valve.runze.SY03B-T06:
title: initialize参数 title: initialize参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-list:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: list的参数schema
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: list参数
type: object
type: UniLabJsonCommand
auto-pull_plunger: auto-pull_plunger:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -714,10 +695,7 @@ syringe_pump_with_valve.runze.SY03B-T06:
goal: goal:
properties: properties:
position: position:
anyOf: type: string
- type: integer
- type: string
- type: number
required: required:
- position - position
type: object type: object
@@ -742,9 +720,7 @@ syringe_pump_with_valve.runze.SY03B-T06:
goal: goal:
properties: properties:
velocity: velocity:
anyOf: type: string
- type: integer
- type: string
required: required:
- velocity - velocity
type: object type: object
@@ -804,13 +780,13 @@ syringe_pump_with_valve.runze.SY03B-T06:
status_types: status_types:
max_velocity: float max_velocity: float
mode: int mode: int
plunger_position: '' plunger_position: String
position: float position: float
status: str status: str
valve_position: str valve_position: str
velocity_end: '' velocity_end: String
velocity_grade: '' velocity_grade: String
velocity_init: '' velocity_init: String
type: python type: python
config_info: [] config_info: []
description: 润泽精密注射泵设备,集成阀门控制的高精度流体输送系统。该设备通过串口通信控制,支持多种运行模式和精确的体积控制。具备可变速度控制、精密定位、阀门切换、实时状态监控等功能。适用于微量液体输送、精密进样、流速控制、化学反应进料等需要高精度流体操作的实验室自动化应用。 description: 润泽精密注射泵设备,集成阀门控制的高精度流体输送系统。该设备通过串口通信控制,支持多种运行模式和精确的体积控制。具备可变速度控制、精密定位、阀门切换、实时状态监控等功能。适用于微量液体输送、精密进样、流速控制、化学反应进料等需要高精度流体操作的实验室自动化应用。
@@ -909,15 +885,15 @@ syringe_pump_with_valve.runze.SY03B-T06:
velocity_init: velocity_init:
type: string type: string
required: required:
- max_velocity
- mode
- plunger_position
- position
- status - status
- valve_position - mode
- velocity_end - max_velocity
- velocity_grade - velocity_grade
- velocity_init - velocity_init
- velocity_end
- valve_position
- position
- plunger_position
type: object type: object
version: 1.0.0 version: 1.0.0
syringe_pump_with_valve.runze.SY03B-T08: syringe_pump_with_valve.runze.SY03B-T08:
@@ -967,27 +943,6 @@ syringe_pump_with_valve.runze.SY03B-T08:
title: initialize参数 title: initialize参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-list:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: list的参数schema
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: list参数
type: object
type: UniLabJsonCommand
auto-pull_plunger: auto-pull_plunger:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -1261,10 +1216,7 @@ syringe_pump_with_valve.runze.SY03B-T08:
goal: goal:
properties: properties:
position: position:
anyOf: type: string
- type: integer
- type: string
- type: number
required: required:
- position - position
type: object type: object
@@ -1289,9 +1241,7 @@ syringe_pump_with_valve.runze.SY03B-T08:
goal: goal:
properties: properties:
velocity: velocity:
anyOf: type: string
- type: integer
- type: string
required: required:
- velocity - velocity
type: object type: object
@@ -1351,13 +1301,13 @@ syringe_pump_with_valve.runze.SY03B-T08:
status_types: status_types:
max_velocity: float max_velocity: float
mode: int mode: int
plunger_position: '' plunger_position: String
position: float position: float
status: str status: str
valve_position: str valve_position: str
velocity_end: '' velocity_end: String
velocity_grade: '' velocity_grade: String
velocity_init: '' velocity_init: String
type: python type: python
config_info: [] config_info: []
description: 润泽精密注射泵设备,集成阀门控制的高精度流体输送系统。该设备通过串口通信控制,支持多种运行模式和精确的体积控制。具备可变速度控制、精密定位、阀门切换、实时状态监控等功能。适用于微量液体输送、精密进样、流速控制、化学反应进料等需要高精度流体操作的实验室自动化应用。 description: 润泽精密注射泵设备,集成阀门控制的高精度流体输送系统。该设备通过串口通信控制,支持多种运行模式和精确的体积控制。具备可变速度控制、精密定位、阀门切换、实时状态监控等功能。适用于微量液体输送、精密进样、流速控制、化学反应进料等需要高精度流体操作的实验室自动化应用。
@@ -1472,14 +1422,14 @@ syringe_pump_with_valve.runze.SY03B-T08:
velocity_init: velocity_init:
type: string type: string
required: required:
- max_velocity
- mode
- plunger_position
- position
- status - status
- valve_position - mode
- velocity_end - max_velocity
- velocity_grade - velocity_grade
- velocity_init - velocity_init
- velocity_end
- valve_position
- position
- plunger_position
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -13,13 +13,12 @@ reaction_station.bioyond:
start_point: start_point start_point: start_point
start_step_key: start_step_key start_step_key: start_step_key
goal_default: goal_default:
duration: null duration: 0
end_point: 0 end_point: 0
end_step_key: '' end_step_key: ''
start_point: 0 start_point: 0
start_step_key: '' start_step_key: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 添加时间约束 - 在两个工作流之间添加时间约束 description: 添加时间约束 - 在两个工作流之间添加时间约束
@@ -31,19 +30,23 @@ reaction_station.bioyond:
description: 时间(秒) description: 时间(秒)
type: integer type: integer
end_point: end_point:
default: 0 default: Start
description: 终点计时点 (Start=开始前, End=结束后) description: 终点计时点 (Start=开始前, End=结束后)
type: integer enum:
- Start
- End
type: string
end_step_key: end_step_key:
default: ''
description: 终点步骤Key (可选, 默认为空则自动选择) description: 终点步骤Key (可选, 默认为空则自动选择)
type: string type: string
start_point: start_point:
default: 0 default: Start
description: 起点计时点 (Start=开始前, End=结束后) description: 起点计时点 (Start=开始前, End=结束后)
type: integer enum:
- Start
- End
type: string
start_step_key: start_step_key:
default: ''
description: 起点步骤Key (例如 "feeding", "liquid", 可选, 默认为空则自动选择) description: 起点步骤Key (例如 "feeding", "liquid", 可选, 默认为空则自动选择)
type: string type: string
required: required:
@@ -95,8 +98,7 @@ reaction_station.bioyond:
required: required:
- json_str - json_str
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: create_order参数 title: create_order参数
@@ -123,8 +125,7 @@ reaction_station.bioyond:
required: required:
- workflow_ids - workflow_ids
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: hard_delete_merged_workflows参数 title: hard_delete_merged_workflows参数
@@ -149,8 +150,7 @@ reaction_station.bioyond:
required: required:
- json_str - json_str
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: merge_workflow_with_parameters参数 title: merge_workflow_with_parameters参数
@@ -175,8 +175,7 @@ reaction_station.bioyond:
required: required:
- report_request - report_request
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: process_temperature_cutoff_report参数 title: process_temperature_cutoff_report参数
@@ -201,12 +200,7 @@ reaction_station.bioyond:
required: required:
- web_workflow_json - web_workflow_json
type: object type: object
result: result: {}
items:
additionalProperties:
type: string
type: object
type: array
required: required:
- goal - goal
title: process_web_workflows参数 title: process_web_workflows参数
@@ -235,8 +229,7 @@ reaction_station.bioyond:
- reactor_id - reactor_id
- temperature - temperature
type: object type: object
result: result: {}
type: string
required: required:
- goal - goal
title: set_reactor_temperature参数 title: set_reactor_temperature参数
@@ -261,8 +254,7 @@ reaction_station.bioyond:
required: required:
- preintake_id - preintake_id
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: skip_titration_steps参数 title: skip_titration_steps参数
@@ -283,8 +275,7 @@ reaction_station.bioyond:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: sync_workflow_sequence_from_bioyond参数 title: sync_workflow_sequence_from_bioyond参数
@@ -316,8 +307,7 @@ reaction_station.bioyond:
type: integer type: integer
required: [] required: []
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: wait_for_multiple_orders_and_get_reports参数 title: wait_for_multiple_orders_and_get_reports参数
@@ -369,8 +359,7 @@ reaction_station.bioyond:
required: required:
- workflow_id - workflow_id
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: workflow_step_query参数 title: workflow_step_query参数
@@ -381,8 +370,9 @@ reaction_station.bioyond:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result:
result: {} code: code
message: message
schema: schema:
description: 清空服务端所有非核心工作流 (保留核心流程) description: 清空服务端所有非核心工作流 (保留核心流程)
properties: properties:
@@ -392,6 +382,13 @@ reaction_station.bioyond:
required: [] required: []
type: object type: object
result: result:
properties:
code:
description: 操作结果代码(1表示成功)
type: integer
message:
description: 结果描述
type: string
type: object type: object
required: required:
- goal - goal
@@ -408,14 +405,13 @@ reaction_station.bioyond:
torque_variation: torque_variation torque_variation: torque_variation
volume: volume volume: volume
goal_default: goal_default:
assign_material_name: null assign_material_name: ''
temperature: 25.0 temperature: ''
time: '90' time: ''
titration_type: '1' titration_type: ''
torque_variation: 2 torque_variation: ''
volume: null volume: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 滴回去 description: 滴回去
@@ -427,27 +423,33 @@ reaction_station.bioyond:
description: 物料名称(不能为空) description: 物料名称(不能为空)
type: string type: string
temperature: temperature:
default: 25.0
description: 温度设定(°C) description: 温度设定(°C)
type: number type: string
time: time:
default: '90'
description: 观察时间(分钟) description: 观察时间(分钟)
type: string type: string
titration_type: titration_type:
default: '1'
description: 是否滴定(NO=否, YES=是) description: 是否滴定(NO=否, YES=是)
enum:
- 'NO'
- 'YES'
type: string type: string
torque_variation: torque_variation:
default: 2
description: 是否观察 (NO=否, YES=是) description: 是否观察 (NO=否, YES=是)
type: integer enum:
- 'NO'
- 'YES'
type: string
volume: volume:
description: 分液公式(mL) description: 分液公式(mL)
type: string type: string
required: required:
- assign_material_name
- volume - volume
- assign_material_name
- time
- torque_variation
- titration_type
- temperature
type: object type: object
result: {} result: {}
required: required:
@@ -460,7 +462,7 @@ reaction_station.bioyond:
goal: goal:
batch_reports_result: batch_reports_result batch_reports_result: batch_reports_result
goal_default: goal_default:
batch_reports_result: null batch_reports_result: ''
handles: handles:
input: input:
- data_key: batch_reports_result - data_key: batch_reports_result
@@ -476,8 +478,8 @@ reaction_station.bioyond:
handler_key: ACTUALS_EXTRACTED handler_key: ACTUALS_EXTRACTED
io_type: sink io_type: sink
label: Extracted Actuals label: Extracted Actuals
placeholder_keys: {} result:
result: {} return_info: return_info
schema: schema:
description: 从批量任务完成报告中提取每个订单的实际加料量输出extracted列表。 description: 从批量任务完成报告中提取每个订单的实际加料量输出extracted列表。
properties: properties:
@@ -491,6 +493,13 @@ reaction_station.bioyond:
- batch_reports_result - batch_reports_result
type: object type: object
result: result:
properties:
return_info:
description: JSON字符串包含actuals数组每项含order_code, order_id, actualTargetWeigh,
actualVolume
type: string
required:
- return_info
title: extract_actuals_from_batch_reports结果 title: extract_actuals_from_batch_reports结果
type: object type: object
required: required:
@@ -508,14 +517,13 @@ reaction_station.bioyond:
torque_variation: torque_variation torque_variation: torque_variation
volume: volume volume: volume
goal_default: goal_default:
assign_material_name: BAPP assign_material_name: ''
temperature: 25.0 temperature: ''
time: '0' time: ''
titration_type: '1' titration_type: ''
torque_variation: 1 torque_variation: ''
volume: '350' volume: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 液体进料烧杯 description: 液体进料烧杯
@@ -524,30 +532,36 @@ reaction_station.bioyond:
goal: goal:
properties: properties:
assign_material_name: assign_material_name:
default: BAPP
description: 物料名称 description: 物料名称
type: string type: string
temperature: temperature:
default: 25.0
description: 温度设定(°C) description: 温度设定(°C)
type: number type: string
time: time:
default: '0'
description: 观察时间(分钟) description: 观察时间(分钟)
type: string type: string
titration_type: titration_type:
default: '1'
description: 是否滴定(NO=否, YES=是) description: 是否滴定(NO=否, YES=是)
enum:
- 'NO'
- 'YES'
type: string type: string
torque_variation: torque_variation:
default: 1
description: 是否观察 (NO=否, YES=是) description: 是否观察 (NO=否, YES=是)
type: integer enum:
- 'NO'
- 'YES'
type: string
volume: volume:
default: '350'
description: 分液公式(mL) description: 分液公式(mL)
type: string type: string
required: [] required:
- volume
- assign_material_name
- time
- torque_variation
- titration_type
- temperature
type: object type: object
result: {} result: {}
required: required:
@@ -566,13 +580,13 @@ reaction_station.bioyond:
torque_variation: torque_variation torque_variation: torque_variation
volume: volume volume: volume
goal_default: goal_default:
assign_material_name: null assign_material_name: ''
solvents: null solvents: ''
temperature: 25.0 temperature: '25.00'
time: '360' time: '360'
titration_type: '1' titration_type: '1'
torque_variation: 2 torque_variation: '2'
volume: null volume: ''
handles: handles:
input: input:
- data_key: solvents - data_key: solvents
@@ -581,7 +595,6 @@ reaction_station.bioyond:
handler_key: solvents handler_key: solvents
io_type: source io_type: source
label: Solvents Data From Calculation Node label: Solvents Data From Calculation Node
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 液体投料-溶剂。可以直接提供volume(mL),或通过solvents对象自动从additional_solvent(mL)计算volume。 description: 液体投料-溶剂。可以直接提供volume(mL),或通过solvents对象自动从additional_solvent(mL)计算volume。
@@ -596,21 +609,27 @@ reaction_station.bioyond:
description: '溶剂信息对象(可选),包含: additional_solvent(溶剂体积mL), total_liquid_volume(总液体体积mL)。如果提供,将自动计算volume' description: '溶剂信息对象(可选),包含: additional_solvent(溶剂体积mL), total_liquid_volume(总液体体积mL)。如果提供,将自动计算volume'
type: string type: string
temperature: temperature:
default: 25.0 default: '25.00'
description: 温度设定(°C),默认25.00 description: 温度设定(°C),默认25.00
type: number type: string
time: time:
default: '360' default: '360'
description: 观察时间(分钟),默认360 description: 观察时间(分钟),默认360
type: string type: string
titration_type: titration_type:
default: '1' default: 'NO'
description: 是否滴定(NO=否, YES=是),默认NO description: 是否滴定(NO=否, YES=是),默认NO
enum:
- 'NO'
- 'YES'
type: string type: string
torque_variation: torque_variation:
default: 2 default: 'YES'
description: 是否观察 (NO=否, YES=是),默认YES description: 是否观察 (NO=否, YES=是),默认YES
type: integer enum:
- 'NO'
- 'YES'
type: string
volume: volume:
description: 分液量(mL)。可直接提供,或通过solvents参数自动计算 description: 分液量(mL)。可直接提供,或通过solvents参数自动计算
type: string type: string
@@ -636,15 +655,15 @@ reaction_station.bioyond:
volume_formula: volume_formula volume_formula: volume_formula
x_value: x_value x_value: x_value
goal_default: goal_default:
assign_material_name: null assign_material_name: ''
extracted_actuals: null extracted_actuals: ''
feeding_order_data: null feeding_order_data: ''
temperature: 25.0 temperature: '25.00'
time: '90' time: '90'
titration_type: '2' titration_type: '2'
torque_variation: 2 torque_variation: '2'
volume_formula: null volume_formula: ''
x_value: null x_value: ''
handles: handles:
input: input:
- data_key: extracted_actuals - data_key: extracted_actuals
@@ -659,7 +678,6 @@ reaction_station.bioyond:
handler_key: feeding_order handler_key: feeding_order
io_type: source io_type: source
label: Feeding Order Data From Calculation Node label: Feeding Order Data From Calculation Node
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 液体进料(滴定)。支持两种模式:1)直接提供volume_formula;2)自动计算-提供x_value+feeding_order_data+extracted_actuals,系统自动生成公式"1000*(m二酐-x)*V二酐滴定/m二酐滴定" description: 液体进料(滴定)。支持两种模式:1)直接提供volume_formula;2)自动计算-提供x_value+feeding_order_data+extracted_actuals,系统自动生成公式"1000*(m二酐-x)*V二酐滴定/m二酐滴定"
@@ -678,21 +696,27 @@ reaction_station.bioyond:
{"feeding_order": [{"type": "main_anhydride", "amount": 1.915}]}' {"feeding_order": [{"type": "main_anhydride", "amount": 1.915}]}'
type: string type: string
temperature: temperature:
default: 25.0 default: '25.00'
description: 温度设定(°C),默认25.00 description: 温度设定(°C),默认25.00
type: number type: string
time: time:
default: '90' default: '90'
description: 观察时间(分钟),默认90 description: 观察时间(分钟),默认90
type: string type: string
titration_type: titration_type:
default: '2' default: 'YES'
description: 是否滴定(NO=否, YES=是),默认YES description: 是否滴定(NO=否, YES=是),默认YES
enum:
- 'NO'
- 'YES'
type: string type: string
torque_variation: torque_variation:
default: 2 default: 'YES'
description: 是否观察 (NO=否, YES=是),默认YES description: 是否观察 (NO=否, YES=是),默认YES
type: integer enum:
- 'NO'
- 'YES'
type: string
volume_formula: volume_formula:
description: 分液公式(mL)。可直接提供固定公式,或留空由系统根据x_value、feeding_order_data、extracted_actuals自动生成 description: 分液公式(mL)。可直接提供固定公式,或留空由系统根据x_value、feeding_order_data、extracted_actuals自动生成
type: string type: string
@@ -718,14 +742,13 @@ reaction_station.bioyond:
torque_variation: torque_variation torque_variation: torque_variation
volume_formula: volume_formula volume_formula: volume_formula
goal_default: goal_default:
assign_material_name: null assign_material_name: ''
temperature: 25.0 temperature: ''
time: '0' time: ''
titration_type: '1' titration_type: ''
torque_variation: 1 torque_variation: ''
volume_formula: null volume_formula: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 液体进料小瓶(非滴定) description: 液体进料小瓶(非滴定)
@@ -737,27 +760,33 @@ reaction_station.bioyond:
description: 物料名称 description: 物料名称
type: string type: string
temperature: temperature:
default: 25.0
description: 温度设定(°C) description: 温度设定(°C)
type: number type: string
time: time:
default: '0'
description: 观察时间(分钟) description: 观察时间(分钟)
type: string type: string
titration_type: titration_type:
default: '1'
description: 是否滴定(NO=否, YES=是) description: 是否滴定(NO=否, YES=是)
enum:
- 'NO'
- 'YES'
type: string type: string
torque_variation: torque_variation:
default: 1
description: 是否观察 (NO=否, YES=是) description: 是否观察 (NO=否, YES=是)
type: integer enum:
- 'NO'
- 'YES'
type: string
volume_formula: volume_formula:
description: 分液公式(mL) description: 分液公式(mL)
type: string type: string
required: required:
- volume_formula - volume_formula
- assign_material_name - assign_material_name
- time
- torque_variation
- titration_type
- temperature
type: object type: object
result: {} result: {}
required: required:
@@ -771,10 +800,9 @@ reaction_station.bioyond:
task_name: task_name task_name: task_name
workflow_name: workflow_name workflow_name: workflow_name
goal_default: goal_default:
task_name: null task_name: ''
workflow_name: null workflow_name: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 处理并执行工作流 description: 处理并执行工作流
@@ -792,8 +820,7 @@ reaction_station.bioyond:
- workflow_name - workflow_name
- task_name - task_name
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: process_and_execute_workflow参数 title: process_and_execute_workflow参数
@@ -806,11 +833,10 @@ reaction_station.bioyond:
cutoff: cutoff cutoff: cutoff
temperature: temperature temperature: temperature
goal_default: goal_default:
assign_material_name: null assign_material_name: ''
cutoff: '900000' cutoff: ''
temperature: -10.0 temperature: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 反应器放入 - 将反应器放入工作站,配置物料名称、粘度上限和温度参数 description: 反应器放入 - 将反应器放入工作站,配置物料名称、粘度上限和温度参数
@@ -822,14 +848,14 @@ reaction_station.bioyond:
description: 物料名称 description: 物料名称
type: string type: string
cutoff: cutoff:
default: '900000'
description: 粘度上限 description: 粘度上限
type: string type: string
temperature: temperature:
default: -10.0
description: 温度设定(°C) description: 温度设定(°C)
type: number type: string
required: required:
- cutoff
- temperature
- assign_material_name - assign_material_name
type: object type: object
result: {} result: {}
@@ -843,7 +869,6 @@ reaction_station.bioyond:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 反应器取出 - 从工作站中取出反应器,无需参数的简单操作 description: 反应器取出 - 从工作站中取出反应器,无需参数的简单操作
@@ -853,7 +878,15 @@ reaction_station.bioyond:
properties: {} properties: {}
required: [] required: []
type: object type: object
result: {} result:
properties:
code:
description: 操作结果代码(1表示成功,0表示失败)
type: integer
return_info:
description: 操作结果详细信息
type: string
type: object
required: required:
- goal - goal
title: reactor_taken_out参数 title: reactor_taken_out参数
@@ -864,8 +897,8 @@ reaction_station.bioyond:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result:
result: {} return_info: return_info
schema: schema:
description: 启动调度器 - 启动Bioyond工作站的任务调度器开始执行队列中的任务 description: 启动调度器 - 启动Bioyond工作站的任务调度器开始执行队列中的任务
properties: properties:
@@ -875,6 +908,12 @@ reaction_station.bioyond:
required: [] required: []
type: object type: object
result: result:
properties:
return_info:
description: 调度器启动结果成功返回1失败返回0
type: integer
required:
- return_info
title: scheduler_start结果 title: scheduler_start结果
type: object type: object
required: required:
@@ -891,13 +930,12 @@ reaction_station.bioyond:
time: time time: time
torque_variation: torque_variation torque_variation: torque_variation
goal_default: goal_default:
assign_material_name: null assign_material_name: ''
material_id: null material_id: ''
temperature: 25.0 temperature: ''
time: '0' time: ''
torque_variation: 1 torque_variation: ''
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 固体进料小瓶 - 通过小瓶向反应器中添加固体物料,支持多种粉末类型(盐、面粉、BTDA) description: 固体进料小瓶 - 通过小瓶向反应器中添加固体物料,支持多种粉末类型(盐、面粉、BTDA)
@@ -910,21 +948,29 @@ reaction_station.bioyond:
type: string type: string
material_id: material_id:
description: 粉末类型IDSalt=盐21分钟Flour=面粉27分钟BTDA=BTDA38分钟 description: 粉末类型IDSalt=盐21分钟Flour=面粉27分钟BTDA=BTDA38分钟
enum:
- Salt
- Flour
- BTDA
type: string type: string
temperature: temperature:
default: 25.0
description: 温度设定(°C) description: 温度设定(°C)
type: number type: string
time: time:
default: '0'
description: 观察时间(分钟) description: 观察时间(分钟)
type: string type: string
torque_variation: torque_variation:
default: 1
description: 是否观察 (NO=否, YES=是) description: 是否观察 (NO=否, YES=是)
type: integer enum:
- 'NO'
- 'YES'
type: string
required: required:
- assign_material_name
- material_id - material_id
- time
- torque_variation
- temperature
type: object type: object
result: {} result: {}
required: required:

View File

@@ -37,41 +37,42 @@ agv.SEER:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
send_nav_task: send_nav_task:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:

View File

@@ -122,6 +122,31 @@ robotic_arm.SCARA_with_slider.moveit.virtual:
title: moveit_task参数 title: moveit_task参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: post_init的参数schema
properties:
feedback: {}
goal:
properties:
ros_node:
type: object
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-resource_manager: auto-resource_manager:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -173,41 +198,41 @@ robotic_arm.SCARA_with_slider.moveit.virtual:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
pick_and_place: pick_and_place:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -216,41 +241,41 @@ robotic_arm.SCARA_with_slider.moveit.virtual:
type: object type: object
type: SendCmd type: SendCmd
set_position: set_position:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -259,41 +284,41 @@ robotic_arm.SCARA_with_slider.moveit.virtual:
type: object type: object
type: SendCmd type: SendCmd
set_status: set_status:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -430,41 +455,42 @@ robotic_arm.UR:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
move_pos_task: move_pos_task:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -506,8 +532,8 @@ robotic_arm.UR:
type: string type: string
required: required:
- arm_pose - arm_pose
- arm_status
- gripper_pose - gripper_pose
- arm_status
- gripper_status - gripper_status
type: object type: object
version: 1.0.0 version: 1.0.0
@@ -700,41 +726,41 @@ robotic_arm.elite:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
modbus_task_cmd: modbus_task_cmd:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -744,8 +770,8 @@ robotic_arm.elite:
type: SendCmd type: SendCmd
module: unilabos.devices.arm.elite_robot:EliteRobot module: unilabos.devices.arm.elite_robot:EliteRobot
status_types: status_types:
actual_joint_positions: '' actual_joint_positions: String
arm_pose: list[float] arm_pose: String
type: python type: python
config_info: [] config_info: []
description: Elite robot arm description: Elite robot arm
@@ -771,8 +797,8 @@ robotic_arm.elite:
type: number type: number
type: array type: array
required: required:
- actual_joint_positions
- arm_pose - arm_pose
- actual_joint_positions
type: object type: object
model: model:
mesh: elite_robot mesh: elite_robot

View File

@@ -114,12 +114,11 @@ gripper.misumi_rz:
goal: goal:
properties: properties:
data: data:
type: object type: string
required: required:
- data - data
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: modbus_crc参数 title: modbus_crc参数
@@ -399,26 +398,30 @@ gripper.misumi_rz:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -501,82 +504,71 @@ gripper.mock:
type: UniLabJsonCommand type: UniLabJsonCommand
push_to: push_to:
feedback: feedback:
effort: effort effort: torque
position: position position: position
reached_goal: reached_goal
stalled: stalled
goal: goal:
command: command command.max_effort: torque
position: position command.position: position
torque: torque
velocity: velocity
goal_default: goal_default:
command: command:
max_effort: 0.0 max_effort: 0.0
position: 0.0 position: 0.0
handles: {} handles: {}
placeholder_keys: {}
result: result:
effort: effort effort: torque
position: position position: position
reached_goal: reached_goal
stalled: stalled
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
effort: effort:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
position: position:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
reached_goal: reached_goal:
type: boolean type: boolean
stalled: stalled:
type: boolean type: boolean
required:
- position
- effort
- stalled
- reached_goal
title: GripperCommand_Feedback title: GripperCommand_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
additionalProperties: false
properties: properties:
max_effort: max_effort:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
position: position:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- position - position
- max_effort - max_effort
title: command title: command
type: object type: object
required:
- command
title: GripperCommand_Goal title: GripperCommand_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
effort: effort:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
position: position:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
reached_goal: reached_goal:
type: boolean type: boolean
stalled: stalled:
type: boolean type: boolean
required:
- position
- effort
- stalled
- reached_goal
title: GripperCommand_Result title: GripperCommand_Result
type: object type: object
required: required:
@@ -612,8 +604,8 @@ gripper.mock:
type: number type: number
required: required:
- position - position
- status
- torque
- velocity - velocity
- torque
- status
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -24,27 +24,6 @@ linear_motion.grbl:
title: initialize参数 title: initialize参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-list:
feedback: {}
goal: {}
goal_default: {}
handles: {}
placeholder_keys: {}
result: {}
schema:
description: list的参数schema
properties:
feedback: {}
goal:
properties: {}
required: []
type: object
result: {}
required:
- goal
title: list参数
type: object
type: UniLabJsonCommand
auto-set_position: auto-set_position:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -114,39 +93,44 @@ linear_motion.grbl:
type: UniLabJsonCommandAsync type: UniLabJsonCommandAsync
move_through_points: move_through_points:
feedback: feedback:
current_pose: current_pose current_pose.pose.position: position
distance_remaining: distance_remaining estimated_time_remaining.sec: time_remaining
estimated_time_remaining: estimated_time_remaining navigation_time.sec: time_spent
navigation_time: navigation_time number_of_poses_remaining: pose_number_remaining
number_of_poses_remaining: number_of_poses_remaining
number_of_recoveries: number_of_recoveries
goal: goal:
behavior_tree: behavior_tree poses[].pose.position: positions[]
poses: poses
positions: positions
goal_default: goal_default:
behavior_tree: '' behavior_tree: ''
poses: [] poses:
- header:
frame_id: ''
stamp:
nanosec: 0
sec: 0
pose:
orientation:
w: 1.0
x: 0.0
y: 0.0
z: 0.0
position:
x: 0.0
y: 0.0
z: 0.0
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
result: result
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
current_pose: current_pose:
additionalProperties: false
properties: properties:
header: header:
additionalProperties: false
properties: properties:
frame_id: frame_id:
type: string type: string
stamp: stamp:
additionalProperties: false
properties: properties:
nanosec: nanosec:
maximum: 4294967295 maximum: 4294967295
@@ -167,26 +151,16 @@ linear_motion.grbl:
title: header title: header
type: object type: object
pose: pose:
additionalProperties: false
properties: properties:
orientation: orientation:
additionalProperties: false
properties: properties:
w: w:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- x - x
@@ -196,19 +170,12 @@ linear_motion.grbl:
title: orientation title: orientation
type: object type: object
position: position:
additionalProperties: false
properties: properties:
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- x - x
@@ -227,11 +194,8 @@ linear_motion.grbl:
title: current_pose title: current_pose
type: object type: object
distance_remaining: distance_remaining:
maximum: 3.4028235e+38
minimum: -3.4028235e+38
type: number type: number
estimated_time_remaining: estimated_time_remaining:
additionalProperties: false
properties: properties:
nanosec: nanosec:
maximum: 4294967295 maximum: 4294967295
@@ -247,7 +211,6 @@ linear_motion.grbl:
title: estimated_time_remaining title: estimated_time_remaining
type: object type: object
navigation_time: navigation_time:
additionalProperties: false
properties: properties:
nanosec: nanosec:
maximum: 4294967295 maximum: 4294967295
@@ -270,10 +233,16 @@ linear_motion.grbl:
maximum: 32767 maximum: 32767
minimum: -32768 minimum: -32768
type: integer type: integer
required:
- current_pose
- navigation_time
- estimated_time_remaining
- number_of_recoveries
- distance_remaining
- number_of_poses_remaining
title: NavigateThroughPoses_Feedback title: NavigateThroughPoses_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
behavior_tree: behavior_tree:
type: string type: string
@@ -287,8 +256,12 @@ linear_motion.grbl:
stamp: stamp:
properties: properties:
nanosec: nanosec:
maximum: 4294967295
minimum: 0
type: integer type: integer
sec: sec:
maximum: 2147483647
minimum: -2147483648
type: integer type: integer
required: required:
- sec - sec
@@ -341,17 +314,23 @@ linear_motion.grbl:
required: required:
- header - header
- pose - pose
title: poses
type: object type: object
type: array type: array
required:
- poses
- behavior_tree
title: NavigateThroughPoses_Goal title: NavigateThroughPoses_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
result: result:
additionalProperties: true properties: {}
required: []
title: result title: result
type: object type: object
required:
- result
title: NavigateThroughPoses_Result title: NavigateThroughPoses_Result
type: object type: object
required: required:
@@ -361,15 +340,9 @@ linear_motion.grbl:
type: NavigateThroughPoses type: NavigateThroughPoses
set_spindle_speed: set_spindle_speed:
feedback: feedback:
error: error position: spindle_speed
header: header
position: position
velocity: velocity
goal: goal:
max_velocity: max_velocity position: spindle_speed
min_duration: min_duration
position: position
spindle_speed: spindle_speed
goal_default: goal_default:
max_velocity: 0.0 max_velocity: 0.0
min_duration: min_duration:
@@ -377,25 +350,19 @@ linear_motion.grbl:
sec: 0 sec: 0
position: 0.0 position: 0.0
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
error: error:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
header: header:
additionalProperties: false
properties: properties:
frame_id: frame_id:
type: string type: string
stamp: stamp:
additionalProperties: false
properties: properties:
nanosec: nanosec:
maximum: 4294967295 maximum: 4294967295
@@ -416,24 +383,21 @@ linear_motion.grbl:
title: header title: header
type: object type: object
position: position:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
velocity: velocity:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required:
- header
- position
- velocity
- error
title: SingleJointPosition_Feedback title: SingleJointPosition_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
max_velocity: max_velocity:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
min_duration: min_duration:
additionalProperties: false
properties: properties:
nanosec: nanosec:
maximum: 4294967295 maximum: 4294967295
@@ -449,13 +413,16 @@ linear_motion.grbl:
title: min_duration title: min_duration
type: object type: object
position: position:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required:
- position
- min_duration
- max_velocity
title: SingleJointPosition_Goal title: SingleJointPosition_Goal
type: object type: object
result: result:
additionalProperties: true properties: {}
required: []
title: SingleJointPosition_Result title: SingleJointPosition_Result
type: object type: object
required: required:
@@ -465,7 +432,7 @@ linear_motion.grbl:
type: SingleJointPosition type: SingleJointPosition
module: unilabos.devices.cnc.grbl_sync:GrblCNC module: unilabos.devices.cnc.grbl_sync:GrblCNC
status_types: status_types:
position: Point3D position: unilabos.messages:Point3D
spindle_speed: float spindle_speed: float
status: str status: str
type: python type: python
@@ -504,9 +471,9 @@ linear_motion.grbl:
status: status:
type: string type: string
required: required:
- status
- position - position
- spindle_speed - spindle_speed
- status
type: object type: object
version: 1.0.0 version: 1.0.0
linear_motion.toyo_xyz.sim: linear_motion.toyo_xyz.sim:
@@ -633,6 +600,31 @@ linear_motion.toyo_xyz.sim:
title: moveit_task参数 title: moveit_task参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: post_init的参数schema
properties:
feedback: {}
goal:
properties:
ros_node:
type: object
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-resource_manager: auto-resource_manager:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -684,41 +676,41 @@ linear_motion.toyo_xyz.sim:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
pick_and_place: pick_and_place:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -727,41 +719,41 @@ linear_motion.toyo_xyz.sim:
type: object type: object
type: SendCmd type: SendCmd
set_position: set_position:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -770,41 +762,41 @@ linear_motion.toyo_xyz.sim:
type: object type: object
type: SendCmd type: SendCmd
set_status: set_status:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -947,26 +939,30 @@ motor.iCL42:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -1004,8 +1000,8 @@ motor.iCL42:
success: success:
type: boolean type: boolean
required: required:
- is_executing_run
- motor_position - motor_position
- is_executing_run
- success - success
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -0,0 +1,148 @@
sensor.xkc_rs485:
category:
- sensor
- separator
class:
action_value_mappings:
auto-change_baudrate:
goal:
baud_code: 7
handles: {}
schema:
description: '更改通讯波特率 (设置成功后无返回,且需手动切换波特率重连)。代码表 (16进制): 05=2400, 06=4800,
07=9600, 08=14400, 09=19200, 0A=28800, 0C=57600, 0D=115200, 0E=128000,
0F=256000'
properties:
goal:
properties:
baud_code:
description: '波特率代码 (例如: 7 为 9600, 13 即 0x0D 为 115200)'
type: integer
required:
- baud_code
type: object
type: UniLabJsonCommand
auto-change_device_id:
goal:
new_id: 1
handles: {}
schema:
description: 修改传感器的 Modbus 从站地址
properties:
goal:
properties:
new_id:
description: 新的从站地址 (1-254)
maximum: 254
minimum: 1
type: integer
required:
- new_id
type: object
type: UniLabJsonCommand
auto-factory_reset:
goal: {}
handles: {}
schema:
description: 恢复出厂设置 (地址重置为 01)
properties:
goal:
type: object
type: UniLabJsonCommand
auto-read_level:
goal: {}
handles: {}
schema:
description: 直接读取当前液位及信号强度
properties:
goal:
type: object
type: object
type: UniLabJsonCommand
auto-set_threshold:
goal:
threshold: 300
handles: {}
schema:
description: 设置液位判定阈值
properties:
goal:
properties:
threshold:
type: integer
required:
- threshold
type: object
type: UniLabJsonCommand
auto-wait_for_liquid:
goal:
target_state: true
timeout: 120
handles: {}
schema:
description: 实时检测电导率(RSSI)并等待用户指定的状态
properties:
goal:
properties:
target_state:
default: true
description: 目标状态 (True=有液, False=无液)
type: boolean
timeout:
default: 120
description: 超时时间 (秒)
required:
- target_state
type: object
type: UniLabJsonCommand
auto-wait_level:
goal:
level: true
timeout: 10
handles: {}
schema:
description: 等待液位达到目标状态
properties:
goal:
properties:
level:
type: boolean
timeout:
type: number
required:
- level
type: object
type: UniLabJsonCommand
module: unilabos.devices.separator.xkc_sensor:XKCSensorDriver
status_types:
level: bool
rssi: int
type: python
config_info: []
description: XKC RS485 非接触式液位传感器 (Modbus RTU)
handles: []
icon: ''
init_param_schema:
config:
properties:
baudrate:
default: 9600
type: integer
debug:
default: false
type: boolean
device_id:
default: 1
type: integer
port:
type: string
threshold:
default: 300
type: integer
timeout:
default: 3.0
type: number
required:
- port
type: object
version: 1.0.0

View File

@@ -14,24 +14,19 @@ solid_dispenser.laiyu:
powder_tube_number: 0 powder_tube_number: 0
target_tube_position: '' target_tube_position: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
actual_mass_mg: actual_mass_mg actual_mass_mg: actual_mass_mg
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: SolidDispenseAddPowderTube_Feedback title: SolidDispenseAddPowderTube_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
compound_mass: compound_mass:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
powder_tube_number: powder_tube_number:
maximum: 2147483647 maximum: 2147483647
@@ -39,19 +34,24 @@ solid_dispenser.laiyu:
type: integer type: integer
target_tube_position: target_tube_position:
type: string type: string
required:
- powder_tube_number
- target_tube_position
- compound_mass
title: SolidDispenseAddPowderTube_Goal title: SolidDispenseAddPowderTube_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
actual_mass_mg: actual_mass_mg:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- actual_mass_mg
- success
title: SolidDispenseAddPowderTube_Result title: SolidDispenseAddPowderTube_Result
type: object type: object
required: required:
@@ -74,12 +74,11 @@ solid_dispenser.laiyu:
goal: goal:
properties: properties:
data: data:
type: object type: string
required: required:
- data - data
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: calculate_crc参数 title: calculate_crc参数
@@ -100,12 +99,11 @@ solid_dispenser.laiyu:
goal: goal:
properties: properties:
command: command:
type: object type: string
required: required:
- command - command
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: send_command参数 title: send_command参数
@@ -114,37 +112,36 @@ solid_dispenser.laiyu:
discharge: discharge:
feedback: {} feedback: {}
goal: goal:
float_in: float_in float_input: float_input
goal_default: goal_default:
float_in: 0.0 float_in: 0.0
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: FloatSingleInput_Feedback title: FloatSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
float_in: float_in:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required:
- float_in
title: FloatSingleInput_Goal title: FloatSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: FloatSingleInput_Result title: FloatSingleInput_Result
type: object type: object
required: required:
@@ -159,31 +156,32 @@ solid_dispenser.laiyu:
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -202,41 +200,38 @@ solid_dispenser.laiyu:
y: 0.0 y: 0.0
z: 0.0 z: 0.0
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: Point3DSeparateInput_Feedback title: Point3DSeparateInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required:
- x
- y
- z
title: Point3DSeparateInput_Goal title: Point3DSeparateInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: Point3DSeparateInput_Result title: Point3DSeparateInput_Result
type: object type: object
required: required:
@@ -251,33 +246,34 @@ solid_dispenser.laiyu:
goal_default: goal_default:
int_input: 0 int_input: 0
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: IntSingleInput_Feedback title: IntSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
int_input: int_input:
maximum: 2147483647 maximum: 2147483647
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
required:
- int_input
title: IntSingleInput_Goal title: IntSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: IntSingleInput_Result title: IntSingleInput_Result
type: object type: object
required: required:
@@ -292,33 +288,34 @@ solid_dispenser.laiyu:
goal_default: goal_default:
int_input: 0 int_input: 0
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: IntSingleInput_Feedback title: IntSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
int_input: int_input:
maximum: 2147483647 maximum: 2147483647
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
required:
- int_input
title: IntSingleInput_Goal title: IntSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: IntSingleInput_Result title: IntSingleInput_Result
type: object type: object
required: required:
@@ -331,25 +328,26 @@ solid_dispenser.laiyu:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:

View File

@@ -34,8 +34,7 @@ chiller:
- register_address - register_address
- value - value
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: build_modbus_frame参数 title: build_modbus_frame参数
@@ -64,8 +63,7 @@ chiller:
required: required:
- temperature - temperature
type: object type: object
result: result: {}
type: integer
required: required:
- goal - goal
title: convert_temperature_to_modbus_value参数 title: convert_temperature_to_modbus_value参数
@@ -86,12 +84,11 @@ chiller:
goal: goal:
properties: properties:
data: data:
type: object type: string
required: required:
- data - data
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: modbus_crc参数 title: modbus_crc参数
@@ -119,41 +116,42 @@ chiller:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
set_temperature: set_temperature:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -268,15 +266,9 @@ heaterstirrer.dalong:
feedback: feedback:
status: status status: status
goal: goal:
pressure: pressure
purpose: purpose purpose: purpose
reflux_solvent: reflux_solvent
stir: stir
stir_speed: stir_speed
temp: temp temp: temp
temp_spec: temp_spec
time: time time: time
time_spec: time_spec
vessel: vessel vessel: vessel
goal_default: goal_default:
pressure: '' pressure: ''
@@ -309,23 +301,20 @@ heaterstirrer.dalong:
sample_id: '' sample_id: ''
type: '' type: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
message: message
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: HeatChill_Feedback title: HeatChill_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
pressure: pressure:
type: string type: string
@@ -336,12 +325,8 @@ heaterstirrer.dalong:
stir: stir:
type: boolean type: boolean
stir_speed: stir_speed:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
temp: temp:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
temp_spec: temp_spec:
type: string type: string
@@ -350,7 +335,6 @@ heaterstirrer.dalong:
time_spec: time_spec:
type: string type: string
vessel: vessel:
additionalProperties: false
properties: properties:
category: category:
type: string type: string
@@ -369,26 +353,16 @@ heaterstirrer.dalong:
parent: parent:
type: string type: string
pose: pose:
additionalProperties: false
properties: properties:
orientation: orientation:
additionalProperties: false
properties: properties:
w: w:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- x - x
@@ -398,19 +372,12 @@ heaterstirrer.dalong:
title: orientation title: orientation
type: object type: object
position: position:
additionalProperties: false
properties: properties:
x: x:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
y: y:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
z: z:
maximum: 1.7976931348623157e+308
minimum: -1.7976931348623157e+308
type: number type: number
required: required:
- x - x
@@ -440,10 +407,20 @@ heaterstirrer.dalong:
- data - data
title: vessel title: vessel
type: object type: object
required:
- vessel
- temp
- time
- temp_spec
- time_spec
- pressure
- reflux_solvent
- stir
- stir_speed
- purpose
title: HeatChill_Goal title: HeatChill_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
message: message:
type: string type: string
@@ -451,6 +428,10 @@ heaterstirrer.dalong:
type: string type: string
success: success:
type: boolean type: boolean
required:
- success
- message
- return_info
title: HeatChill_Result title: HeatChill_Result
type: object type: object
required: required:
@@ -459,42 +440,42 @@ heaterstirrer.dalong:
type: object type: object
type: HeatChill type: HeatChill
set_temp_target: set_temp_target:
feedback: feedback: {}
status: status
goal: goal:
command: command command: temp
temp: temp
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -503,42 +484,42 @@ heaterstirrer.dalong:
type: object type: object
type: SendCmd type: SendCmd
set_temp_warning: set_temp_warning:
feedback: feedback: {}
status: status
goal: goal:
command: command command: temp
temp: temp
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:
@@ -588,8 +569,8 @@ heaterstirrer.dalong:
- status - status
- stir_speed - stir_speed
- temp - temp
- temp_target
- temp_warning - temp_warning
- temp_target
type: object type: object
version: 1.0.0 version: 1.0.0
tempsensor: tempsensor:
@@ -710,41 +691,42 @@ tempsensor:
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
set_warning: set_warning:
feedback: feedback: {}
status: status
goal: goal:
command: command command: command
goal_default: goal_default:
command: '' command: ''
handles: {} handles: {}
placeholder_keys: {}
result: result:
return_info: return_info
success: success success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: false
properties: properties:
status: status:
type: string type: string
required:
- status
title: SendCmd_Feedback title: SendCmd_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
command: command:
type: string type: string
required:
- command
title: SendCmd_Goal title: SendCmd_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: SendCmd_Result title: SendCmd_Result
type: object type: object
required: required:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -45,6 +45,31 @@ xrd_d7mate:
title: connect参数 title: connect参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
ros_node:
type: string
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
auto-start_from_string: auto-start_from_string:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -60,14 +85,11 @@ xrd_d7mate:
goal: goal:
properties: properties:
params: params:
anyOf: type: string
- type: string
- type: object
required: required:
- params - params
type: object type: object
result: result: {}
type: object
required: required:
- goal - goal
title: start_from_string参数 title: start_from_string参数
@@ -83,18 +105,21 @@ xrd_d7mate:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -105,38 +130,38 @@ xrd_d7mate:
get_sample_down: get_sample_down:
feedback: {} feedback: {}
goal: goal:
int_input: int_input sample_station: 1
sample_station: sample_station
goal_default: goal_default:
int_input: 0 int_input: 0
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: IntSingleInput_Feedback title: IntSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
int_input: int_input:
maximum: 2147483647 maximum: 2147483647
minimum: -2147483648 minimum: -2147483648
type: integer type: integer
required:
- int_input
title: IntSingleInput_Goal title: IntSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: IntSingleInput_Result title: IntSingleInput_Result
type: object type: object
required: required:
@@ -154,18 +179,21 @@ xrd_d7mate:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -183,18 +211,21 @@ xrd_d7mate:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -207,25 +238,26 @@ xrd_d7mate:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -242,35 +274,42 @@ xrd_d7mate:
sample_id: '' sample_id: ''
start_theta: 10.0 start_theta: 10.0
goal_default: goal_default:
end_theta: null end_theta: 80.0
exp_time: null exp_time: 0.5
increment: null increment: 0.02
sample_id: null sample_id: Sample001
start_theta: null start_theta: 10.0
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 送样完成后,发送样品信息和采集参数 description: 送样完成后,发送样品信息和采集参数
properties: properties:
feedback: feedback:
properties: {}
required: []
title: SampleReadyInput_Feedback title: SampleReadyInput_Feedback
type: object
goal: goal:
properties: properties:
end_theta: end_theta:
description: 结束角度≥5.5°且必须大于start_theta description: 结束角度≥5.5°且必须大于start_theta
minimum: 5.5
type: number type: number
exp_time: exp_time:
description: 曝光时间0.1-5.0秒) description: 曝光时间0.1-5.0秒)
maximum: 5.0
minimum: 0.1
type: number type: number
increment: increment:
description: 角度增量≥0.005 description: 角度增量≥0.005
minimum: 0.005
type: number type: number
sample_id: sample_id:
description: 样品标识符 description: 样品标识符
type: string type: string
start_theta: start_theta:
description: 起始角度≥5° description: 起始角度≥5°
minimum: 5.0
type: number type: number
required: required:
- sample_id - sample_id
@@ -281,11 +320,19 @@ xrd_d7mate:
title: SampleReadyInput_Goal title: SampleReadyInput_Goal
type: object type: object
result: result:
properties:
return_info:
type: string
success:
type: boolean
required:
- return_info
- success
title: SampleReadyInput_Result title: SampleReadyInput_Result
type: object type: object
required: required:
- goal - goal
title: send_sample_ready参数 title: SampleReadyInput
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
set_power_off: set_power_off:
@@ -293,25 +340,26 @@ xrd_d7mate:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -324,25 +372,26 @@ xrd_d7mate:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -356,16 +405,18 @@ xrd_d7mate:
current: 30.0 current: 30.0
voltage: 40.0 voltage: 40.0
goal_default: goal_default:
current: null current: 30.0
voltage: null voltage: 40.0
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 设置高压电源电压和电流 description: 设置高压电源电压和电流
properties: properties:
feedback: feedback:
properties: {}
required: []
title: VoltageCurrentInput_Feedback title: VoltageCurrentInput_Feedback
type: object
goal: goal:
properties: properties:
current: current:
@@ -380,11 +431,19 @@ xrd_d7mate:
title: VoltageCurrentInput_Goal title: VoltageCurrentInput_Goal
type: object type: object
result: result:
properties:
return_info:
type: string
success:
type: boolean
required:
- return_info
- success
title: VoltageCurrentInput_Result title: VoltageCurrentInput_Result
type: object type: object
required: required:
- goal - goal
title: set_voltage_current参数 title: VoltageCurrentInput
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
start: start:
@@ -394,12 +453,11 @@ xrd_d7mate:
end_theta: 80.0 end_theta: 80.0
exp_time: 0.1 exp_time: 0.1
increment: 0.05 increment: 0.05
sample_id: '' sample_id: 样品名称
start_theta: 10.0 start_theta: 10.0
string: '' string: ''
wait_minutes: 3.0 wait_minutes: 3.0
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 启动自动模式→上样→等待→样品准备→监控→检测下样位→执行下样流程。 description: 启动自动模式→上样→等待→样品准备→监控→检测下样位→执行下样流程。
@@ -408,42 +466,54 @@ xrd_d7mate:
goal: goal:
properties: properties:
end_theta: end_theta:
default: 80.0
description: 结束角度≥5.5°且必须大于start_theta description: 结束角度≥5.5°且必须大于start_theta
type: number minimum: 5.5
type: string
exp_time: exp_time:
default: 0.1
description: 曝光时间0.1-5.0秒) description: 曝光时间0.1-5.0秒)
type: number maximum: 5.0
minimum: 0.1
type: string
increment: increment:
default: 0.05
description: 角度增量≥0.005 description: 角度增量≥0.005
type: number minimum: 0.005
type: string
sample_id: sample_id:
default: ''
description: 样品标识符 description: 样品标识符
type: string type: string
start_theta: start_theta:
default: 10.0
description: 起始角度≥5° description: 起始角度≥5°
type: number minimum: 5.0
type: string
string: string:
default: ''
description: 字符串格式的参数输入,如果提供则优先解析使用 description: 字符串格式的参数输入,如果提供则优先解析使用
type: string type: string
wait_minutes: wait_minutes:
default: 3.0
description: 允许上样后等待分钟数 description: 允许上样后等待分钟数
minimum: 0.0
type: number type: number
required: [] required:
- sample_id
- start_theta
- end_theta
- increment
- exp_time
title: StartWorkflow_Goal title: StartWorkflow_Goal
type: object type: object
result: result:
properties:
return_info:
type: string
success:
type: boolean
required:
- return_info
- success
title: StartWorkflow_Result title: StartWorkflow_Result
type: object type: object
required: required:
- goal - goal
title: start参数 title: StartWorkflow
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
start_auto_mode: start_auto_mode:
@@ -451,15 +521,17 @@ xrd_d7mate:
goal: goal:
status: true status: true
goal_default: goal_default:
status: null status: true
handles: {} handles: {}
placeholder_keys: {}
result: {} result: {}
schema: schema:
description: 启动或停止自动模式 description: 启动或停止自动模式
properties: properties:
feedback: feedback:
properties: {}
required: []
title: BoolSingleInput_Feedback title: BoolSingleInput_Feedback
type: object
goal: goal:
properties: properties:
status: status:
@@ -470,16 +542,25 @@ xrd_d7mate:
title: BoolSingleInput_Goal title: BoolSingleInput_Goal
type: object type: object
result: result:
properties:
return_info:
type: string
success:
type: boolean
required:
- return_info
- success
title: BoolSingleInput_Result title: BoolSingleInput_Result
type: object type: object
required: required:
- goal - goal
title: start_auto_mode参数 title: BoolSingleInput
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
module: unilabos.devices.xrd_d7mate.xrd_d7mate:XRDClient module: unilabos.devices.xrd_d7mate.xrd_d7mate:XRDClient
status_types: status_types:
current_acquire_data: dict current_acquire_data: dict
sample_down: dict
sample_request: dict sample_request: dict
sample_status: dict sample_status: dict
type: python type: python
@@ -505,13 +586,16 @@ xrd_d7mate:
properties: properties:
current_acquire_data: current_acquire_data:
type: object type: object
sample_down:
type: object
sample_request: sample_request:
type: object type: object
sample_status: sample_status:
type: object type: object
required: required:
- current_acquire_data
- sample_request - sample_request
- current_acquire_data
- sample_status - sample_status
- sample_down
type: object type: object
version: 1.0.0 version: 1.0.0

View File

@@ -8,25 +8,26 @@ zhida_gcms:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -76,6 +77,31 @@ zhida_gcms:
title: connect参数 title: connect参数
type: object type: object
type: UniLabJsonCommand type: UniLabJsonCommand
auto-post_init:
feedback: {}
goal: {}
goal_default:
ros_node: null
handles: {}
placeholder_keys: {}
result: {}
schema:
description: ''
properties:
feedback: {}
goal:
properties:
ros_node:
type: string
required:
- ros_node
type: object
result: {}
required:
- goal
title: post_init参数
type: object
type: UniLabJsonCommand
get_methods: get_methods:
feedback: {} feedback: {}
goal: {} goal: {}
@@ -86,18 +112,21 @@ zhida_gcms:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -115,18 +144,21 @@ zhida_gcms:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -144,18 +176,21 @@ zhida_gcms:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -168,25 +203,26 @@ zhida_gcms:
goal: {} goal: {}
goal_default: {} goal_default: {}
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Feedback title: EmptyIn_Feedback
type: object type: object
goal: goal:
additionalProperties: true properties: {}
required: []
title: EmptyIn_Goal title: EmptyIn_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
required:
- return_info
title: EmptyIn_Result title: EmptyIn_Result
type: object type: object
required: required:
@@ -198,35 +234,35 @@ zhida_gcms:
feedback: {} feedback: {}
goal: goal:
string: string string: string
text: text
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -237,36 +273,36 @@ zhida_gcms:
start_with_csv_file: start_with_csv_file:
feedback: {} feedback: {}
goal: goal:
csv_file_path: csv_file_path
string: string string: string
goal_default: goal_default:
string: '' string: ''
handles: {} handles: {}
placeholder_keys: {} result: {}
result:
return_info: return_info
success: success
schema: schema:
description: '' description: ''
properties: properties:
feedback: feedback:
additionalProperties: true properties: {}
required: []
title: StrSingleInput_Feedback title: StrSingleInput_Feedback
type: object type: object
goal: goal:
additionalProperties: false
properties: properties:
string: string:
type: string type: string
required:
- string
title: StrSingleInput_Goal title: StrSingleInput_Goal
type: object type: object
result: result:
additionalProperties: false
properties: properties:
return_info: return_info:
type: string type: string
success: success:
type: boolean type: boolean
required:
- return_info
- success
title: StrSingleInput_Result title: StrSingleInput_Result
type: object type: object
required: required:
@@ -307,8 +343,8 @@ zhida_gcms:
version: version:
type: object type: object
required: required:
- methods
- status - status
- methods
- version - version
type: object type: object
version: 1.0.0 version: 1.0.0

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ YB_20ml_fenyeping:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_5ml_fenyeping: YB_5ml_fenyeping:
category: category:
@@ -21,6 +22,7 @@ YB_5ml_fenyeping:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_jia_yang_tou_da: YB_jia_yang_tou_da:
category: category:
@@ -33,6 +35,7 @@ YB_jia_yang_tou_da:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_pei_ye_da_Bottle: YB_pei_ye_da_Bottle:
category: category:
@@ -45,6 +48,7 @@ YB_pei_ye_da_Bottle:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_pei_ye_xiao_Bottle: YB_pei_ye_xiao_Bottle:
category: category:
@@ -57,6 +61,7 @@ YB_pei_ye_xiao_Bottle:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_qiang_tou: YB_qiang_tou:
category: category:
@@ -69,6 +74,7 @@ YB_qiang_tou:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_ye_Bottle: YB_ye_Bottle:
category: category:
@@ -82,4 +88,5 @@ YB_ye_Bottle:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -9,6 +9,7 @@ YB_100ml_yeti:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_20ml_fenyepingban: YB_20ml_fenyepingban:
category: category:
@@ -21,6 +22,7 @@ YB_20ml_fenyepingban:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_5ml_fenyepingban: YB_5ml_fenyepingban:
category: category:
@@ -33,6 +35,7 @@ YB_5ml_fenyepingban:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_6StockCarrier: YB_6StockCarrier:
category: category:
@@ -45,6 +48,7 @@ YB_6StockCarrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_6VialCarrier: YB_6VialCarrier:
category: category:
@@ -57,6 +61,7 @@ YB_6VialCarrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_gao_nian_ye_Bottle: YB_gao_nian_ye_Bottle:
category: category:
@@ -69,6 +74,7 @@ YB_gao_nian_ye_Bottle:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_gaonianye: YB_gaonianye:
category: category:
@@ -81,6 +87,7 @@ YB_gaonianye:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_jia_yang_tou_da_Carrier: YB_jia_yang_tou_da_Carrier:
category: category:
@@ -93,6 +100,7 @@ YB_jia_yang_tou_da_Carrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_peiyepingdaban: YB_peiyepingdaban:
category: category:
@@ -105,6 +113,7 @@ YB_peiyepingdaban:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_peiyepingxiaoban: YB_peiyepingxiaoban:
category: category:
@@ -117,6 +126,7 @@ YB_peiyepingxiaoban:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_qiang_tou_he: YB_qiang_tou_he:
category: category:
@@ -129,6 +139,7 @@ YB_qiang_tou_he:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_shi_pei_qi_kuai: YB_shi_pei_qi_kuai:
category: category:
@@ -141,6 +152,7 @@ YB_shi_pei_qi_kuai:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_ye: YB_ye:
category: category:
@@ -153,6 +165,7 @@ YB_ye:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
YB_ye_100ml_Bottle: YB_ye_100ml_Bottle:
category: category:
@@ -165,4 +178,5 @@ YB_ye_100ml_Bottle:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -8,6 +8,7 @@ BIOYOND_PolymerStation_1BottleCarrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
BIOYOND_PolymerStation_1FlaskCarrier: BIOYOND_PolymerStation_1FlaskCarrier:
category: category:
@@ -19,6 +20,7 @@ BIOYOND_PolymerStation_1FlaskCarrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
BIOYOND_PolymerStation_6StockCarrier: BIOYOND_PolymerStation_6StockCarrier:
category: category:
@@ -30,6 +32,7 @@ BIOYOND_PolymerStation_6StockCarrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
BIOYOND_PolymerStation_8StockCarrier: BIOYOND_PolymerStation_8StockCarrier:
category: category:
@@ -41,4 +44,18 @@ BIOYOND_PolymerStation_8StockCarrier:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0
BIOYOND_PolymerStation_TipBox:
category:
- bottle_carriers
- tip_racks
class:
module: unilabos.resources.bioyond.bottle_carriers:BIOYOND_PolymerStation_TipBox
type: pylabrobot
description: BIOYOND_PolymerStation_TipBox (4x6布局24个枪头孔位)
handles: []
icon: ''
init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -82,14 +82,3 @@ BIOYOND_PolymerStation_Solution_Beaker:
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
version: 1.0.0 version: 1.0.0
BIOYOND_PolymerStation_TipBox:
category:
- bottles
- tip_boxes
class:
module: unilabos.resources.bioyond.bottles:BIOYOND_PolymerStation_TipBox
type: pylabrobot
handles: []
icon: ''
init_param_schema: {}
version: 1.0.0

View File

@@ -8,6 +8,7 @@ BIOYOND_PolymerPreparationStation_Deck:
handles: [] handles: []
icon: 配液站.webp icon: 配液站.webp
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
BIOYOND_PolymerReactionStation_Deck: BIOYOND_PolymerReactionStation_Deck:
category: category:
@@ -19,6 +20,7 @@ BIOYOND_PolymerReactionStation_Deck:
handles: [] handles: []
icon: 反应站.webp icon: 反应站.webp
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
BIOYOND_YB_Deck: BIOYOND_YB_Deck:
category: category:
@@ -30,6 +32,7 @@ BIOYOND_YB_Deck:
handles: [] handles: []
icon: 配液站.webp icon: 配液站.webp
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
CoincellDeck: CoincellDeck:
category: category:
@@ -41,4 +44,5 @@ CoincellDeck:
handles: [] handles: []
icon: koudian.webp icon: koudian.webp
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -1,3 +1,24 @@
disposal:
category:
- disposal
- waste
- resource_container
class:
module: unilabos.resources.disposal:Disposal
type: unilabos
description: 废料处理位置,用于处理实验废料
handles:
- data_key: disposal_access
data_source: handle
data_type: fluid
handler_key: access
io_type: target
label: access
side: NORTH
icon: ''
init_param_schema: {}
registry_type: resource
version: 1.0.0
hplc_plate: hplc_plate:
category: category:
- resource_container - resource_container
@@ -19,6 +40,56 @@ hplc_plate:
- 3.1416 - 3.1416
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/hplc_plate/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/hplc_plate/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0
maintenance:
category:
- maintenance
- position
- resource_container
class:
module: unilabos.resources.maintenance:Maintenance
type: unilabos
description: 维护位置,用于设备维护和校准
handles:
- data_key: maintenance_access
data_source: handle
data_type: mechanical
handler_key: access
io_type: target
label: access
side: NORTH
icon: ''
init_param_schema: {}
registry_type: resource
version: 1.0.0
plate:
category:
- plate
- labware
- resource_container
class:
module: unilabos.resources.plate:Plate
type: unilabos
description: 实验板,用于放置样品和试剂
handles:
- data_key: plate_access
data_source: handle
data_type: mechanical
handler_key: access
io_type: target
label: access
side: NORTH
- data_key: sample_wells
data_source: handle
data_type: fluid
handler_key: wells
io_type: target
label: wells
side: CENTER
icon: ''
init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
plate_96: plate_96:
category: category:
@@ -41,6 +112,7 @@ plate_96:
- 0 - 0
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/plate_96/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/plate_96/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0
plate_96_high: plate_96_high:
category: category:
@@ -63,6 +135,35 @@ plate_96_high:
- 1.5708 - 1.5708
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/plate_96_high/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/plate_96_high/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0
tip_rack:
category:
- tip_rack
- labware
- resource_container
class:
module: unilabos.resources.tip_rack:TipRack
type: unilabos
description: 枪头架资源,用于存放和管理移液器枪头
handles:
- data_key: tip_access
data_source: handle
data_type: mechanical
handler_key: access
io_type: target
label: access
side: NORTH
- data_key: tip_pickup
data_source: handle
data_type: mechanical
handler_key: pickup
io_type: target
label: pickup
side: SOUTH
icon: ''
init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
tiprack_96_high: tiprack_96_high:
category: category:
@@ -94,6 +195,7 @@ tiprack_96_high:
- 1.5708 - 1.5708
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tiprack_96_high/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tiprack_96_high/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0
tiprack_box: tiprack_box:
category: category:
@@ -125,4 +227,5 @@ tiprack_box:
- 0 - 0
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tiprack_box/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tiprack_box/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -29,6 +29,7 @@ bottle_container:
- 0 - 0
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/bottle_container/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/bottle_container/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0
tube_container: tube_container:
category: category:
@@ -61,4 +62,5 @@ tube_container:
- 0 - 0
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tube_container/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tube_container/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -12,4 +12,5 @@ TransformXYZDeck:
mesh: liquid_transform_xyz mesh: liquid_transform_xyz
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/devices/liquid_transform_xyz/macro_device.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/devices/liquid_transform_xyz/macro_device.xacro
type: device type: device
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -12,6 +12,7 @@ OTDeck:
mesh: opentrons_liquid_handler mesh: opentrons_liquid_handler
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/devices/opentrons_liquid_handler/macro_device.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/devices/opentrons_liquid_handler/macro_device.xacro
type: device type: device
registry_type: resource
version: 1.0.0 version: 1.0.0
hplc_station: hplc_station:
category: category:
@@ -27,4 +28,5 @@ hplc_station:
mesh: hplc_station mesh: hplc_station
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/devices/hplc_station/macro_device.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/devices/hplc_station/macro_device.xacro
type: device type: device
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -8,4 +8,5 @@ Opentrons_96_adapter_Vb:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -8,6 +8,7 @@ appliedbiosystemsmicroamp_384_wellplate_40ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
biorad_384_wellplate_50ul: biorad_384_wellplate_50ul:
category: category:
@@ -19,6 +20,7 @@ biorad_384_wellplate_50ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
biorad_96_wellplate_200ul_pcr: biorad_96_wellplate_200ul_pcr:
category: category:
@@ -30,6 +32,7 @@ biorad_96_wellplate_200ul_pcr:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
corning_12_wellplate_6point9ml_flat: corning_12_wellplate_6point9ml_flat:
category: category:
@@ -41,6 +44,7 @@ corning_12_wellplate_6point9ml_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
corning_24_wellplate_3point4ml_flat: corning_24_wellplate_3point4ml_flat:
category: category:
@@ -52,6 +56,7 @@ corning_24_wellplate_3point4ml_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
corning_384_wellplate_112ul_flat: corning_384_wellplate_112ul_flat:
category: category:
@@ -63,6 +68,7 @@ corning_384_wellplate_112ul_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
corning_48_wellplate_1point6ml_flat: corning_48_wellplate_1point6ml_flat:
category: category:
@@ -74,6 +80,7 @@ corning_48_wellplate_1point6ml_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
corning_6_wellplate_16point8ml_flat: corning_6_wellplate_16point8ml_flat:
category: category:
@@ -85,6 +92,7 @@ corning_6_wellplate_16point8ml_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
corning_96_wellplate_360ul_flat: corning_96_wellplate_360ul_flat:
category: category:
@@ -96,6 +104,7 @@ corning_96_wellplate_360ul_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
nest_96_wellplate_100ul_pcr_full_skirt: nest_96_wellplate_100ul_pcr_full_skirt:
category: category:
@@ -127,6 +136,7 @@ nest_96_wellplate_100ul_pcr_full_skirt:
- 1.5708 - 1.5708
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tecan_nested_tip_rack/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tecan_nested_tip_rack/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0
nest_96_wellplate_200ul_flat: nest_96_wellplate_200ul_flat:
category: category:
@@ -138,6 +148,7 @@ nest_96_wellplate_200ul_flat:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
nest_96_wellplate_2ml_deep: nest_96_wellplate_2ml_deep:
category: category:
@@ -160,6 +171,7 @@ nest_96_wellplate_2ml_deep:
- 1.5708 - 1.5708
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tecan_nested_tip_rack/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tecan_nested_tip_rack/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0
thermoscientificnunc_96_wellplate_1300ul: thermoscientificnunc_96_wellplate_1300ul:
category: category:
@@ -171,6 +183,7 @@ thermoscientificnunc_96_wellplate_1300ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
thermoscientificnunc_96_wellplate_2000ul: thermoscientificnunc_96_wellplate_2000ul:
category: category:
@@ -182,6 +195,7 @@ thermoscientificnunc_96_wellplate_2000ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
usascientific_96_wellplate_2point4ml_deep: usascientific_96_wellplate_2point4ml_deep:
category: category:
@@ -193,4 +207,5 @@ usascientific_96_wellplate_2point4ml_deep:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -8,6 +8,7 @@ agilent_1_reservoir_290ml:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
axygen_1_reservoir_90ml: axygen_1_reservoir_90ml:
category: category:
@@ -19,6 +20,7 @@ axygen_1_reservoir_90ml:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
nest_12_reservoir_15ml: nest_12_reservoir_15ml:
category: category:
@@ -30,6 +32,7 @@ nest_12_reservoir_15ml:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
nest_1_reservoir_195ml: nest_1_reservoir_195ml:
category: category:
@@ -41,6 +44,7 @@ nest_1_reservoir_195ml:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
nest_1_reservoir_290ml: nest_1_reservoir_290ml:
category: category:
@@ -52,6 +56,7 @@ nest_1_reservoir_290ml:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
usascientific_12_reservoir_22ml: usascientific_12_reservoir_22ml:
category: category:
@@ -63,4 +68,5 @@ usascientific_12_reservoir_22ml:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0

View File

@@ -8,6 +8,7 @@ eppendorf_96_tiprack_1000ul_eptips:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
eppendorf_96_tiprack_10ul_eptips: eppendorf_96_tiprack_10ul_eptips:
category: category:
@@ -19,6 +20,7 @@ eppendorf_96_tiprack_10ul_eptips:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
geb_96_tiprack_1000ul: geb_96_tiprack_1000ul:
category: category:
@@ -30,6 +32,7 @@ geb_96_tiprack_1000ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
geb_96_tiprack_10ul: geb_96_tiprack_10ul:
category: category:
@@ -41,6 +44,7 @@ geb_96_tiprack_10ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_filtertiprack_1000ul: opentrons_96_filtertiprack_1000ul:
category: category:
@@ -71,6 +75,7 @@ opentrons_96_filtertiprack_1000ul:
- 1.5708 - 1.5708
path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tecan_nested_tip_rack/modal.xacro path: https://uni-lab.oss-cn-zhangjiakou.aliyuncs.com/uni-lab/resources/tecan_nested_tip_rack/modal.xacro
type: resource type: resource
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_filtertiprack_10ul: opentrons_96_filtertiprack_10ul:
category: category:
@@ -82,6 +87,7 @@ opentrons_96_filtertiprack_10ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_filtertiprack_200ul: opentrons_96_filtertiprack_200ul:
category: category:
@@ -93,6 +99,7 @@ opentrons_96_filtertiprack_200ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_filtertiprack_20ul: opentrons_96_filtertiprack_20ul:
category: category:
@@ -104,6 +111,7 @@ opentrons_96_filtertiprack_20ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_tiprack_1000ul: opentrons_96_tiprack_1000ul:
category: category:
@@ -115,6 +123,7 @@ opentrons_96_tiprack_1000ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_tiprack_10ul: opentrons_96_tiprack_10ul:
category: category:
@@ -126,6 +135,7 @@ opentrons_96_tiprack_10ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_tiprack_20ul: opentrons_96_tiprack_20ul:
category: category:
@@ -137,6 +147,7 @@ opentrons_96_tiprack_20ul:
handles: [] handles: []
icon: '' icon: ''
init_param_schema: {} init_param_schema: {}
registry_type: resource
version: 1.0.0 version: 1.0.0
opentrons_96_tiprack_300ul: opentrons_96_tiprack_300ul:
category: category:

Some files were not shown because too many files have changed in this diff Show More