From 3d2d428a96144d7b4f3bb6a3dba8fe076a9ad6c0 Mon Sep 17 00:00:00 2001 From: Xuwznln <18435084+Xuwznln@users.noreply.github.com> Date: Wed, 7 Jan 2026 20:54:20 +0800 Subject: [PATCH] Update README.md Modify resource_tracker file module path. (cherry picked from commit 8066c200b9d16a2abaadc0d773ac87a366f52a2d) --- README.md | 14 ++++++++++---- README_zh.md | 8 ++++++-- docs/user_guide/graph_files.md | 8 ++++---- tests/resources/test_resourcetreeset.py | 3 +-- unilabos/app/backend.py | 2 +- unilabos/app/main.py | 2 +- unilabos/app/web/client.py | 4 +--- .../device_comms/coin_cell_assembly_workstation.py | 4 ++-- unilabos/devices/liquid_handling/biomek.py | 2 +- unilabos/resources/graphio.py | 2 +- .../{ros/nodes => resources}/resource_tracker.py | 0 unilabos/ros/device_node_wrapper.py | 2 +- unilabos/ros/initialize_device.py | 3 +-- unilabos/ros/main_slave_run.py | 2 +- unilabos/ros/nodes/base_device_node.py | 9 +-------- unilabos/ros/nodes/presets/host_node.py | 4 +--- unilabos/ros/nodes/presets/workstation.py | 5 ++--- unilabos/ros/utils/driver_creator.py | 7 +++---- 18 files changed, 38 insertions(+), 43 deletions(-) rename unilabos/{ros/nodes => resources}/resource_tracker.py (100%) diff --git a/README.md b/README.md index 7cf43d9..f10cc0f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,9 @@ Detailed documentation can be found at: ## Quick Start -Uni-Lab-OS recommends using `mamba` for environment management. Choose the appropriate environment file for your operating system: +1. Setup Conda Environment + +Uni-Lab-OS recommends using `mamba` for environment management: ```bash # Create new environment @@ -40,7 +42,7 @@ mamba activate unilab mamba install -n unilab uni-lab::unilabos -c robostack-staging -c conda-forge ``` -## Install Dev Uni-Lab-OS +2. Install Dev Uni-Lab-OS ```bash # Clone the repository @@ -51,17 +53,21 @@ cd Uni-Lab-OS pip install . ``` -3. Start Uni-Lab System: +3. Start Uni-Lab System Please refer to [Documentation - Boot Examples](https://deepmodeling.github.io/Uni-Lab-OS/boot_examples/index.html) +4. Best Practice + +See [Best Practice Guide](https://deepmodeling.github.io/Uni-Lab-OS/user_guide/best_practice.html) + ## Message Format Uni-Lab-OS uses pre-built `unilabos_msgs` for system communication. You can find the built versions on the [GitHub Releases](https://github.com/deepmodeling/Uni-Lab-OS/releases) page. ## Citation -If you use Uni-Lab-OS in academic research, please cite: +If you use [Uni-Lab-OS](https://arxiv.org/abs/2512.21766) in academic research, please cite: ```bibtex @article{gao2025unilabos, diff --git a/README_zh.md b/README_zh.md index e635e71..c4dba7d 100644 --- a/README_zh.md +++ b/README_zh.md @@ -53,17 +53,21 @@ cd Uni-Lab-OS pip install . ``` -3. 启动 Uni-Lab 系统: +3. 启动 Uni-Lab 系统 请见[文档-启动样例](https://deepmodeling.github.io/Uni-Lab-OS/boot_examples/index.html) +4. 最佳实践 + +请见[最佳实践指南](https://deepmodeling.github.io/Uni-Lab-OS/user_guide/best_practice.html) + ## 消息格式 Uni-Lab-OS 使用预构建的 `unilabos_msgs` 进行系统通信。您可以在 [GitHub Releases](https://github.com/deepmodeling/Uni-Lab-OS/releases) 页面找到已构建的版本。 ## 引用 -如果您在学术研究中使用 Uni-Lab-OS,请引用: +如果您在学术研究中使用 [Uni-Lab-OS](https://arxiv.org/abs/2512.21766),请引用: ```bibtex @article{gao2025unilabos, diff --git a/docs/user_guide/graph_files.md b/docs/user_guide/graph_files.md index 44c3faf..d690282 100644 --- a/docs/user_guide/graph_files.md +++ b/docs/user_guide/graph_files.md @@ -463,7 +463,7 @@ Uni-Lab 使用 `ResourceDictInstance.get_resource_instance_from_dict()` 方法 ### 使用示例 ```python -from unilabos.ros.nodes.resource_tracker import ResourceDictInstance +from unilabos.resources.resource_tracker import ResourceDictInstance # 旧格式节点 old_format_node = { @@ -477,10 +477,10 @@ old_format_node = { instance = ResourceDictInstance.get_resource_instance_from_dict(old_format_node) # 访问标准化后的数据 -print(instance.res_content.id) # "pump_1" -print(instance.res_content.uuid) # 自动生成的 UUID +print(instance.res_content.id) # "pump_1" +print(instance.res_content.uuid) # 自动生成的 UUID print(instance.res_content.config) # {} -print(instance.res_content.data) # {} +print(instance.res_content.data) # {} ``` ### 格式迁移建议 diff --git a/tests/resources/test_resourcetreeset.py b/tests/resources/test_resourcetreeset.py index 1ba9ab2..cd1ff91 100644 --- a/tests/resources/test_resourcetreeset.py +++ b/tests/resources/test_resourcetreeset.py @@ -2,9 +2,8 @@ import pytest import json import os -from pylabrobot.resources import Resource as ResourcePLR from unilabos.resources.graphio import resource_bioyond_to_plr -from unilabos.ros.nodes.resource_tracker import ResourceTreeSet +from unilabos.resources.resource_tracker import ResourceTreeSet from unilabos.registry.registry import lab_registry from unilabos.resources.bioyond.decks import BIOYOND_PolymerReactionStation_Deck diff --git a/unilabos/app/backend.py b/unilabos/app/backend.py index b2bc0af..4af03cb 100644 --- a/unilabos/app/backend.py +++ b/unilabos/app/backend.py @@ -1,6 +1,6 @@ import threading -from unilabos.ros.nodes.resource_tracker import ResourceTreeSet +from unilabos.resources.resource_tracker import ResourceTreeSet from unilabos.utils import logger diff --git a/unilabos/app/main.py b/unilabos/app/main.py index 3af50cb..6738b2f 100644 --- a/unilabos/app/main.py +++ b/unilabos/app/main.py @@ -315,7 +315,7 @@ def main(): from unilabos.app.web import start_server from unilabos.app.register import register_devices_and_resources from unilabos.resources.graphio import modify_to_backend_format - from unilabos.ros.nodes.resource_tracker import ResourceTreeSet, ResourceDict + from unilabos.resources.resource_tracker import ResourceTreeSet, ResourceDict # 显示启动横幅 print_unilab_banner(args_dict) diff --git a/unilabos/app/web/client.py b/unilabos/app/web/client.py index 8968f03..64a9418 100644 --- a/unilabos/app/web/client.py +++ b/unilabos/app/web/client.py @@ -6,12 +6,10 @@ HTTP客户端模块 import json import os -import time -from threading import Thread from typing import List, Dict, Any, Optional import requests -from unilabos.ros.nodes.resource_tracker import ResourceTreeSet +from unilabos.resources.resource_tracker import ResourceTreeSet from unilabos.utils.log import info from unilabos.config.config import HTTPConfig, BasicConfig from unilabos.utils import logger diff --git a/unilabos/device_comms/coin_cell_assembly_workstation.py b/unilabos/device_comms/coin_cell_assembly_workstation.py index 62d9b09..187f411 100644 --- a/unilabos/device_comms/coin_cell_assembly_workstation.py +++ b/unilabos/device_comms/coin_cell_assembly_workstation.py @@ -6,7 +6,7 @@ Coin Cell Assembly Workstation """ from typing import Dict, Any, List, Optional, Union -from unilabos.ros.nodes.resource_tracker import DeviceNodeResourceTracker +from unilabos.resources.resource_tracker import DeviceNodeResourceTracker from unilabos.device_comms.workstation_base import WorkstationBase, WorkflowInfo from unilabos.device_comms.workstation_communication import ( WorkstationCommunicationBase, CommunicationConfig, CommunicationProtocol, CoinCellCommunication @@ -61,7 +61,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase): # 创建资源跟踪器(如果没有提供) if resource_tracker is None: - from unilabos.ros.nodes.resource_tracker import DeviceNodeResourceTracker + from unilabos.resources.resource_tracker import DeviceNodeResourceTracker resource_tracker = DeviceNodeResourceTracker() # 初始化基类 diff --git a/unilabos/devices/liquid_handling/biomek.py b/unilabos/devices/liquid_handling/biomek.py index 3fe3049..7fbafd7 100644 --- a/unilabos/devices/liquid_handling/biomek.py +++ b/unilabos/devices/liquid_handling/biomek.py @@ -13,7 +13,7 @@ from pylabrobot.resources import ( import copy from unilabos_msgs.msg import Resource -from unilabos.ros.nodes.resource_tracker import DeviceNodeResourceTracker # type: ignore +from unilabos.resources.resource_tracker import DeviceNodeResourceTracker # type: ignore class LiquidHandlerBiomek: diff --git a/unilabos/resources/graphio.py b/unilabos/resources/graphio.py index 8744b45..faf0482 100644 --- a/unilabos/resources/graphio.py +++ b/unilabos/resources/graphio.py @@ -13,7 +13,7 @@ from unilabos.config.config import BasicConfig from unilabos.resources.container import RegularContainer from unilabos.resources.itemized_carrier import ItemizedCarrier, BottleCarrier from unilabos.ros.msgs.message_converter import convert_to_ros_msg -from unilabos.ros.nodes.resource_tracker import ( +from unilabos.resources.resource_tracker import ( ResourceDictInstance, ResourceTreeSet, ) diff --git a/unilabos/ros/nodes/resource_tracker.py b/unilabos/resources/resource_tracker.py similarity index 100% rename from unilabos/ros/nodes/resource_tracker.py rename to unilabos/resources/resource_tracker.py diff --git a/unilabos/ros/device_node_wrapper.py b/unilabos/ros/device_node_wrapper.py index f5e80c5..db9caa4 100644 --- a/unilabos/ros/device_node_wrapper.py +++ b/unilabos/ros/device_node_wrapper.py @@ -5,7 +5,7 @@ from unilabos.ros.msgs.message_converter import ( get_action_type, ) from unilabos.ros.nodes.base_device_node import init_wrapper, ROS2DeviceNode -from unilabos.ros.nodes.resource_tracker import ResourceDictInstance +from unilabos.resources.resource_tracker import ResourceDictInstance # 定义泛型类型变量 T = TypeVar("T") diff --git a/unilabos/ros/initialize_device.py b/unilabos/ros/initialize_device.py index 55ac145..675814a 100644 --- a/unilabos/ros/initialize_device.py +++ b/unilabos/ros/initialize_device.py @@ -1,10 +1,9 @@ -import copy from typing import Optional from unilabos.registry.registry import lab_registry from unilabos.ros.device_node_wrapper import ros2_device_node from unilabos.ros.nodes.base_device_node import ROS2DeviceNode, DeviceInitError -from unilabos.ros.nodes.resource_tracker import ResourceDictInstance +from unilabos.resources.resource_tracker import ResourceDictInstance from unilabos.utils import logger from unilabos.utils.exception import DeviceClassInvalid from unilabos.utils.import_manager import default_manager diff --git a/unilabos/ros/main_slave_run.py b/unilabos/ros/main_slave_run.py index 4373cea..b79c368 100644 --- a/unilabos/ros/main_slave_run.py +++ b/unilabos/ros/main_slave_run.py @@ -10,7 +10,7 @@ from unilabos_msgs.srv._serial_command import SerialCommand_Response from unilabos.app.register import register_devices_and_resources from unilabos.ros.nodes.presets.resource_mesh_manager import ResourceMeshManager -from unilabos.ros.nodes.resource_tracker import DeviceNodeResourceTracker, ResourceTreeSet +from unilabos.resources.resource_tracker import DeviceNodeResourceTracker, ResourceTreeSet from unilabos.devices.ros_dev.liquid_handler_joint_publisher import LiquidHandlerJointPublisher from unilabos_msgs.srv import SerialCommand # type: ignore from rclpy.executors import MultiThreadedExecutor diff --git a/unilabos/ros/nodes/base_device_node.py b/unilabos/ros/nodes/base_device_node.py index e810b0b..954a653 100644 --- a/unilabos/ros/nodes/base_device_node.py +++ b/unilabos/ros/nodes/base_device_node.py @@ -1,4 +1,3 @@ -import copy import inspect import io import json @@ -13,7 +12,6 @@ import asyncio import rclpy import yaml -from msgcenterpy import ROS2MessageInstance from rclpy.node import Node from rclpy.action import ActionServer, ActionClient from rclpy.action.server import ServerGoalHandle @@ -26,11 +24,7 @@ from unilabos.utils.decorator import get_topic_config, get_all_subscriptions from unilabos.resources.container import RegularContainer from unilabos.resources.graphio import ( - resource_ulab_to_plr, initialize_resources, - dict_to_tree, - resource_plr_to_ulab, - tree_to_list, ) from unilabos.resources.plr_additional_res_reg import register from unilabos.ros.msgs.message_converter import ( @@ -47,7 +41,7 @@ from unilabos_msgs.srv import ( ) # type: ignore from unilabos_msgs.msg import Resource # type: ignore -from unilabos.ros.nodes.resource_tracker import ( +from unilabos.resources.resource_tracker import ( DeviceNodeResourceTracker, ResourceTreeSet, ResourceTreeInstance, @@ -363,7 +357,6 @@ class BaseROS2DeviceNode(Node, Generic[T]): return res async def append_resource(req: SerialCommand_Request, res: SerialCommand_Response): - from pylabrobot.resources.resource import Resource as ResourcePLR from pylabrobot.resources.deck import Deck from pylabrobot.resources import Coordinate from pylabrobot.resources import Plate diff --git a/unilabos/ros/nodes/presets/host_node.py b/unilabos/ros/nodes/presets/host_node.py index 971b6dd..e0a66bf 100644 --- a/unilabos/ros/nodes/presets/host_node.py +++ b/unilabos/ros/nodes/presets/host_node.py @@ -10,7 +10,6 @@ from typing import TYPE_CHECKING, Optional, Dict, Any, List, ClassVar, Set, Type from action_msgs.msg import GoalStatus from geometry_msgs.msg import Point from rclpy.action import ActionClient, get_action_server_names_and_types_by_node -from rclpy.callback_groups import ReentrantCallbackGroup from rclpy.service import Service from unilabos_msgs.msg import Resource # type: ignore from unilabos_msgs.srv import ( @@ -19,7 +18,6 @@ from unilabos_msgs.srv import ( ResourceUpdate, ResourceList, SerialCommand, - ResourceGet, ) # type: ignore from unilabos_msgs.srv._serial_command import SerialCommand_Request, SerialCommand_Response from unique_identifier_msgs.msg import UUID @@ -37,7 +35,7 @@ from unilabos.ros.msgs.message_converter import ( ) from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode, ROS2DeviceNode, DeviceNodeResourceTracker from unilabos.ros.nodes.presets.controller_node import ControllerNode -from unilabos.ros.nodes.resource_tracker import ( +from unilabos.resources.resource_tracker import ( ResourceDict, ResourceDictInstance, ResourceTreeSet, diff --git a/unilabos/ros/nodes/presets/workstation.py b/unilabos/ros/nodes/presets/workstation.py index 91cd0ef..ed3fe14 100644 --- a/unilabos/ros/nodes/presets/workstation.py +++ b/unilabos/ros/nodes/presets/workstation.py @@ -12,11 +12,10 @@ from unilabos_msgs.srv import ResourceUpdate from unilabos.messages import * # type: ignore # protocol names from rclpy.action import ActionServer, ActionClient from rclpy.action.server import ServerGoalHandle -from rclpy.callback_groups import ReentrantCallbackGroup from unilabos_msgs.srv._serial_command import SerialCommand_Request, SerialCommand_Response from unilabos.compile import action_protocol_generators -from unilabos.resources.graphio import list_to_nested_dict, nested_dict_to_list +from unilabos.resources.graphio import nested_dict_to_list from unilabos.ros.initialize_device import initialize_device_from_dict from unilabos.ros.msgs.message_converter import ( get_action_type, @@ -24,7 +23,7 @@ from unilabos.ros.msgs.message_converter import ( convert_from_ros_msg_with_mapping, ) from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode, DeviceNodeResourceTracker, ROS2DeviceNode -from unilabos.ros.nodes.resource_tracker import ResourceTreeSet, ResourceDictInstance +from unilabos.resources.resource_tracker import ResourceTreeSet, ResourceDictInstance from unilabos.utils.type_check import get_result_info_str if TYPE_CHECKING: diff --git a/unilabos/ros/utils/driver_creator.py b/unilabos/ros/utils/driver_creator.py index 7a60474..35aca5e 100644 --- a/unilabos/ros/utils/driver_creator.py +++ b/unilabos/ros/utils/driver_creator.py @@ -11,10 +11,9 @@ import traceback from abc import abstractmethod from typing import Type, Any, Dict, Optional, TypeVar, Generic, List -from unilabos.resources.graphio import nested_dict_to_list, resource_ulab_to_plr -from unilabos.ros.nodes.resource_tracker import DeviceNodeResourceTracker, ResourceTreeSet, ResourceDictInstance, \ +from unilabos.resources.resource_tracker import DeviceNodeResourceTracker, ResourceTreeSet, ResourceDictInstance, \ ResourceTreeInstance -from unilabos.utils import logger, import_manager +from unilabos.utils import logger from unilabos.utils.cls_creator import create_instance_from_config # 定义泛型类型变量 @@ -135,7 +134,7 @@ class PyLabRobotCreator(DeviceClassCreator[T]): Returns: 处理后的数据 """ - from pylabrobot.resources import Deck, Resource + from pylabrobot.resources import Resource if states is None: states = {}