Files
Uni-Lab-OS/docs/user_guide/launch.md
Xuwznln 9aeffebde1 0.10.7 Update (#101)
* Cleanup registry to be easy-understanding (#76)

* delete deprecated mock devices

* rename categories

* combine chromatographic devices

* rename rviz simulation nodes

* organic virtual devices

* parse vessel_id

* run registry completion before merge

---------

Co-authored-by: Xuwznln <18435084+Xuwznln@users.noreply.github.com>

* fix: workstation handlers and vessel_id parsing

* fix: working dir error when input config path
feat: report publish topic when error

* modify default discovery_interval to 15s

* feat: add trace log level

* feat: 添加ChinWe设备控制类,支持串口通信和电机控制功能 (#79)

* fix: drop_tips not using auto resource select

* fix: discard_tips error

* fix: discard_tips

* fix: prcxi_res

* add: prcxi res
fix: startup slow

* feat: workstation example

* fix pumps and liquid_handler handle

* feat: 优化protocol node节点运行日志

* fix all protocol_compilers and remove deprecated devices

* feat: 新增use_remote_resource参数

* fix and remove redundant info

* bugfixes on organic protocols

* fix filter protocol

* fix protocol node

* 临时兼容错误的driver写法

* fix: prcxi import error

* use call_async in all service to avoid deadlock

* fix: figure_resource

* Update recipe.yaml

* add workstation template and battery example

* feat: add sk & ak

* update workstation base

* Create workstation_architecture.md

* refactor: workstation_base 重构为仅含业务逻辑,通信和子设备管理交给 ProtocolNode

* refactor: ProtocolNode→WorkstationNode

* Add:msgs.action (#83)

* update: Workstation dev 将版本号从 0.10.3 更新为 0.10.4 (#84)

* Add:msgs.action

* update: 将版本号从 0.10.3 更新为 0.10.4

* simplify resource system

* uncompleted refactor

* example for use WorkstationBase

* feat: websocket

* feat: websocket test

* feat: workstation example

* feat: action status

* fix: station自己的方法注册错误

* fix: 还原protocol node处理方法

* fix: build

* fix: missing job_id key

* ws test version 1

* ws test version 2

* ws protocol

* 增加物料关系上传日志

* 增加物料关系上传日志

* 修正物料关系上传

* 修复工站的tracker实例追踪失效问题

* 增加handle检测,增加material edge关系上传

* 修复event loop错误

* 修复edge上报错误

* 修复async错误

* 更新schema的title字段

* 主机节点信息等支持自动刷新

* 注册表编辑器

* 修复status密集发送时,消息出错

* 增加addr参数

* fix: addr param

* fix: addr param

* 取消labid 和 强制config输入

* Add action definitions for LiquidHandlerSetGroup and LiquidHandlerTransferGroup

- Created LiquidHandlerSetGroup.action with fields for group name, wells, and volumes.
- Created LiquidHandlerTransferGroup.action with fields for source and target group names and unit volume.
- Both actions include response fields for return information and success status.

* Add LiquidHandlerSetGroup and LiquidHandlerTransferGroup actions to CMakeLists

* Add set_group and transfer_group methods to PRCXI9300Handler and update liquid_handler.yaml

* result_info改为字典类型

* 新增uat的地址替换

* runze multiple pump support

(cherry picked from commit 49354fcf39)

* remove runze multiple software obtainer

(cherry picked from commit 8bcc92a394)

* support multiple backbone

(cherry picked from commit 4771ff2347)

* Update runze pump format

* Correct runze multiple backbone

* Update runze_multiple_backbone

* Correct runze pump multiple receive method.

* Correct runze pump multiple receive method.

* 对于PRCXI9320的transfer_group,一对多和多对多

* 移除MQTT,更新launch文档,提供注册表示例文件,更新到0.10.5

* fix import error

* fix dupe upload registry

* refactor ws client

* add server timeout

* Fix: run-column with correct vessel id (#86)

* fix run_column

* Update run_column_protocol.py

(cherry picked from commit e5aa4d940a)

* resource_update use resource_add

* 新增版位推荐功能

* 重新规定了版位推荐的入参

* update registry with nested obj

* fix protocol node log_message, added create_resource return value

* fix protocol node log_message, added create_resource return value

* try fix add protocol

* fix resource_add

* 修复移液站错误的aspirate注册表

* Feature/xprbalance-zhida (#80)

* feat(devices): add Zhida GC/MS pretreatment automation workstation

* feat(devices): add mettler_toledo xpr balance

* balance

* 重新补全zhida注册表

* PRCXI9320 json

* PRCXI9320 json

* PRCXI9320 json

* fix resource download

* remove class for resource

* bump version to 0.10.6

* 更新所有注册表

* 修复protocolnode的兼容性

* 修复protocolnode的兼容性

* Update install md

* Add Defaultlayout

* 更新物料接口

* fix dict to tree/nested-dict converter

* coin_cell_station draft

* refactor: rename "station_resource" to "deck"

* add standardized BIOYOND resources: bottle_carrier, bottle

* refactor and add BIOYOND resources tests

* add BIOYOND deck assignment and pass all tests

* fix: update resource with correct structure; remove deprecated liquid_handler set_group action

* feat: 将新威电池测试系统驱动与配置文件并入 workstation_dev_YB2 (#92)

* feat: 新威电池测试系统驱动与注册文件

* feat: bring neware driver & battery.json into workstation_dev_YB2

* add bioyond studio draft

* bioyond station with communication init and resource sync

* fix bioyond station and registry

* fix: update resource with correct structure; remove deprecated liquid_handler set_group action

* frontend_docs

* create/update resources with POST/PUT for big amount/ small amount data

* create/update resources with POST/PUT for big amount/ small amount data

* refactor: add itemized_carrier instead of carrier consists of ResourceHolder

* create warehouse by factory func

* update bioyond launch json

* add child_size for itemized_carrier

* fix bioyond resource io

* Workstation templates: Resources and its CRUD, and workstation tasks (#95)

* coin_cell_station draft

* refactor: rename "station_resource" to "deck"

* add standardized BIOYOND resources: bottle_carrier, bottle

* refactor and add BIOYOND resources tests

* add BIOYOND deck assignment and pass all tests

* fix: update resource with correct structure; remove deprecated liquid_handler set_group action

* feat: 将新威电池测试系统驱动与配置文件并入 workstation_dev_YB2 (#92)

* feat: 新威电池测试系统驱动与注册文件

* feat: bring neware driver & battery.json into workstation_dev_YB2

* add bioyond studio draft

* bioyond station with communication init and resource sync

* fix bioyond station and registry

* create/update resources with POST/PUT for big amount/ small amount data

* refactor: add itemized_carrier instead of carrier consists of ResourceHolder

* create warehouse by factory func

* update bioyond launch json

* add child_size for itemized_carrier

* fix bioyond resource io

---------

Co-authored-by: h840473807 <47357934+h840473807@users.noreply.github.com>
Co-authored-by: Xie Qiming <97236197+Andy6M@users.noreply.github.com>

* 更新物料接口

* Workstation dev yb2 (#100)

* Refactor and extend reaction station action messages

* Refactor dispensing station tasks to enhance parameter clarity and add batch processing capabilities

- Updated `create_90_10_vial_feeding_task` to include detailed parameters for 90%/10% vial feeding, improving clarity and usability.
- Introduced `create_batch_90_10_vial_feeding_task` for batch processing of 90%/10% vial feeding tasks with JSON formatted input.
- Added `create_batch_diamine_solution_task` for batch preparation of diamine solution, also utilizing JSON formatted input.
- Refined `create_diamine_solution_task` to include additional parameters for better task configuration.
- Enhanced schema descriptions and default values for improved user guidance.

* 修复to_plr_resources

* add update remove

* 支持选择器注册表自动生成
支持转运物料

* 修复资源添加

* 修复transfer_resource_to_another生成

* 更新transfer_resource_to_another参数,支持spot入参

* 新增test_resource动作

* fix host_node error

* fix host_node test_resource error

* fix host_node test_resource error

* 过滤本地动作

* 移动内部action以兼容host node

* 修复同步任务报错不显示的bug

* feat: 允许返回非本节点物料,后面可以通过decoration进行区分,就不进行warning了

* update todo

* modify bioyond/plr converter, bioyond resource registry, and tests

* pass the tests

* update todo

* add conda-pack-build.yml

* add auto install script for conda-pack-build.yml

(cherry picked from commit 172599adcf)

* update conda-pack-build.yml

* update conda-pack-build.yml

* update conda-pack-build.yml

* update conda-pack-build.yml

* update conda-pack-build.yml

* Add version in __init__.py
Update conda-pack-build.yml
Add create_zip_archive.py

* Update conda-pack-build.yml

* Update conda-pack-build.yml (with mamba)

* Update conda-pack-build.yml

* Fix FileNotFoundError

* Try fix 'charmap' codec can't encode characters in position 16-23: character maps to <undefined>

* Fix unilabos msgs search error

* Fix environment_check.py

* Update recipe.yaml

* Update registry. Update uuid loop figure method. Update install docs.

* Fix nested conda pack

* Fix one-key installation path error

* Bump version to 0.10.7

* Workshop bj (#99)

* Add LaiYu Liquid device integration and tests

Introduce LaiYu Liquid device implementation, including backend, controllers, drivers, configuration, and resource files. Add hardware connection, tip pickup, and simplified test scripts, as well as experiment and registry configuration for LaiYu Liquid. Documentation and .gitignore for the device are also included.

* feat(LaiYu_Liquid): 重构设备模块结构并添加硬件文档

refactor: 重新组织LaiYu_Liquid模块目录结构
docs: 添加SOPA移液器和步进电机控制指令文档
fix: 修正设备配置中的最大体积默认值
test: 新增工作台配置测试用例
chore: 删除过时的测试脚本和配置文件

* add

* 重构: 将 LaiYu_Liquid.py 重命名为 laiyu_liquid_main.py 并更新所有导入引用

- 使用 git mv 将 LaiYu_Liquid.py 重命名为 laiyu_liquid_main.py
- 更新所有相关文件中的导入引用
- 保持代码功能不变,仅改善命名一致性
- 测试确认所有导入正常工作

* 修复: 在 core/__init__.py 中添加 LaiYuLiquidBackend 导出

- 添加 LaiYuLiquidBackend 到导入列表
- 添加 LaiYuLiquidBackend 到 __all__ 导出列表
- 确保所有主要类都可以正确导入

* 修复大小写文件夹名字

* 电池装配工站二次开发教程(带目录)上传至dev (#94)

* 电池装配工站二次开发教程

* Update intro.md

* 物料教程

* 更新物料教程,json格式注释

* Update prcxi driver & fix transfer_liquid mix_times (#90)

* Update prcxi driver & fix transfer_liquid mix_times

* fix: correct mix_times type

* Update liquid_handler registry

* test: prcxi.py

* Update registry from pr

* fix ony-key script not exist

* clean files

---------

Co-authored-by: Junhan Chang <changjh@dp.tech>
Co-authored-by: ZiWei <131428629+ZiWei09@users.noreply.github.com>
Co-authored-by: Guangxin Zhang <guangxin.zhang.bio@gmail.com>
Co-authored-by: Xie Qiming <97236197+Andy6M@users.noreply.github.com>
Co-authored-by: h840473807 <47357934+h840473807@users.noreply.github.com>
Co-authored-by: LccLink <1951855008@qq.com>
Co-authored-by: lixinyu1011 <61094742+lixinyu1011@users.noreply.github.com>
Co-authored-by: shiyubo0410 <shiyubo@dp.tech>
2025-10-12 23:34:26 +08:00

10 KiB
Raw Blame History

Uni-Lab 启动指南

安装完毕后,可以通过 unilab 命令行启动:

Start Uni-Lab Edge server.

options:
  -h, --help            show this help message and exit
  -g GRAPH, --graph GRAPH
                        Physical setup graph file path.
  -c CONTROLLERS, --controllers CONTROLLERS
                        Controllers config file path.
  --registry_path REGISTRY_PATH
                        Path to the registry directory
  --working_dir WORKING_DIR
                        Path to the working directory
  --backend {ros,simple,automancer}
                        Choose the backend to run with: 'ros', 'simple', or 'automancer'.
  --app_bridges APP_BRIDGES [APP_BRIDGES ...]
                        Bridges to connect to. Now support 'websocket' and 'fastapi'.
  --is_slave            Run the backend as slave node (without host privileges).
  --slave_no_host       Skip waiting for host service in slave mode
  --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
  --port PORT           Port for web service information page
  --disable_browser     Disable opening information page on startup
  --2d_vis              Enable 2D visualization when starting pylabrobot instance
  --visual {rviz,web,disable}
                        Choose visualization tool: rviz, web, or disable
  --ak AK               Access key for laboratory requests
  --sk SK               Secret key for laboratory requests
  --addr ADDR           Laboratory backend address
  --skip_env_check      Skip environment dependency check on startup
  --complete_registry   Complete registry information

启动流程详解

Uni-Lab 的启动过程分为以下几个阶段:

1. 参数解析阶段

  • 解析命令行参数
  • 处理参数格式转换(支持 dash 和 underscore 格式)

2. 环境检查阶段 (可选)

  • 默认进行环境依赖检查并自动安装必需包
  • 使用 --skip_env_check 可跳过此步骤

3. 配置文件处理阶段

您可以直接跟随 unilabos 的提示进行,无需查阅本节

  • 工作目录设置

    • 如果当前目录以 unilabos_data 结尾,则使用当前目录
    • 否则使用 当前目录/unilabos_data 作为工作目录
    • 可通过 --working_dir 指定自定义工作目录
  • 配置文件查找顺序

    1. 使用 --config 参数指定的配置文件
    2. 在工作目录中查找 local_config.py
    3. 首次使用时会引导创建配置文件

4. 服务器地址配置

支持多种后端环境:

  • --addr test:测试环境 (https://uni-lab.test.bohrium.com/api/v1)
  • --addr uatUAT 环境 (https://uni-lab.uat.bohrium.com/api/v1)
  • --addr local:本地环境 (http://127.0.0.1:48197/api/v1)
  • 自定义地址:直接指定完整 URL

5. 认证配置

  • 必需参数--ak--sk 必须同时提供
  • 命令行参数优先于配置文件中的设置
  • 未提供认证信息会导致启动失败并提示注册实验室

6. 设备图谱加载

支持两种方式:

  • 本地文件:使用 -g 指定图谱文件(支持 JSON 和 GraphML 格式)
  • 远程资源:使用 --use_remote_resource 从云端获取

7. 注册表构建

  • 构建设备和资源注册表
  • 支持自定义注册表路径 (--registry_path)
  • 可选择补全注册表信息 (--complete_registry)

8. 设备验证和注册

  • 验证设备连接和端点配置
  • 自动注册设备到云端服务

9. 通信桥接配置

  • WebSocket:实时通信和任务下发
  • FastAPIHTTP API 服务和物料更新

10. 可视化和服务启动

  • 可选启动可视化工具 (--visual)
  • 启动 Web 信息服务 (默认端口 8002)
  • 启动后端通信服务

使用配置文件

Uni-Lab 支持使用 Python 格式的配置文件进行系统设置。通过 --config 参数指定配置文件路径:

# 使用配置文件启动
unilab --config path/to/your/config.py

配置文件包含实验室和 WebSocket 连接等设置。有关配置文件的详细信息,请参阅配置指南

初始化信息来源

启动 Uni-Lab 时,可以选用两种方式之一配置实验室设备:

1. 组态&拓扑图

使用 -g 时,组态&拓扑图应包含实验室所有信息,详见{ref}graph。目前支持 GraphML 和 node-link JSON 两种格式。格式可参照 tests/experiments 下的启动文件。

2. 分别指定控制逻辑

使用 -c 传入控制逻辑配置。

不管使用哪一种初始化方式,设备/物料字典均需包含 class 属性,用于查找注册表信息。默认查找范围都是 Uni-Lab 内部注册表 unilabos/registry/{devices,device_comms,resources}。要添加额外的注册表路径,可以使用 --registry_path 加入 <your-registry-path>/{devices,device_comms,resources}

通信中间件 --backend

目前 Uni-Lab 支持以下通信中间件:

  • ros (默认):基于 ROS2 的通信
  • simple:简化通信模式
  • automancerAutomancer 兼容模式

端云桥接 --app_bridges

目前 Uni-Lab 提供 WebSocket、FastAPI (http) 两种端云通信方式:

  • WebSocket:负责实时通信和任务下发
  • FastAPI:负责端对云物料更新和 HTTP API

分布式组网

启动 Uni-Lab 时,加入 --is_slave 将作为从站,不加将作为主站:

  • 主站 (host):持有物料修改权以及对云端的通信
  • 从站 (slave):无主机权限,可选择跳过等待主机服务 (--slave_no_host)

局域网内分别启动的 Uni-Lab 主站/从站将自动组网,互相能访问所有设备状态、传感器信息并发送指令。

可视化选项

2D 可视化

使用 --2d_vis 在 PyLabRobot 实例启动时同时启动 2D 可视化。

3D 可视化

通过 --visual 参数选择:

  • rviz:使用 RViz 进行 3D 可视化
  • web:使用 Web 界面进行可视化
  • disable (默认):禁用可视化

实验室管理

首次使用

如果是首次使用,系统会:

  1. 提示前往 https://uni-lab.bohrium.com 注册实验室
  2. 引导创建配置文件
  3. 设置工作目录

认证设置

  • --ak:实验室访问密钥
  • --sk:实验室私钥
  • 两者必须同时提供才能正常启动

完整启动示例

以下是一些常用的启动命令示例:

# 使用组态图启动,上传注册表
unilab --ak your_ak --sk your_sk -g path/to/graph.json --upload_registry

# 使用远程资源启动
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 --is_slave

# 启用可视化
unilab --ak your_ak --sk your_sk --visual web --2d_vis

# 指定本地信息网页服务端口和禁用自动跳出浏览器
unilab --ak your_ak --sk your_sk --port 8080 --disable_browser

常见问题

1. 认证失败

如果提示 "后续运行必须拥有一个实验室",请确保:

2. 配置文件问题

如果配置文件加载失败:

  • 确保配置文件是 .py 格式
  • 检查配置文件语法是否正确
  • 首次使用可让系统自动创建示例配置文件

3. 网络连接问题

如果无法连接到服务器:

  • 检查网络连接
  • 确认服务器地址是否正确
  • 尝试使用不同的环境地址test、uat、local

4. 设备图谱问题

如果设备加载失败:

  • 检查图谱文件格式是否正确
  • 验证设备连接和端点配置
  • 确保注册表路径正确

页面操作

1. 启动成功

当您启动成功后,可以看到物料列表,节点模版和组态图如图展示 material.png

2. 根据需求创建设备和物料

我们可以做一个简单的案例

  • 在容器1中加入水
  • 通过传输泵将容器1中的水转移到容器2中

2.1 添加所需的设备和物料

仪器设备work_station中的workstation 数量x1
仪器设备virtual_device中的virtual_transfer_pump 数量x1
物料耗材container中的container 数量x2

2.2 将设备和物料根据父子关系进行关联

当我们添加设备时,仪器耗材模块的物料列表也会实时更新
我们需要将设备和物料拖拽到workstation中并在画布上将它们连接起来就像真实的设备操作一样
links.png

3. 创建工作流

进入工作流模块 → 点击"我创建的" → 新建工作流 new.png

3.1 新增工作流节点

我们可以进入指定工作流,在空白处右键

  • 选择Laboratory→host_node中的creat_resource
  • 选择Laboratory→workstation中的PumpTransferProtocol

creatworkfollow.gif

3.2 配置节点参数

根据案例,工作流包含两个步骤:

  1. 使用creat_resource在容器中创建水
  2. 通过泵传输协议将水传输到另一个容器

我们点击creat_resource卡片上的编辑按钮来配置参数
class_name container
device_id workstation
liquid_input_slot 0或-1均可
liquid_type : water
liquid_volume 根据需求填写即可默认单位ml这里举例50
parent workstation
res_id containe
关联设备名称(原unilabos_device_id) 这里就填写host_node
配置完成后点击底部保存按钮

我们点击PumpTransferProtocol卡片上的编辑按钮来配置参数
event transfer_liquid
from_vessel water
to_vessel container1
volume 根据需求填写即可默认单位ml这里举例50
关联设备名称(原unilabos_device_id) 这里就填写workstation
配置完成后点击底部保存按钮

3.3 运行工作流

  1. 连接两个节点卡片
  2. 点击底部保存按钮
  3. 点击运行按钮执行工作流

linksandrun.png

运行监控

  • 运行状态和消息实时显示在底部控制台
  • 如有报错,可点击查看详细信息

结果验证

工作流完成后,返回仪器耗材模块:

  • 点击 container1卡片查看详情
  • 确认其中包含参数指定的水和容量