* add biomek.py demo implementation

* 更新LiquidHandlerBiomek类,添加资源创建功能,优化协议创建方法,修复部分代码格式问题,更新YAML配置以支持新功能。

* Test

* fix biomek success type

* Convert LH action to biomek.

* Update biomek.py

* 注册表上报handle和schema (param input)

* 修复biomek缺少的字段

* delete 's'

* Remove warnings

* Update biomek.py

* Biomek test

* Update biomek.py

* 新增transfer_biomek的msg

* New transfer_biomek

* Updated transfer_biomek

* 更新transfer_biomek的msg

* 更新transfer_biomek的msg

* 支持Biomek创建

* new action

* fix key name typo

* New parameter for biomek to run.

* Refine

* Update

* new actions

* new actions

* 1

* registry

* fix biomek startup
add action handles

* fix handles not as default entry

* biomek_test.py

biomek_test.py是最新的版本,运行它会生成complete_biomek_protocol.json

* Update biomek.py

* biomek_test.py

* fix liquid_handler.biomek handles

* host node新增resource add时间统计
create_resource新增handle
bump version to 0.9.2

* 修正物料上传时间
改用biomek_test
增加ResultInfoEncoder
支持返回结果上传

* 正确发送return_info结果

* 同步执行状态信息

* 取消raiseValueError提示

* Update biomek_test.py

* 0608 DONE

* 同步了Biomek.py 现在应可用

* biomek switch back to non-test

* temp disable initialize resource

* 37-biomek-i5i7 (#40)

* add biomek.py demo implementation

* 更新LiquidHandlerBiomek类,添加资源创建功能,优化协议创建方法,修复部分代码格式问题,更新YAML配置以支持新功能。

* Test

* fix biomek success type

* Convert LH action to biomek.

* Update biomek.py

* 注册表上报handle和schema (param input)

* 修复biomek缺少的字段

* delete 's'

* Remove warnings

* Update biomek.py

* Biomek test

* Update biomek.py

* 新增transfer_biomek的msg

* New transfer_biomek

* Updated transfer_biomek

* 更新transfer_biomek的msg

* 更新transfer_biomek的msg

* 支持Biomek创建

* new action

* fix key name typo

* New parameter for biomek to run.

* Refine

* Update

* new actions

* new actions

* 1

* registry

* fix biomek startup
add action handles

* fix handles not as default entry

* biomek_test.py

biomek_test.py是最新的版本,运行它会生成complete_biomek_protocol.json

* Update biomek.py

* biomek_test.py

* fix liquid_handler.biomek handles

* host node新增resource add时间统计
create_resource新增handle
bump version to 0.9.2

* 修正物料上传时间
改用biomek_test
增加ResultInfoEncoder
支持返回结果上传

* 正确发送return_info结果

* 同步执行状态信息

* 取消raiseValueError提示

* Update biomek_test.py

* 0608 DONE

* 同步了Biomek.py 现在应可用

* biomek switch back to non-test

* temp disable initialize resource

* Refine biomek

* Refine copy issue

* Refine

---------

Co-authored-by: Junhan Chang <changjh@pku.edu.cn>
Co-authored-by: Guangxin Zhang <guangxin.zhang.bio@gmail.com>
Co-authored-by: qxw138 <qxw@stu.pku.edu.cn>

* Device visualization (#39)

* Update README and MQTTClient for installation instructions and code improvements

* feat: 支持local_config启动
add: 增加对crt path的说明,为传入config.py的相对路径
move: web component

* add: registry description

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* feat: node_info_update srv
fix: OTDeck cant create

* close #12
feat: slave node registry

* feat: show machine name
fix: host node registry not uploaded

* feat: add hplc registry

* feat: add hplc registry

* fix: hplc status typo

* fix: devices/

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* fix: device.class possible null

* fix: HPLC additions with online service

* fix: slave mode spin not working

* fix: slave mode spin not working

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* feat: 多ProtocolNode 允许子设备ID相同
feat: 上报发现的ActionClient
feat: Host重启动,通过discover机制要求slaveNode重新注册,实现信息及时上报

* feat: 支持env设置config

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* Device visualization (#14)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

---------

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

* fix: missing hostname in devices_names
fix: upload_file for model file

* fix: missing paho-mqtt package
bump version to 0.9.0

* fix startup
add ResourceCreateFromOuter.action

* fix type hint

* update actions

* update actions

* host node add_resource_from_outer
fix cmake list

* pass device config to device class

* add: bind_parent_ids to resource create action
fix: message convert string

* fix: host node should not be re_discovered

* feat: resource tracker support dict

* feat: add more necessary params

* feat: fix boolean null in registry action data

* feat: add outer resource

* 编写mesh添加action

* feat: append resource

* add action

* feat: vis 2d for plr

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

* Device visualization (#22)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* 编写mesh添加action

* add action

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

---------

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

* fix: multi channel

* fix: aspirate

* fix: aspirate

* fix: aspirate

* fix: aspirate

* 提交

* fix: jobadd

* fix: jobadd

* fix: msg converter

* tijiao

* add resource creat easy action

* identify debug msg

* mq client id

* 提取lh的joint发布

* unify liquid_handler definition

* 修改物料跟随与物料添加逻辑

修改物料跟随与物料添加逻辑
将joint_publisher类移出lh的backends,但仍需要对lh的backends进行一些改写

* Revert "修改物料跟随与物料添加逻辑"

This reverts commit 498c997ad7.

* Reapply "修改物料跟随与物料添加逻辑"

This reverts commit 3a60d2ae81.

* Revert "Merge remote-tracking branch 'upstream/dev' into device_visualization"

This reverts commit fa727220af, reversing
changes made to 498c997ad7.

* 修改物料放下时的方法,如果选择

修改物料放下时的方法,
如果选择drop_trash,则删除物料显示
如果选择drop,则让其解除连接

* add biomek.py demo implementation

* 更新LiquidHandlerBiomek类,添加资源创建功能,优化协议创建方法,修复部分代码格式问题,更新YAML配置以支持新功能。

* Test

* fix biomek success type

* Convert LH action to biomek.

* Update biomek.py

* 注册表上报handle和schema (param input)

* 修复biomek缺少的字段

* delete 's'

* Remove warnings

* Update biomek.py

* Biomek test

* Update biomek.py

* 新增transfer_biomek的msg

* New transfer_biomek

* Updated transfer_biomek

* 更新transfer_biomek的msg

* 更新transfer_biomek的msg

* 支持Biomek创建

* new action

* fix key name typo

* New parameter for biomek to run.

* Refine

* Update

* new actions

* new actions

* 1

* registry

* fix biomek startup
add action handles

* fix handles not as default entry

* unilab添加moveit启动

1,整合所有moveit节点到一个move_group中,并整合所有的controller依次激活
2,添加pymoveit2的节点,使用json可直接启动
3,修改机械臂规划方式,添加约束,让冗余关节不会进行过多移动

* biomek_test.py

biomek_test.py是最新的版本,运行它会生成complete_biomek_protocol.json

* Update biomek.py

* biomek_test.py

* fix liquid_handler.biomek handles

* 修改物体attach时,多次赋值当前时间导致卡顿问题,

* Revert "修改物体attach时,多次赋值当前时间导致卡顿问题,"

This reverts commit 56d45b94f5.

* Reapply "修改物体attach时,多次赋值当前时间导致卡顿问题,"

This reverts commit 07d9db20c3.

* 添加缺少物料:"plate_well_G12",

* host node新增resource add时间统计
create_resource新增handle
bump version to 0.9.2

* 修正物料上传时间
改用biomek_test
增加ResultInfoEncoder
支持返回结果上传

* 正确发送return_info结果

* 同步执行状态信息

* 取消raiseValueError提示

* Update biomek_test.py

* 0608 DONE

* 同步了Biomek.py 现在应可用

* biomek switch back to non-test

* temp disable initialize resource

* add

* fix tip resource data

* liquid states

* change to debug level

* Revert "change to debug level"

This reverts commit 5d9953c3e5.

* Reapply "change to debug level"

This reverts commit 2487bb6ffc.

* fix tip resource data

* add full device

* add moveit yaml

* 修复moveit
增加post_init阶段,给予ros_node反向

* remove necessary node

* fix moveit action client

* remove necessary imports

* Update moveit_interface.py

* fix handler_key uppercase

* json add liquids

* fix setup

* add

* change to "sources" and "targets" for lh

* bump version

* remove parent's parent link

---------

Co-authored-by: Harvey Que <Q-Query@outlook.com>
Co-authored-by: wznln <18435084+Xuwznln@users.noreply.github.com>
Co-authored-by: zhangshixiang <@zhangshixiang>
Co-authored-by: Junhan Chang <changjh@pku.edu.cn>
Co-authored-by: Guangxin Zhang <guangxin.zhang.bio@gmail.com>
Co-authored-by: qxw138 <qxw@stu.pku.edu.cn>

* Device visualization (#41)

* Update README and MQTTClient for installation instructions and code improvements

* feat: 支持local_config启动
add: 增加对crt path的说明,为传入config.py的相对路径
move: web component

* add: registry description

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* feat: node_info_update srv
fix: OTDeck cant create

* close #12
feat: slave node registry

* feat: show machine name
fix: host node registry not uploaded

* feat: add hplc registry

* feat: add hplc registry

* fix: hplc status typo

* fix: devices/

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* fix: device.class possible null

* fix: HPLC additions with online service

* fix: slave mode spin not working

* fix: slave mode spin not working

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* feat: 多ProtocolNode 允许子设备ID相同
feat: 上报发现的ActionClient
feat: Host重启动,通过discover机制要求slaveNode重新注册,实现信息及时上报

* feat: 支持env设置config

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* Device visualization (#14)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

---------

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

* fix: missing hostname in devices_names
fix: upload_file for model file

* fix: missing paho-mqtt package
bump version to 0.9.0

* fix startup
add ResourceCreateFromOuter.action

* fix type hint

* update actions

* update actions

* host node add_resource_from_outer
fix cmake list

* pass device config to device class

* add: bind_parent_ids to resource create action
fix: message convert string

* fix: host node should not be re_discovered

* feat: resource tracker support dict

* feat: add more necessary params

* feat: fix boolean null in registry action data

* feat: add outer resource

* 编写mesh添加action

* feat: append resource

* add action

* feat: vis 2d for plr

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

* Device visualization (#22)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* 编写mesh添加action

* add action

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

---------

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

* fix: multi channel

* fix: aspirate

* fix: aspirate

* fix: aspirate

* fix: aspirate

* 提交

* fix: jobadd

* fix: jobadd

* fix: msg converter

* tijiao

* add resource creat easy action

* identify debug msg

* mq client id

* 提取lh的joint发布

* unify liquid_handler definition

* 修改物料跟随与物料添加逻辑

修改物料跟随与物料添加逻辑
将joint_publisher类移出lh的backends,但仍需要对lh的backends进行一些改写

* Revert "修改物料跟随与物料添加逻辑"

This reverts commit 498c997ad7.

* Reapply "修改物料跟随与物料添加逻辑"

This reverts commit 3a60d2ae81.

* Revert "Merge remote-tracking branch 'upstream/dev' into device_visualization"

This reverts commit fa727220af, reversing
changes made to 498c997ad7.

* 修改物料放下时的方法,如果选择

修改物料放下时的方法,
如果选择drop_trash,则删除物料显示
如果选择drop,则让其解除连接

* add biomek.py demo implementation

* 更新LiquidHandlerBiomek类,添加资源创建功能,优化协议创建方法,修复部分代码格式问题,更新YAML配置以支持新功能。

* Test

* fix biomek success type

* Convert LH action to biomek.

* Update biomek.py

* 注册表上报handle和schema (param input)

* 修复biomek缺少的字段

* delete 's'

* Remove warnings

* Update biomek.py

* Biomek test

* Update biomek.py

* 新增transfer_biomek的msg

* New transfer_biomek

* Updated transfer_biomek

* 更新transfer_biomek的msg

* 更新transfer_biomek的msg

* 支持Biomek创建

* new action

* fix key name typo

* New parameter for biomek to run.

* Refine

* Update

* new actions

* new actions

* 1

* registry

* fix biomek startup
add action handles

* fix handles not as default entry

* unilab添加moveit启动

1,整合所有moveit节点到一个move_group中,并整合所有的controller依次激活
2,添加pymoveit2的节点,使用json可直接启动
3,修改机械臂规划方式,添加约束,让冗余关节不会进行过多移动

* biomek_test.py

biomek_test.py是最新的版本,运行它会生成complete_biomek_protocol.json

* Update biomek.py

* biomek_test.py

* fix liquid_handler.biomek handles

* 修改物体attach时,多次赋值当前时间导致卡顿问题,

* Revert "修改物体attach时,多次赋值当前时间导致卡顿问题,"

This reverts commit 56d45b94f5.

* Reapply "修改物体attach时,多次赋值当前时间导致卡顿问题,"

This reverts commit 07d9db20c3.

* 添加缺少物料:"plate_well_G12",

* host node新增resource add时间统计
create_resource新增handle
bump version to 0.9.2

* 修正物料上传时间
改用biomek_test
增加ResultInfoEncoder
支持返回结果上传

* 正确发送return_info结果

* 同步执行状态信息

* 取消raiseValueError提示

* Update biomek_test.py

* 0608 DONE

* 同步了Biomek.py 现在应可用

* biomek switch back to non-test

* temp disable initialize resource

* add

* fix tip resource data

* liquid states

* change to debug level

* Revert "change to debug level"

This reverts commit 5d9953c3e5.

* Reapply "change to debug level"

This reverts commit 2487bb6ffc.

* fix tip resource data

* add full device

* add moveit yaml

* 修复moveit
增加post_init阶段,给予ros_node反向

* remove necessary node

* fix moveit action client

* remove necessary imports

* Update moveit_interface.py

* fix handler_key uppercase

* json add liquids

* fix setup

* add

* change to "sources" and "targets" for lh

* bump version

* remove parent's parent link

* change arm's name

* change name

---------

Co-authored-by: Harvey Que <Q-Query@outlook.com>
Co-authored-by: zhangshixiang <@zhangshixiang>
Co-authored-by: q434343 <73513873+q434343@users.noreply.github.com>
Co-authored-by: Junhan Chang <changjh@pku.edu.cn>
Co-authored-by: Guangxin Zhang <guangxin.zhang.bio@gmail.com>
Co-authored-by: qxw138 <qxw@stu.pku.edu.cn>

* fix move it

* fix move it

* create_resource

* bump ver
modify slot type

* 增加modbus支持
调整protocol node以更好支持多种类型的read和write

* 调整protocol node以更好支持多种类型的read和write

* 补充日志

* Device visualization (#42)

* Update README and MQTTClient for installation instructions and code improvements

* feat: 支持local_config启动
add: 增加对crt path的说明,为传入config.py的相对路径
move: web component

* add: registry description

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* feat: node_info_update srv
fix: OTDeck cant create

* close #12
feat: slave node registry

* feat: show machine name
fix: host node registry not uploaded

* feat: add hplc registry

* feat: add hplc registry

* fix: hplc status typo

* fix: devices/

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* fix: device.class possible null

* fix: HPLC additions with online service

* fix: slave mode spin not working

* fix: slave mode spin not working

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* feat: 多ProtocolNode 允许子设备ID相同
feat: 上报发现的ActionClient
feat: Host重启动,通过discover机制要求slaveNode重新注册,实现信息及时上报

* feat: 支持env设置config

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* Device visualization (#14)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

---------

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

* fix: missing hostname in devices_names
fix: upload_file for model file

* fix: missing paho-mqtt package
bump version to 0.9.0

* fix startup
add ResourceCreateFromOuter.action

* fix type hint

* update actions

* update actions

* host node add_resource_from_outer
fix cmake list

* pass device config to device class

* add: bind_parent_ids to resource create action
fix: message convert string

* fix: host node should not be re_discovered

* feat: resource tracker support dict

* feat: add more necessary params

* feat: fix boolean null in registry action data

* feat: add outer resource

* 编写mesh添加action

* feat: append resource

* add action

* feat: vis 2d for plr

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

* Device visualization (#22)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* 编写mesh添加action

* add action

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

---------

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

* fix: multi channel

* fix: aspirate

* fix: aspirate

* fix: aspirate

* fix: aspirate

* 提交

* fix: jobadd

* fix: jobadd

* fix: msg converter

* tijiao

* add resource creat easy action

* identify debug msg

* mq client id

* 提取lh的joint发布

* unify liquid_handler definition

* 修改物料跟随与物料添加逻辑

修改物料跟随与物料添加逻辑
将joint_publisher类移出lh的backends,但仍需要对lh的backends进行一些改写

* Revert "修改物料跟随与物料添加逻辑"

This reverts commit 498c997ad7.

* Reapply "修改物料跟随与物料添加逻辑"

This reverts commit 3a60d2ae81.

* Revert "Merge remote-tracking branch 'upstream/dev' into device_visualization"

This reverts commit fa727220af, reversing
changes made to 498c997ad7.

* 修改物料放下时的方法,如果选择

修改物料放下时的方法,
如果选择drop_trash,则删除物料显示
如果选择drop,则让其解除连接

* unilab添加moveit启动

1,整合所有moveit节点到一个move_group中,并整合所有的controller依次激活
2,添加pymoveit2的节点,使用json可直接启动
3,修改机械臂规划方式,添加约束,让冗余关节不会进行过多移动

* 修改物体attach时,多次赋值当前时间导致卡顿问题,

* Revert "修改物体attach时,多次赋值当前时间导致卡顿问题,"

This reverts commit 56d45b94f5.

* Reapply "修改物体attach时,多次赋值当前时间导致卡顿问题,"

This reverts commit 07d9db20c3.

* 添加缺少物料:"plate_well_G12",

* add

* fix tip resource data

* liquid states

* change to debug level

* Revert "change to debug level"

This reverts commit 5d9953c3e5.

* Reapply "change to debug level"

This reverts commit 2487bb6ffc.

* fix tip resource data

* add full device

* add moveit yaml

* 修复moveit
增加post_init阶段,给予ros_node反向

* remove necessary node

* fix moveit action client

* remove necessary imports

* Update moveit_interface.py

* fix handler_key uppercase

* json add liquids

* fix setup

* add

* change to "sources" and "targets" for lh

* bump version

* remove parent's parent link

* change arm's name

* change name

* fix ik error

---------

Co-authored-by: Harvey Que <Q-Query@outlook.com>
Co-authored-by: zhangshixiang <@zhangshixiang>
Co-authored-by: q434343 <73513873+q434343@users.noreply.github.com>
Co-authored-by: Junhan Chang <changjh@pku.edu.cn>

* Add Mock Device for Organic Synthesis\添加有机合成的虚拟仪器和Protocol (#43)

* Add Device MockChiller

Add device MockChiller

* Add Device MockFilter

* Add Device MockPump

* Add Device MockRotavap

* Add Device MockSeparator

* Add Device MockStirrer

* Add Device MockHeater

* Add Device MockVacuum

* Add Device MockSolenoidValve

* Add Device Mock \_init_.py

* 规范模拟设备代码与注册表信息

* 更改Mock大写文件夹名

* 删除大写目录

* Edited Mock device json

* Match mock device with action

* Edit mock device yaml

* Add new action

* Add Virtual Device, Action, YAML, Protocol for Organic Syn

* 单独分类测试的protocol文件夹

* 更名Action

---------

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

* bump version & protocol fix

* hotfix: Add macos_sdk_config (#46)

Co-authored-by: quehh <scienceol@outlook.com>

* include device_mesh when pip install

* 测试自动构建

* try build fix

* try build

* test artifacts

* hotfix: Add .certs in .gitignore

* create container

* container 添加和更新完成

* Device registry port (#49)

* Update README and MQTTClient for installation instructions and code improvements

* feat: 支持local_config启动
add: 增加对crt path的说明,为传入config.py的相对路径
move: web component

* add: registry description

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* feat: node_info_update srv
fix: OTDeck cant create

* close #12
feat: slave node registry

* feat: show machine name
fix: host node registry not uploaded

* feat: add hplc registry

* feat: add hplc registry

* fix: hplc status typo

* fix: devices/

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* fix: device.class possible null

* fix: HPLC additions with online service

* fix: slave mode spin not working

* fix: slave mode spin not working

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* feat: 多ProtocolNode 允许子设备ID相同
feat: 上报发现的ActionClient
feat: Host重启动,通过discover机制要求slaveNode重新注册,实现信息及时上报

* feat: 支持env设置config

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* Device visualization (#14)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

---------

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

* fix: missing hostname in devices_names
fix: upload_file for model file

* fix: missing paho-mqtt package
bump version to 0.9.0

* fix startup
add ResourceCreateFromOuter.action

* fix type hint

* update actions

* update actions

* host node add_resource_from_outer
fix cmake list

* pass device config to device class

* add: bind_parent_ids to resource create action
fix: message convert string

* fix: host node should not be re_discovered

* feat: resource tracker support dict

* feat: add more necessary params

* feat: fix boolean null in registry action data

* feat: add outer resource

* 编写mesh添加action

* feat: append resource

* add action

* feat: vis 2d for plr

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

* Device visualization (#22)

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* add 3d visualization

* 完成在main中启动设备可视化

完成在main中启动设备可视化,并输出物料ID:mesh的对应关系resource_model

添加物料模型管理类,遍历物料与resource_model,完成TF数据收集

* 完成TF发布

* 修改模型方向,在yaml中添加变换属性

* 添加物料tf变化时,发送topic到前端

另外修改了物料初始化的方法,防止在tf还未发布时提前建立物料模型与发布话题

* 添加关节发布节点与物料可视化节点进入unilab

* 使用json启动plr与3D模型仿真

* 完成启动OT并联动rviz

* 修复rviz位置问题,

修复rviz位置问题,
在无tf变动时减缓发送频率
在backend中添加物料跟随方法

* fix: running logic

* fix: running logic

* fix: missing ot

* 在main中直接初始化republisher和物料的mesh节点

* 将joint_republisher和resource_mesh_manager添加进 main_slave_run.py中

* 编写mesh添加action

* add action

* fix

* fix: browser on rviz

* fix: cloud bridge error fallback to local

* fix: salve auto run rviz

* 初始化两个plate

---------

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

* fix: multi channel

* fix: aspirate

* fix: aspirate

* fix: aspirate

* fix: aspirate

* 提交

* fix: jobadd

* fix: jobadd

* fix: msg converter

* tijiao

* add resource creat easy action

* identify debug msg

* mq client id

* unify liquid_handler definition

* Update virtual_device.yaml

* 更正了stir和heater的连接方式

* 区分了虚拟仪器中的八通阀和电磁阀,添加了两个阀门的驱动

* 修改了add protocol

* 修复了阀门更新版的bug

* 修复了添加protocol前缀导致的不能启动的bug

* Fix handles

* bump version to 0.9.6

* add resource edge upload

* update container registry and handles

* add virtual_separator virtual_rotavap
fix transfer_pump

* fix container value
add parent_name to edge device id

* 大图的问题都修复好了,添加了gassource和vacuum pump的驱动以及注册表

* default resource upload mode is false

* 添加了icon的文件名在注册表里面

* 修改了json图中link的格式

* fix resource and edge upload

* fix device ports

* Fix edge id

* 移除device的父节点关联

* separate registry sync and resource_add

* 默认不进行注册表报送,通过命令unilabos-register或者增加启动参数

* 完善tip

* protocol node不再嵌套显示

* bump version to 0.9.7  新增一个测试PumpTransferProtocol的teststation,亲测可以运行,将八通阀们和转移泵与pump_protocol适配

* protocol node 执行action不应携带自身device id

* 添加了一套简易双八通阀工作站JSON,亲测能跑

* 修复了很多protocol,亲测能跑

* 添加了run column和filter through的protocol,亲测能跑

* fix mock_reactor

* 修改了大图和小图的json,但是在前端上没看到改变

---------

Co-authored-by: Harvey Que <Q-Query@outlook.com>
Co-authored-by: wznln <18435084+Xuwznln@users.noreply.github.com>
Co-authored-by: zhangshixiang <@zhangshixiang>
Co-authored-by: q434343 <73513873+q434343@users.noreply.github.com>
Co-authored-by: Junhan Chang <changjh@pku.edu.cn>

* 更新workstation注册表

* 添加了两个protocol的检索功能 (#51)

* 添加了两个protocol的检索liquid type功能

* fix workstation registry

* 修复了没连接的几个仪器的link,添加了container的icon

* 修改了json和注册表,现在大图全部的device都链接上了

* 修复了小图的json图,线全部连上了

* add work_station protocol handles (ports)

* fix workstation action handle

---------

Co-authored-by: Xuwznln <18435084+Xuwznln@users.noreply.github.com>
Co-authored-by: Junhan Chang <changjh@dp.tech>

---------

Co-authored-by: Junhan Chang <changjh@pku.edu.cn>
Co-authored-by: Guangxin Zhang <guangxin.zhang.bio@gmail.com>
Co-authored-by: qxw138 <qxw@stu.pku.edu.cn>
Co-authored-by: q434343 <73513873+q434343@users.noreply.github.com>
Co-authored-by: Harvey Que <Q-Query@outlook.com>
Co-authored-by: Kongchang Feng <2100011801@stu.pku.edu.cn>
Co-authored-by: hh. <103566763+Mile-Away@users.noreply.github.com>
Co-authored-by: quehh <scienceol@outlook.com>
Co-authored-by: Harvey Que <quehaohui@dp.tech>
Co-authored-by: Junhan Chang <changjh@dp.tech>
This commit is contained in:
Xuwznln
2025-06-22 18:33:08 +08:00
committed by GitHub
parent efc0a9fbbc
commit 4139e079f4
8 changed files with 1203 additions and 116 deletions

View File

@@ -301,9 +301,9 @@
}
}
],
"links": [
"links": [
{
"id": "link_pump1_valve1",
"id": "link_pump1_to_valve1",
"source": "transfer_pump_1",
"target": "multiway_valve_1",
"type": "fluid",
@@ -313,7 +313,7 @@
}
},
{
"id": "link_pump2_valve2",
"id": "link_pump2_to_valve2",
"source": "transfer_pump_2",
"target": "multiway_valve_2",
"type": "fluid",
@@ -323,17 +323,7 @@
}
},
{
"id": "link_valve1_air",
"source": "multiway_valve_1",
"target": "flask_air",
"type": "fluid",
"port": {
"multiway_valve_1": "6",
"flask_air": "top"
}
},
{
"id": "link_valve1_water",
"id": "link_valve1_to_water",
"source": "multiway_valve_1",
"target": "flask_water",
"type": "fluid",
@@ -343,7 +333,7 @@
}
},
{
"id": "link_valve1_acetone",
"id": "link_valve1_to_acetone",
"source": "multiway_valve_1",
"target": "flask_acetone",
"type": "fluid",
@@ -353,7 +343,7 @@
}
},
{
"id": "link_valve1_ethanol",
"id": "link_valve1_to_ethanol",
"source": "multiway_valve_1",
"target": "flask_ethanol",
"type": "fluid",
@@ -363,17 +353,27 @@
}
},
{
"id": "link_valve1_valve2",
"id": "link_valve1_to_air",
"source": "multiway_valve_1",
"target": "flask_air",
"type": "fluid",
"port": {
"multiway_valve_1": "6",
"flask_air": "top"
}
},
{
"id": "link_valve1_to_valve2_for_cleaning",
"source": "multiway_valve_1",
"target": "multiway_valve_2",
"type": "fluid",
"port": {
"multiway_valve_1": "5",
"multiway_valve_2": "1"
"multiway_valve_1": "1",
"multiway_valve_2": "8"
}
},
{
"id": "link_valve2_main_reactor",
"id": "link_valve2_to_main_reactor_in",
"source": "multiway_valve_2",
"target": "main_reactor",
"type": "fluid",
@@ -383,7 +383,7 @@
}
},
{
"id": "link_valve2_secondary_reactor",
"id": "link_valve2_to_secondary_reactor_in",
"source": "multiway_valve_2",
"target": "secondary_reactor",
"type": "fluid",
@@ -393,7 +393,27 @@
}
},
{
"id": "link_valve2_waste",
"id": "link_main_reactor_out_to_valve2",
"source": "main_reactor",
"target": "multiway_valve_2",
"type": "fluid",
"port": {
"main_reactor": "bottom",
"multiway_valve_2": "6"
}
},
{
"id": "link_secondary_reactor_out_to_valve2",
"source": "secondary_reactor",
"target": "multiway_valve_2",
"type": "fluid",
"port": {
"secondary_reactor": "bottom",
"multiway_valve_2": "7"
}
},
{
"id": "link_valve2_to_waste",
"source": "multiway_valve_2",
"target": "waste_workup",
"type": "fluid",
@@ -403,17 +423,7 @@
}
},
{
"id": "link_valve2_air_return",
"source": "multiway_valve_2",
"target": "flask_air",
"type": "fluid",
"port": {
"multiway_valve_2": "5",
"flask_air": "top"
}
},
{
"id": "link_heatchill1_main_reactor",
"id": "link_heatchill1_to_main_reactor",
"source": "heatchill_1",
"target": "main_reactor",
"type": "mechanical",
@@ -421,6 +431,16 @@
"heatchill_1": "heatchill",
"main_reactor": "bind"
}
},
{
"id": "link_heatchill1_to_secondary_reactor",
"source": "heatchill_1",
"target": "secondary_reactor",
"type": "mechanical",
"port": {
"heatchill_1": "heatchill",
"secondary_reactor": "bind"
}
}
]
}

View File

@@ -1,8 +1,8 @@
{
"nodes": [
{
"id": "ComprehensiveProtocolStation",
"name": "综合协议测试工作站",
"id": "OrganicSynthesisStation",
"name": "有机化学流程综合测试工作站",
"children": [
"multiway_valve_1",
"multiway_valve_2",
@@ -69,7 +69,7 @@
"id": "multiway_valve_1",
"name": "八通阀门1",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_multiway_valve",
"position": {
@@ -89,7 +89,7 @@
"id": "multiway_valve_2",
"name": "八通阀门2",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_multiway_valve",
"position": {
@@ -109,7 +109,7 @@
"id": "transfer_pump_1",
"name": "转移泵1",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_transfer_pump",
"position": {
@@ -130,7 +130,7 @@
"id": "transfer_pump_2",
"name": "转移泵2",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_transfer_pump",
"position": {
@@ -151,7 +151,7 @@
"id": "reagent_bottle_1",
"name": "试剂瓶1-DMF",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -172,7 +172,7 @@
"id": "reagent_bottle_2",
"name": "试剂瓶2-乙酸乙酯",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -193,7 +193,7 @@
"id": "reagent_bottle_3",
"name": "试剂瓶3-己烷",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -214,7 +214,7 @@
"id": "reagent_bottle_4",
"name": "试剂瓶4-甲醇",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -235,7 +235,7 @@
"id": "reagent_bottle_5",
"name": "试剂瓶5-水",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -256,7 +256,7 @@
"id": "centrifuge_1",
"name": "离心机",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_centrifuge",
"position": {
@@ -278,7 +278,7 @@
"id": "rotavap_1",
"name": "旋转蒸发仪",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_rotavap",
"position": {
@@ -300,7 +300,7 @@
"id": "main_reactor",
"name": "主反应器",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -324,7 +324,7 @@
"id": "heater_1",
"name": "加热器",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_heatchill",
"position": {
@@ -345,7 +345,7 @@
"id": "stirrer_1",
"name": "搅拌器1",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_stirrer",
"position": {
@@ -365,7 +365,7 @@
"id": "stirrer_2",
"name": "搅拌器2",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_stirrer",
"position": {
@@ -385,7 +385,7 @@
"id": "waste_bottle_1",
"name": "废液瓶1",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -404,7 +404,7 @@
"id": "waste_bottle_2",
"name": "废液瓶2",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -423,7 +423,7 @@
"id": "solenoid_valve_1",
"name": "电磁阀1",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_solenoid_valve",
"position": {
@@ -444,7 +444,7 @@
"id": "solenoid_valve_2",
"name": "电磁阀2",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_solenoid_valve",
"position": {
@@ -465,7 +465,7 @@
"id": "vacuum_pump_1",
"name": "真空泵",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_vacuum_pump",
"position": {
@@ -486,7 +486,7 @@
"id": "gas_source_1",
"name": "气源",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_gas_source",
"position": {
@@ -504,7 +504,7 @@
"id": "filter_1",
"name": "过滤器",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_filter",
"position": {
@@ -525,7 +525,7 @@
"id": "column_1",
"name": "洗脱柱",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_column",
"position": {
@@ -547,7 +547,7 @@
"id": "separator_1",
"name": "分液器",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "device",
"class": "virtual_separator",
"position": {
@@ -568,7 +568,7 @@
"id": "collection_bottle_1",
"name": "接收瓶1",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -587,7 +587,7 @@
"id": "collection_bottle_2",
"name": "接收瓶2",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -606,7 +606,7 @@
"id": "collection_bottle_3",
"name": "接收瓶3",
"children": [],
"parent": "ComprehensiveProtocolStation",
"parent": "OrganicSynthesisStation",
"type": "container",
"class": "container",
"position": {
@@ -852,6 +852,46 @@
"heater_1": "heatchill",
"main_reactor": "bind"
}
},
{
"id": "link_separator_waste2",
"source": "separator_1",
"target": "waste_bottle_2",
"type": "fluid",
"port": {
"separator_1": "top_phase_out",
"waste_bottle_2": "top"
}
},
{
"id": "mech_stirrer2_separator",
"source": "stirrer_2",
"target": "separator_1",
"type": "mechanical",
"port": {
"stirrer_2": "stirrer",
"separator_1": "bind"
}
},
{
"id": "link_filter_filtrate_to_collection1",
"source": "filter_1",
"target": "collection_bottle_1",
"type": "transport",
"port": {
"filter_1": "filtrate_out",
"collection_bottle_1": "top"
}
},
{
"id": "link_filter_retentate_to_waste1",
"source": "filter_1",
"target": "waste_bottle_1",
"type": "transport",
"port": {
"filter_1": "retentate_out",
"waste_bottle_1": "top"
}
}
]
}

View File

@@ -25,26 +25,25 @@ from .wash_solid_protocol import generate_wash_solid_protocol
# Define a dictionary of protocol generators.
action_protocol_generators = {
PumpTransferProtocol: generate_pump_protocol_with_rinsing,
CleanProtocol: generate_clean_protocol,
SeparateProtocol: generate_separate_protocol,
EvaporateProtocol: generate_evaporate_protocol,
EvacuateAndRefillProtocol: generate_evacuateandrefill_protocol,
AddProtocol: generate_add_protocol,
AGVTransferProtocol: generate_agv_transfer_protocol,
CentrifugeProtocol: generate_centrifuge_protocol,
AddProtocol: generate_add_protocol,
CleanProtocol: generate_clean_protocol,
CleanVesselProtocol: generate_clean_vessel_protocol,
DissolveProtocol: generate_dissolve_protocol,
EvacuateAndRefillProtocol: generate_evacuateandrefill_protocol,
EvaporateProtocol: generate_evaporate_protocol,
FilterProtocol: generate_filter_protocol,
FilterThroughProtocol: generate_filter_through_protocol,
HeatChillProtocol: generate_heat_chill_protocol,
HeatChillStartProtocol: generate_heat_chill_start_protocol,
HeatChillStopProtocol: generate_heat_chill_stop_protocol,
# HeatChillToTempProtocol: generate_heat_chill_to_temp_protocol, # **移除这行**
StirProtocol: generate_stir_protocol,
PumpTransferProtocol: generate_pump_protocol_with_rinsing,
RunColumnProtocol: generate_run_column_protocol,
SeparateProtocol: generate_separate_protocol,
StartStirProtocol: generate_start_stir_protocol,
StirProtocol: generate_stir_protocol,
StopStirProtocol: generate_stop_stir_protocol,
TransferProtocol: generate_transfer_protocol,
CleanVesselProtocol: generate_clean_vessel_protocol,
DissolveProtocol: generate_dissolve_protocol,
FilterThroughProtocol: generate_filter_through_protocol,
RunColumnProtocol: generate_run_column_protocol,
WashSolidProtocol: generate_wash_solid_protocol,
}
}

View File

@@ -5,7 +5,10 @@ from .pump_protocol import generate_pump_protocol_with_rinsing
def find_reagent_vessel(G: nx.DiGraph, reagent: str) -> str:
"""
根据试剂名称查找对应的试剂瓶
根据试剂名称查找对应的试剂瓶,支持多种匹配模式:
1. 容器名称匹配(如 flask_DMF, reagent_bottle_1-DMF
2. 容器内液体类型匹配(如 liquid_type: "DMF", name: "ethanol"
3. 试剂名称匹配(如 reagent_name: "DMF", config.reagent: "ethyl_acetate"
Args:
G: 网络图
@@ -17,23 +20,184 @@ def find_reagent_vessel(G: nx.DiGraph, reagent: str) -> str:
Raises:
ValueError: 如果找不到对应的试剂瓶
"""
# 按照pump_protocol的命名规则查找试剂瓶
reagent_vessel_id = f"flask_{reagent}"
print(f"ADD_PROTOCOL: 正在查找试剂 '{reagent}' 的容器...")
if reagent_vessel_id in G.nodes():
return reagent_vessel_id
# 第一步:通过容器名称匹配
possible_names = [
f"flask_{reagent}", # flask_DMF, flask_ethanol
f"bottle_{reagent}", # bottle_DMF, bottle_ethanol
f"vessel_{reagent}", # vessel_DMF, vessel_ethanol
f"{reagent}_flask", # DMF_flask, ethanol_flask
f"{reagent}_bottle", # DMF_bottle, ethanol_bottle
f"{reagent}", # 直接用试剂名
f"reagent_{reagent}", # reagent_DMF, reagent_ethanol
f"reagent_bottle_{reagent}", # reagent_bottle_DMF
]
# 如果直接匹配失败,尝试模糊匹配
for node in G.nodes():
if node.startswith('flask_') and reagent.lower() in node.lower():
return node
# 尝试名称匹配
for vessel_name in possible_names:
if vessel_name in G.nodes():
print(f"ADD_PROTOCOL: 通过名称匹配找到容器: {vessel_name}")
return vessel_name
# 如果还是找不到,列出所有可用的试剂瓶
available_flasks = [node for node in G.nodes()
if node.startswith('flask_')
and G.nodes[node].get('type') == 'container']
# 第二步:通过模糊名称匹配(名称中包含试剂名)
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
# 检查节点ID或名称中是否包含试剂名
node_name = G.nodes[node_id].get('name', '').lower()
if (reagent.lower() in node_id.lower() or
reagent.lower() in node_name):
print(f"ADD_PROTOCOL: 通过模糊名称匹配找到容器: {node_id} (名称: {node_name})")
return node_id
raise ValueError(f"找不到试剂 '{reagent}' 对应的试剂瓶。可用试剂瓶: {available_flasks}")
# 第三步:通过液体类型匹配
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
vessel_data = G.nodes[node_id].get('data', {})
liquids = vessel_data.get('liquid', [])
for liquid in liquids:
if isinstance(liquid, dict):
# 支持两种格式的液体类型字段
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
reagent_name = vessel_data.get('reagent_name', '')
config_reagent = G.nodes[node_id].get('config', {}).get('reagent', '')
# 检查多个可能的字段
if (liquid_type.lower() == reagent.lower() or
reagent_name.lower() == reagent.lower() or
config_reagent.lower() == reagent.lower()):
print(f"ADD_PROTOCOL: 通过液体类型匹配找到容器: {node_id}")
print(f" - liquid_type: {liquid_type}")
print(f" - reagent_name: {reagent_name}")
print(f" - config.reagent: {config_reagent}")
return node_id
# 第四步:列出所有可用的容器信息帮助调试
available_containers = []
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
vessel_data = G.nodes[node_id].get('data', {})
config_data = G.nodes[node_id].get('config', {})
liquids = vessel_data.get('liquid', [])
container_info = {
'id': node_id,
'name': G.nodes[node_id].get('name', ''),
'liquid_types': [],
'reagent_name': vessel_data.get('reagent_name', ''),
'config_reagent': config_data.get('reagent', '')
}
for liquid in liquids:
if isinstance(liquid, dict):
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
if liquid_type:
container_info['liquid_types'].append(liquid_type)
available_containers.append(container_info)
print(f"ADD_PROTOCOL: 可用容器列表:")
for container in available_containers:
print(f" - {container['id']}: {container['name']}")
print(f" 液体类型: {container['liquid_types']}")
print(f" 试剂名称: {container['reagent_name']}")
print(f" 配置试剂: {container['config_reagent']}")
raise ValueError(f"找不到试剂 '{reagent}' 对应的试剂瓶。尝试了名称匹配: {possible_names}")
def find_reagent_vessel_by_any_match(G: nx.DiGraph, reagent: str) -> str:
"""
增强版试剂容器查找,支持各种匹配方式的别名函数
"""
return find_reagent_vessel(G, reagent)
def get_vessel_reagent_volume(G: nx.DiGraph, vessel: str) -> float:
"""获取容器中的试剂体积"""
if vessel not in G.nodes():
return 0.0
vessel_data = G.nodes[vessel].get('data', {})
liquids = vessel_data.get('liquid', [])
total_volume = 0.0
for liquid in liquids:
if isinstance(liquid, dict):
# 支持两种格式:新格式 (name, volume) 和旧格式 (liquid_type, liquid_volume)
volume = liquid.get('volume') or liquid.get('liquid_volume', 0.0)
total_volume += volume
return total_volume
def get_vessel_reagent_types(G: nx.DiGraph, vessel: str) -> List[str]:
"""获取容器中所有试剂的类型"""
if vessel not in G.nodes():
return []
vessel_data = G.nodes[vessel].get('data', {})
liquids = vessel_data.get('liquid', [])
reagent_types = []
for liquid in liquids:
if isinstance(liquid, dict):
# 支持两种格式的试剂类型字段
reagent_type = liquid.get('liquid_type') or liquid.get('name', '')
if reagent_type:
reagent_types.append(reagent_type)
# 同时检查配置中的试剂信息
config_reagent = G.nodes[vessel].get('config', {}).get('reagent', '')
reagent_name = vessel_data.get('reagent_name', '')
if config_reagent and config_reagent not in reagent_types:
reagent_types.append(config_reagent)
if reagent_name and reagent_name not in reagent_types:
reagent_types.append(reagent_name)
return reagent_types
def find_vessels_by_reagent(G: nx.DiGraph, reagent: str) -> List[str]:
"""
根据试剂类型查找所有匹配的容器
返回匹配容器的ID列表
"""
matching_vessels = []
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
# 检查容器名称匹配
node_name = G.nodes[node_id].get('name', '').lower()
if reagent.lower() in node_id.lower() or reagent.lower() in node_name:
matching_vessels.append(node_id)
continue
# 检查试剂类型匹配
vessel_data = G.nodes[node_id].get('data', {})
liquids = vessel_data.get('liquid', [])
config_data = G.nodes[node_id].get('config', {})
# 检查 reagent_name 和 config.reagent
reagent_name = vessel_data.get('reagent_name', '').lower()
config_reagent = config_data.get('reagent', '').lower()
if (reagent.lower() == reagent_name or
reagent.lower() == config_reagent):
matching_vessels.append(node_id)
continue
# 检查液体列表
for liquid in liquids:
if isinstance(liquid, dict):
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
if liquid_type.lower() == reagent.lower():
matching_vessels.append(node_id)
break
return matching_vessels
def find_connected_stirrer(G: nx.DiGraph, vessel: str) -> str:
@@ -49,7 +213,7 @@ def find_connected_stirrer(G: nx.DiGraph, vessel: str) -> str:
"""
# 查找所有搅拌器节点
stirrer_nodes = [node for node in G.nodes()
if G.nodes[node].get('class') == 'virtual_stirrer']
if (G.nodes[node].get('class') or '') == 'virtual_stirrer']
# 检查哪个搅拌器与目标容器相连
for stirrer in stirrer_nodes:
@@ -74,10 +238,10 @@ def generate_add_protocol(
purpose: str = "添加试剂"
) -> List[Dict[str, Any]]:
"""
生成添加试剂的协议序列
生成添加试剂的协议序列,支持智能试剂匹配
基于pump_protocol的成熟算法实现试剂添加功能
1. 自动查找试剂瓶
1. 智能查找试剂瓶(支持名称匹配、液体类型匹配、试剂配置匹配)
2. **先启动搅拌,再进行转移** - 确保试剂添加更均匀
3. 使用pump_protocol实现液体转移
@@ -102,24 +266,41 @@ def generate_add_protocol(
"""
action_sequence = []
print(f"ADD_PROTOCOL: 开始生成添加试剂协议")
print(f" - 目标容器: {vessel}")
print(f" - 试剂: {reagent}")
print(f" - 体积: {volume} mL")
print(f" - 质量: {mass} g")
print(f" - 搅拌: {stir} (速度: {stir_speed} RPM)")
print(f" - 粘稠: {viscous}")
print(f" - 目的: {purpose}")
# 1. 验证目标容器存在
if vessel not in G.nodes():
raise ValueError(f"目标容器 '{vessel}' 不存在于系统中")
# 2. 查找试剂瓶
# 2. 智能查找试剂瓶
try:
reagent_vessel = find_reagent_vessel(G, reagent)
print(f"ADD_PROTOCOL: 找到试剂容器: {reagent_vessel}")
except ValueError as e:
raise ValueError(f"无法找到试剂 '{reagent}': {str(e)}")
# 3. 验证是否存在从试剂瓶到目标容器的路径
# 3. 验证试剂容器中的试剂体积
available_volume = get_vessel_reagent_volume(G, reagent_vessel)
print(f"ADD_PROTOCOL: 试剂容器 {reagent_vessel} 中有 {available_volume} mL 试剂")
if available_volume < volume:
print(f"ADD_PROTOCOL: 警告 - 试剂容器中的试剂不足!需要 {volume} mL可用 {available_volume} mL")
# 4. 验证是否存在从试剂瓶到目标容器的路径
try:
path = nx.shortest_path(G, source=reagent_vessel, target=vessel)
print(f"ADD_PROTOCOL: 找到路径 {reagent_vessel} -> {vessel}: {path}")
except nx.NetworkXNoPath:
raise ValueError(f"从试剂瓶 '{reagent_vessel}' 到目标容器 '{vessel}' 没有可用路径")
# 4. **先启动搅拌** - 关键改进!
# 5. **先启动搅拌** - 关键改进!
if stir:
try:
stirrer_id = find_connected_stirrer(G, vessel)
@@ -140,15 +321,21 @@ def generate_add_protocol(
action_sequence.append(stir_action)
print(f"ADD_PROTOCOL: 已添加搅拌动作,速度 {stir_speed} RPM")
# 等待搅拌稳定
action_sequence.append({
"action_name": "wait",
"action_kwargs": {"time": 5}
})
else:
print(f"ADD_PROTOCOL: 警告 - 需要搅拌但未找到与容器 {vessel} 相连的搅拌器")
except Exception as e:
print(f"ADD_PROTOCOL: 搅拌器配置出错: {str(e)}")
# 5. 如果指定了体积,执行液体转移
# 6. 如果指定了体积,执行液体转移
if volume > 0:
# 5.1 计算流速参数
# 6.1 计算流速参数
if time > 0:
# 根据时间计算流速
transfer_flowrate = volume / time
@@ -165,7 +352,7 @@ def generate_add_protocol(
print(f"ADD_PROTOCOL: 准备转移 {volume} mL 从 {reagent_vessel}{vessel}")
print(f"ADD_PROTOCOL: 转移流速={transfer_flowrate} mL/s, 注入流速={flowrate} mL/s")
# 5.2 使用pump_protocol的核心算法实现液体转移
# 6.2 使用pump_protocol的核心算法实现液体转移
try:
pump_actions = generate_pump_protocol_with_rinsing(
G=G,
@@ -190,6 +377,8 @@ def generate_add_protocol(
raise ValueError(f"生成泵协议时出错: {str(e)}")
print(f"ADD_PROTOCOL: 生成了 {len(action_sequence)} 个动作")
print(f"ADD_PROTOCOL: 添加试剂协议生成完成")
return action_sequence
@@ -210,7 +399,7 @@ def generate_add_protocol_with_cleaning(
cleaning_repeats: int = 1
) -> List[Dict[str, Any]]:
"""
生成带清洗的添加试剂协议
生成带清洗的添加试剂协议,支持智能试剂匹配
与普通添加协议的区别是会在添加后进行管道清洗
@@ -235,7 +424,7 @@ def generate_add_protocol_with_cleaning(
"""
action_sequence = []
# 1. 查找试剂瓶
# 1. 智能查找试剂瓶
reagent_vessel = find_reagent_vessel(G, reagent)
# 2. **先启动搅拌**
@@ -251,6 +440,12 @@ def generate_add_protocol_with_cleaning(
"purpose": f"{purpose}: 启动搅拌,准备添加 {reagent}"
}
})
# 等待搅拌稳定
action_sequence.append({
"action_name": "wait",
"action_kwargs": {"time": 5}
})
# 3. 计算流速
if time > 0:
@@ -296,7 +491,7 @@ def generate_sequential_add_protocol(
final_stir_time: float = 300.0
) -> List[Dict[str, Any]]:
"""
生成连续添加多种试剂的协议
生成连续添加多种试剂的协议,支持智能试剂匹配
Args:
G: 网络图
@@ -313,13 +508,13 @@ def generate_sequential_add_protocol(
Example:
reagents = [
{
"reagent": "DMF",
"reagent": "DMF", # 会匹配 reagent_bottle_1 (reagent_name: "DMF")
"volume": 10.0,
"viscous": False,
"stir_speed": 300.0
},
{
"reagent": "ethyl_acetate",
"reagent": "ethyl_acetate", # 会匹配 reagent_bottle_2 (reagent_name: "ethyl_acetate")
"volume": 5.0,
"viscous": False,
"stir_speed": 350.0
@@ -328,14 +523,17 @@ def generate_sequential_add_protocol(
"""
action_sequence = []
print(f"ADD_PROTOCOL: 开始连续添加 {len(reagents)} 种试剂到容器 {vessel}")
for i, reagent_params in enumerate(reagents):
print(f"ADD_PROTOCOL: 处理第 {i+1}/{len(reagents)} 个试剂: {reagent_params.get('reagent')}")
reagent_name = reagent_params.get('reagent')
print(f"ADD_PROTOCOL: 处理第 {i+1}/{len(reagents)} 个试剂: {reagent_name}")
# 生成单个试剂的添加协议
add_actions = generate_add_protocol(
G=G,
vessel=vessel,
reagent=reagent_params.get('reagent'),
reagent=reagent_name,
volume=reagent_params.get('volume', 0.0),
mass=reagent_params.get('mass', 0.0),
amount=reagent_params.get('amount', ''),
@@ -343,7 +541,7 @@ def generate_sequential_add_protocol(
stir=stir_between_additions,
stir_speed=reagent_params.get('stir_speed', 300.0),
viscous=reagent_params.get('viscous', False),
purpose=reagent_params.get('purpose', f'添加试剂 {i+1}')
purpose=reagent_params.get('purpose', f'添加试剂 {reagent_name} ({i+1}/{len(reagents)})')
)
action_sequence.extend(add_actions)
@@ -352,17 +550,23 @@ def generate_sequential_add_protocol(
if i < len(reagents) - 1: # 不是最后一个试剂
action_sequence.append({
"action_name": "wait",
"action_kwargs": {"time": 2}
"action_kwargs": {"time": 10} # 试剂混合时间
})
# 最终搅拌
if final_stir:
stirrer_id = find_connected_stirrer(G, vessel)
if stirrer_id:
print(f"ADD_PROTOCOL: 添加最终搅拌动作,速度 {final_stir_speed} RPM时间 {final_stir_time}")
action_sequence.extend([
{
"action_name": "wait",
"action_kwargs": {"time": final_stir_time}
"device_id": stirrer_id,
"action_name": "stir",
"action_kwargs": {
"stir_time": final_stir_time,
"stir_speed": final_stir_speed,
"settling_time": 30.0
}
}
])
@@ -370,10 +574,52 @@ def generate_sequential_add_protocol(
return action_sequence
# 便捷函数:常用添加方案
def generate_organic_add_protocol(
G: nx.DiGraph,
vessel: str,
organic_reagent: str,
volume: float,
stir_speed: float = 400.0
) -> List[Dict[str, Any]]:
"""有机试剂添加:慢速、搅拌"""
return generate_add_protocol(
G, vessel, organic_reagent, volume, 0.0, "", 0.0,
True, stir_speed, False, f"添加有机试剂 {organic_reagent}"
)
def generate_viscous_add_protocol(
G: nx.DiGraph,
vessel: str,
viscous_reagent: str,
volume: float,
addition_time: float = 120.0
) -> List[Dict[str, Any]]:
"""粘稠试剂添加:慢速、长时间"""
return generate_add_protocol(
G, vessel, viscous_reagent, volume, 0.0, "", addition_time,
True, 250.0, True, f"缓慢添加粘稠试剂 {viscous_reagent}"
)
def generate_solvent_add_protocol(
G: nx.DiGraph,
vessel: str,
solvent: str,
volume: float
) -> List[Dict[str, Any]]:
"""溶剂添加:快速、无需特殊处理"""
return generate_add_protocol(
G, vessel, solvent, volume, 0.0, "", 0.0,
False, 300.0, False, f"添加溶剂 {solvent}"
)
# 使用示例和测试函数
def test_add_protocol():
"""测试添加协议的示例"""
print("=== ADD PROTOCOL 测试 ===")
print("=== ADD PROTOCOL 智能匹配测试 ===")
print("测试完成")

View File

@@ -5,9 +5,13 @@ from .pump_protocol import generate_pump_protocol
def find_solvent_vessel(G: nx.DiGraph, solvent: str) -> str:
"""
查找溶剂容器,支持多种命名模式
查找溶剂容器,支持多种匹配模式
1. 容器名称匹配(如 flask_water, reagent_bottle_1-DMF
2. 容器内液体类型匹配(如 liquid_type: "DMF", "ethanol"
"""
# 可能的溶剂容器命名模式
print(f"CLEAN_VESSEL: 正在查找溶剂 '{solvent}' 的容器...")
# 第一步:通过容器名称匹配
possible_names = [
f"flask_{solvent}", # flask_water, flask_ethanol
f"bottle_{solvent}", # bottle_water, bottle_ethanol
@@ -16,13 +20,87 @@ def find_solvent_vessel(G: nx.DiGraph, solvent: str) -> str:
f"{solvent}_bottle", # water_bottle, ethanol_bottle
f"{solvent}", # 直接用溶剂名
f"solvent_{solvent}", # solvent_water, solvent_ethanol
f"reagent_bottle_{solvent}", # reagent_bottle_DMF
]
# 尝试名称匹配
for vessel_name in possible_names:
if vessel_name in G.nodes():
print(f"CLEAN_VESSEL: 通过名称匹配找到容器: {vessel_name}")
return vessel_name
raise ValueError(f"未找到溶剂 '{solvent}' 的容器。尝试了以下名称: {possible_names}")
# 第二步:通过模糊名称匹配(名称中包含溶剂名)
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
# 检查节点ID或名称中是否包含溶剂名
node_name = G.nodes[node_id].get('name', '').lower()
if (solvent.lower() in node_id.lower() or
solvent.lower() in node_name):
print(f"CLEAN_VESSEL: 通过模糊名称匹配找到容器: {node_id} (名称: {node_name})")
return node_id
# 第三步:通过液体类型匹配
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
vessel_data = G.nodes[node_id].get('data', {})
liquids = vessel_data.get('liquid', [])
for liquid in liquids:
if isinstance(liquid, dict):
# 支持两种格式的液体类型字段
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
reagent_name = vessel_data.get('reagent_name', '')
config_reagent = G.nodes[node_id].get('config', {}).get('reagent', '')
# 检查多个可能的字段
if (liquid_type.lower() == solvent.lower() or
reagent_name.lower() == solvent.lower() or
config_reagent.lower() == solvent.lower()):
print(f"CLEAN_VESSEL: 通过液体类型匹配找到容器: {node_id}")
print(f" - liquid_type: {liquid_type}")
print(f" - reagent_name: {reagent_name}")
print(f" - config.reagent: {config_reagent}")
return node_id
# 第四步:列出所有可用的容器信息帮助调试
available_containers = []
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
vessel_data = G.nodes[node_id].get('data', {})
config_data = G.nodes[node_id].get('config', {})
liquids = vessel_data.get('liquid', [])
container_info = {
'id': node_id,
'name': G.nodes[node_id].get('name', ''),
'liquid_types': [],
'reagent_name': vessel_data.get('reagent_name', ''),
'config_reagent': config_data.get('reagent', '')
}
for liquid in liquids:
if isinstance(liquid, dict):
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
if liquid_type:
container_info['liquid_types'].append(liquid_type)
available_containers.append(container_info)
print(f"CLEAN_VESSEL: 可用容器列表:")
for container in available_containers:
print(f" - {container['id']}: {container['name']}")
print(f" 液体类型: {container['liquid_types']}")
print(f" 试剂名称: {container['reagent_name']}")
print(f" 配置试剂: {container['config_reagent']}")
raise ValueError(f"未找到溶剂 '{solvent}' 的容器。尝试了名称匹配: {possible_names}")
def find_solvent_vessel_by_any_match(G: nx.DiGraph, solvent: str) -> str:
"""
增强版溶剂容器查找,支持各种匹配方式的别名函数
"""
return find_solvent_vessel(G, solvent)
def find_waste_vessel(G: nx.DiGraph) -> str:
@@ -281,4 +359,81 @@ def generate_organic_clean_protocol(
)
action_sequence.extend(water_actions)
return action_sequence
return action_sequence
def get_vessel_liquid_volume(G: nx.DiGraph, vessel: str) -> float:
"""获取容器中的液体体积(修复版)"""
if vessel not in G.nodes():
return 0.0
vessel_data = G.nodes[vessel].get('data', {})
liquids = vessel_data.get('liquid', [])
total_volume = 0.0
for liquid in liquids:
if isinstance(liquid, dict):
# 支持两种格式:新格式 (name, volume) 和旧格式 (liquid_type, liquid_volume)
volume = liquid.get('volume') or liquid.get('liquid_volume', 0.0)
total_volume += volume
return total_volume
def get_vessel_liquid_types(G: nx.DiGraph, vessel: str) -> List[str]:
"""获取容器中所有液体的类型"""
if vessel not in G.nodes():
return []
vessel_data = G.nodes[vessel].get('data', {})
liquids = vessel_data.get('liquid', [])
liquid_types = []
for liquid in liquids:
if isinstance(liquid, dict):
# 支持两种格式的液体类型字段
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
if liquid_type:
liquid_types.append(liquid_type)
return liquid_types
def find_vessel_by_content(G: nx.DiGraph, content: str) -> List[str]:
"""
根据内容物查找所有匹配的容器
返回匹配容器的ID列表
"""
matching_vessels = []
for node_id in G.nodes():
if G.nodes[node_id].get('type') == 'container':
# 检查容器名称匹配
node_name = G.nodes[node_id].get('name', '').lower()
if content.lower() in node_id.lower() or content.lower() in node_name:
matching_vessels.append(node_id)
continue
# 检查液体类型匹配
vessel_data = G.nodes[node_id].get('data', {})
liquids = vessel_data.get('liquid', [])
config_data = G.nodes[node_id].get('config', {})
# 检查 reagent_name 和 config.reagent
reagent_name = vessel_data.get('reagent_name', '').lower()
config_reagent = config_data.get('reagent', '').lower()
if (content.lower() == reagent_name or
content.lower() == config_reagent):
matching_vessels.append(node_id)
continue
# 检查液体列表
for liquid in liquids:
if isinstance(liquid, dict):
liquid_type = liquid.get('liquid_type') or liquid.get('name', '')
if liquid_type.lower() == content.lower():
matching_vessels.append(node_id)
break
return matching_vessels

View File

@@ -845,6 +845,14 @@ virtual_separator:
data_source: executor
data_key: top_outlet
description: "上相(轻相)液体输出口"
- handler_key: bind
label: bind
io_type: target
data_type: mechanical
side: WEST
data_source: handle
data_key: mechanical_port
description: "用于连接搅拌器等机械设备的接口"
schema:
type: object
properties:

View File

@@ -3,5 +3,623 @@ workstation:
class:
module: unilabos.ros.nodes.presets.protocol_node:ROS2ProtocolNode
type: ros2
schema:
properties: {}
action_value_mappings:
AddProtocol:
type: Add
goal:
vessel: vessel
reagent: reagent
volume: volume
mass: mass
amount: amount
time: time
stir: stir
stir_speed: stir_speed
viscous: viscous
purpose: purpose
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: reagent
label: Reagent
data_type: resource
data_source: handle
data_key: reagent
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
AGVTransferProtocol:
type: AGVTransfer
goal:
from_repo: from_repo
from_repo_position: from_repo_position
to_repo: to_repo
to_repo_position: to_repo_position
feedback: {}
result: {}
CentrifugeProtocol:
type: Centrifuge
goal:
vessel: vessel
speed: speed
time: time
temp: temp
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
CleanProtocol:
type: Clean
goal:
vessel: vessel
solvent: solvent
volume: volume
temp: temp
repeats: repeats
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: solvent
label: Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
CleanVesselProtocol:
type: CleanVessel
goal:
vessel: vessel
solvent: solvent
volume: volume
temp: temp
repeats: repeats
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: solvent
label: Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
DissolveProtocol:
type: Dissolve
goal:
vessel: vessel
solvent: solvent
volume: volume
amount: amount
temp: temp
time: time
stir_speed: stir_speed
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: solvent
label: Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
EvacuateAndRefillProtocol:
type: EvacuateAndRefill
goal:
vessel: vessel
gas: gas
repeats: repeats
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
EvaporateProtocol:
type: Evaporate
goal:
vessel: vessel
pressure: pressure
temp: temp
time: time
stir_speed: stir_speed
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
FilterProtocol:
type: Filter
goal:
vessel: vessel
filtrate_vessel: filtrate_vessel
stir: stir
stir_speed: stir_speed
temp: temp
continue_heatchill: continue_heatchill
volume: volume
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: filtrate_vessel
label: Filtrate Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
- handler_key: filtrate_out
label: Filtrate Vessel
data_type: resource
data_source: executor
data_key: vessel
FilterThroughProtocol:
type: FilterThrough
goal:
from_vessel: from_vessel
to_vessel: to_vessel
filter_through: filter_through
eluting_solvent: eluting_solvent
eluting_volume: eluting_volume
eluting_repeats: eluting_repeats
residence_time: residence_time
feedback: {}
result: {}
handles:
input:
- handler_key: from_vessel
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
- handler_key: solvent
label: Eluting Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: from_vessel_out
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel_out
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
HeatChillProtocol:
type: HeatChill
goal:
vessel: vessel
temp: temp
time: time
stir: stir
stir_speed: stir_speed
purpose: purpose
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
HeatChillStartProtocol:
type: HeatChillStart
goal:
vessel: vessel
temp: temp
purpose: purpose
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
HeatChillStopProtocol:
type: HeatChillStop
goal:
vessel: vessel
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
PumpTransferProtocol:
type: PumpTransfer
goal:
from_vessel: from_vessel
to_vessel: to_vessel
volume: volume
amount: amount
time: time
viscous: viscous
rinsing_solvent: rinsing_solvent
rinsing_volume: rinsing_volume
rinsing_repeats: rinsing_repeats
solid: solid
feedback: {}
result: {}
handles:
input:
- handler_key: from_vessel
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
- handler_key: solvent
label: Rinsing Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: from_vessel_out
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel_out
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
RunColumnProtocol:
type: RunColumn
goal:
from_vessel: from_vessel
to_vessel: to_vessel
column: column
feedback: {}
result: {}
handles:
input:
- handler_key: from_vessel
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
output:
- handler_key: from_vessel_out
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel_out
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
SeparateProtocol:
type: Separate
goal:
purpose: purpose
product_phase: product_phase
from_vessel: from_vessel
separation_vessel: separation_vessel
to_vessel: to_vessel
waste_phase_to_vessel: waste_phase_to_vessel
solvent: solvent
solvent_volume: solvent_volume
through: through
repeats: repeats
stir_time: stir_time
stir_speed: stir_speed
settling_time: settling_time
feedback: {}
result: {}
handles:
input:
- handler_key: from_vessel
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
- handler_key: solvent
label: Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: from_vessel_out
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel_out
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
StartStirProtocol:
type: StartStir
goal:
vessel: vessel
stir_speed: stir_speed
purpose: purpose
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
StirProtocol:
type: Stir
goal:
stir_time: stir_time
stir_speed: stir_speed
settling_time: settling_time
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
StopStirProtocol:
type: StopStir
goal:
vessel: vessel
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel
data_type: resource
data_source: executor
data_key: vessel
TransferProtocol:
type: Transfer
goal:
from_vessel: from_vessel
to_vessel: to_vessel
volume: volume
amount: amount
time: time
viscous: viscous
rinsing_solvent: rinsing_solvent
rinsing_volume: rinsing_volume
rinsing_repeats: rinsing_repeats
solid: solid
feedback: {}
result: {}
handles:
input:
- handler_key: from_vessel
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
- handler_key: solvent
label: Rinsing Solvent
data_type: resource
data_source: handle
data_key: solvent
output:
- handler_key: from_vessel_out
label: From Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: to_vessel_out
label: To Vessel
data_type: resource
data_source: executor
data_key: vessel
WashSolidProtocol:
type: WashSolid
goal:
vessel: vessel
solvent: solvent
volume: volume
filtrate_vessel: filtrate_vessel
temp: temp
stir: stir
stir_speed: stir_speed
time: time
repeats: repeats
feedback: {}
result: {}
handles:
input:
- handler_key: vessel
label: Vessel
data_type: resource
data_source: handle
data_key: vessel
- handler_key: solvent
label: Solvent
data_type: resource
data_source: handle
data_key: solvent
- handler_key: filtrate_vessel
label: Filtrate Vessel
data_type: resource
data_source: executor
data_key: vessel
output:
- handler_key: vessel_out
label: Vessel Out
data_type: resource
data_source: handle
data_key: vessel
- handler_key: filtrate_vessel_out
label: Filtrate Vessel
data_type: resource
data_source: executor
data_key: vessel

View File

@@ -1,5 +1,6 @@
container:
description: regular organic container
icon: Flask.webp
class:
module: unilabos.resources.container:RegularContainer
type: unilabos