diff --git a/.conda/recipe.yaml b/.conda/recipe.yaml new file mode 100644 index 0000000..7bc17da --- /dev/null +++ b/.conda/recipe.yaml @@ -0,0 +1,69 @@ +package: + name: unilabos + version: 0.10.1 + +build: + noarch: python + number: 0 + script: + - python -m pip install paho-mqtt opentrons_shared_data + - python -m pip install git+https://github.com/Xuwznln/pylabrobot.git + +requirements: + host: + - python >=3.11 + - pip + - setuptools + run: + - conda-forge::python =3.11.11 + - compilers + - cmake + - make + - ninja + - sphinx + - sphinx_rtd_theme + - numpy + - scipy + - pandas + - networkx + - matplotlib + - pint + - pyserial + - pyusb + - pylibftdi + - pymodbus + - python-can + - pyvisa + - opencv + - pydantic + - fastapi + - uvicorn + - gradio + - flask + - websocket + - ipython + - jupyter + - jupyros + - colcon-common-extensions + - robostack-staging::ros-humble-desktop-full + - robostack-staging::ros-humble-control-msgs + - robostack-staging::ros-humble-sensor-msgs + - robostack-staging::ros-humble-trajectory-msgs + - ros-humble-navigation2 + - ros-humble-ros2-control + - ros-humble-robot-state-publisher + - ros-humble-joint-state-publisher + - ros-humble-rosbridge-server + - ros-humble-cv-bridge + - ros-humble-tf2 + - ros-humble-moveit + - ros-humble-moveit-servo + - ros-humble-simulation + - ros-humble-tf-transformations + - transforms3d + - uni-lab::ros-humble-unilabos-msgs + +about: + repository: https://github.com/dptech-corp/Uni-Lab-OS + license: GPL-3.0 + description: "Uni-Lab-OS" diff --git a/.gitignore b/.gitignore index 41a46f9..519ab3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ configs/ temp/ +output/ ## Python # Byte-compiled / optimized / DLL files diff --git a/README.md b/README.md index f58cf3e..374632b 100644 --- a/README.md +++ b/README.md @@ -40,21 +40,11 @@ Uni-Lab-OS recommends using `mamba` for environment management. Choose the appro ```bash # Create new environment -mamba env create -f unilabos-[YOUR_OS].yaml -mamba activate unilab +mamba create -n unilab unilab -c unilab -c robostack -c robostack-staging -c conda-forge # Or update existing environment # Where `[YOUR_OS]` can be `win64`, `linux-64`, `osx-64`, or `osx-arm64`. conda env update --file unilabos-[YOUR_OS].yml -n environment_name - -# Currently, you need to install the `unilabos_msgs` package -# You can download the system-specific package from the Release page -conda install ros-humble-unilabos-msgs-0.10.0-xxxxx.tar.bz2 - -# Install PyLabRobot and other prerequisites -git clone https://github.com/PyLabRobot/pylabrobot plr_repo -cd plr_repo -pip install .[opentrons] ``` 2. Install Uni-Lab-OS: diff --git a/README_zh.md b/README_zh.md index ef555e7..833c2d8 100644 --- a/README_zh.md +++ b/README_zh.md @@ -40,21 +40,11 @@ Uni-Lab-OS 建议使用 `mamba` 管理环境。根据您的操作系统选择适 ```bash # 创建新环境 -mamba env create -f unilabos-[YOUR_OS].yaml -mamba activate unilab +mamba create -n unilab unilab -c unilab -c robostack -c robostack-staging -c conda-forge # 或更新现有环境 # 其中 `[YOUR_OS]` 可以是 `win64`, `linux-64`, `osx-64`, 或 `osx-arm64`。 conda env update --file unilabos-[YOUR_OS].yml -n 环境名 - -# 现阶段,需要安装 `unilabos_msgs` 包 -# 可以前往 Release 页面下载系统对应的包进行安装 -conda install ros-humble-unilabos-msgs-0.10.0-xxxxx.tar.bz2 - -# 安装PyLabRobot等前置 -git clone https://github.com/PyLabRobot/pylabrobot plr_repo -cd plr_repo -pip install .[opentrons] ``` 2. 安装 Uni-Lab-OS: diff --git a/recipes/ros-humble-unilabos-msgs/recipe.yaml b/recipes/ros-humble-unilabos-msgs/recipe.yaml index 81c390b..6d8eb9d 100644 --- a/recipes/ros-humble-unilabos-msgs/recipe.yaml +++ b/recipes/ros-humble-unilabos-msgs/recipe.yaml @@ -1,46 +1,58 @@ package: name: ros-humble-unilabos-msgs - version: 0.10.0 + version: 0.10.1 + source: path: ../../unilabos_msgs - folder: ros-humble-unilabos-msgs/src/work + target_directory: ros-humble-unilabos-msgs/src/work build: script: - sel(win): bld_ament_cmake.bat - sel(unix): build_ament_cmake.sh + - if: win + then: + - call %RECIPE_DIR%/bld_ament_cmake.bat + - if: unix + then: + - bash $RECIPE_DIR/build_ament_cmake.sh number: 5 about: - home: https://www.ros.org/ + repository: https://github.com/dptech-corp/Uni-Lab-OS license: BSD-3-Clause - summary: | - Robot Operating System - -extra: - recipe-maintainers: - - ros-forge + description: "ros-humble-unilabos-msgs is a package that provides message definitions for Uni-Lab-OS." requirements: build: - - "{{ compiler('cxx') }}" - - "{{ compiler('c') }}" - - sel(linux64): sysroot_linux-64 2.17 + - ${{ compiler('cxx') }} + - ${{ compiler('c') }} + - if: linux and x86_64 + then: + - sysroot_linux-64 2.17 - ninja - setuptools - - sel(unix): make - - sel(unix): coreutils - - sel(osx): tapi - - sel(build_platform != target_platform): pkg-config - - cmake - cython - - sel(win): vs2022_win-64 - - sel(build_platform != target_platform): python - - sel(build_platform != target_platform): cross-python_{{ target_platform }} - - sel(build_platform != target_platform): numpy + - cmake + - if: unix + then: + - make + - coreutils + - if: osx + then: + - tapi + - if: win + then: + - vs2022_win-64 + - if: build_platform != target_platform + then: + - pkg-config + - python + - cross-python_${{ target_platform }} + - numpy host: - numpy - pip - - sel(build_platform == target_platform): pkg-config + - if: build_platform == target_platform + then: + - pkg-config - robostack-staging::ros-humble-action-msgs - robostack-staging::ros-humble-ament-cmake - robostack-staging::ros-humble-ament-lint-auto @@ -50,12 +62,14 @@ requirements: - robostack-staging::ros-humble-rosidl-default-generators - robostack-staging::ros-humble-std-msgs - robostack-staging::ros-humble-geometry-msgs - - robostack-staging::ros2-distro-mutex=0.5.* + - robostack-staging::ros2-distro-mutex=0.6 run: - robostack-staging::ros-humble-action-msgs - robostack-staging::ros-humble-ros-workspace - robostack-staging::ros-humble-rosidl-default-runtime - robostack-staging::ros-humble-std-msgs - robostack-staging::ros-humble-geometry-msgs -# - robostack-staging::ros2-distro-mutex=0.6.* - - sel(osx and x86_64): __osx >={{ MACOSX_DEPLOYMENT_TARGET|default('10.14') }} + - robostack-staging::ros2-distro-mutex=0.6 + - if: osx and x86_64 + then: + - __osx >= {{ MACOSX_DEPLOYMENT_TARGET|default('10.14') }} \ No newline at end of file diff --git a/recipes/unilabos/recipe.yaml b/recipes/unilabos/recipe.yaml index 3b97b9a..0a2c778 100644 --- a/recipes/unilabos/recipe.yaml +++ b/recipes/unilabos/recipe.yaml @@ -1,6 +1,6 @@ package: name: unilabos - version: "0.10.0" + version: "0.10.1" source: path: ../.. diff --git a/setup.py b/setup.py index f256bd6..740b378 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ package_name = 'unilabos' setup( name=package_name, - version='0.10.0', + version='0.10.1', packages=find_packages(), include_package_data=True, install_requires=['setuptools'], diff --git a/unilabos-linux-64.yaml b/unilabos-linux-64.yaml index 5a94764..c84e045 100644 --- a/unilabos-linux-64.yaml +++ b/unilabos-linux-64.yaml @@ -1,5 +1,6 @@ name: unilab channels: + - unilab - robostack - robostack-staging - conda-forge @@ -61,7 +62,8 @@ dependencies: - transforms3d # ros-humble-gazebo-ros // ignored because of the conflict with ign-gazebo # ilab equipments -# - ros-humble-unilabos-msgs + - uni-lab::ros-humble-unilabos-msgs - pip: - paho-mqtt - - opentrons_shared_data \ No newline at end of file + - opentrons_shared_data + - git+https://github.com/Xuwznln/pylabrobot \ No newline at end of file diff --git a/unilabos-osx-64.yaml b/unilabos-osx-64.yaml index 1c6db8d..ca9a96f 100644 --- a/unilabos-osx-64.yaml +++ b/unilabos-osx-64.yaml @@ -1,5 +1,6 @@ name: unilab channels: + - unilab - robostack - robostack-staging - conda-forge @@ -60,7 +61,8 @@ dependencies: - transforms3d # ros-humble-gazebo-ros // ignored because of the conflict with ign-gazebo # ilab equipments -# - ros-humble-unilabos-msgs + - uni-lab::ros-humble-unilabos-msgs - pip: - paho-mqtt - - opentrons_shared_data \ No newline at end of file + - opentrons_shared_data + - git+https://github.com/Xuwznln/pylabrobot \ No newline at end of file diff --git a/unilabos-osx-arm64.yaml b/unilabos-osx-arm64.yaml index 8f40130..7f9675d 100644 --- a/unilabos-osx-arm64.yaml +++ b/unilabos-osx-arm64.yaml @@ -1,5 +1,6 @@ name: unilab channels: + - unilab - robostack - robostack-staging - conda-forge @@ -63,7 +64,8 @@ dependencies: - transforms3d # ros-humble-gazebo-ros // ignored because of the conflict with ign-gazebo # ilab equipments -# - ros-humble-unilabos-msgs + - uni-lab::ros-humble-unilabos-msgs - pip: - paho-mqtt - - opentrons_shared_data \ No newline at end of file + - opentrons_shared_data + - git+https://github.com/Xuwznln/pylabrobot \ No newline at end of file diff --git a/unilabos-win64.yaml b/unilabos-win64.yaml index bb4e832..b2065a0 100644 --- a/unilabos-win64.yaml +++ b/unilabos-win64.yaml @@ -1,5 +1,6 @@ name: unilab channels: + - unilab - robostack - robostack-staging - conda-forge @@ -61,12 +62,13 @@ dependencies: - transforms3d # ros-humble-gazebo-ros // ignored because of the conflict with ign-gazebo # ilab equipments - # ros-humble-unilabos-msgs + - uni-lab::ros-humble-unilabos-msgs # driver #- crcmod - pip: - paho-mqtt - opentrons_shared_data + - git+https://github.com/Xuwznln/pylabrobot # driver #- ur-rtde # set PYTHONUTF8=1 #- pyautogui diff --git a/unilabos/app/register.py b/unilabos/app/register.py index 7a78cf9..2509e0e 100644 --- a/unilabos/app/register.py +++ b/unilabos/app/register.py @@ -34,9 +34,6 @@ def register_devices_and_resources(mqtt_client, lab_registry): logger.info(f"[UniLab Register] 成功通过HTTP注册 {len(resources_to_register)} 个资源 {cost_time}ms") else: logger.error(f"[UniLab Register] HTTP注册资源失败: {response.status_code}, {response.text} {cost_time}ms") - - time.sleep(10) - logger.info("[UniLab Register] 设备和资源注册完成.") diff --git a/unilabos/ros/nodes/presets/host_node.py b/unilabos/ros/nodes/presets/host_node.py index f1b7f88..9b598dd 100644 --- a/unilabos/ros/nodes/presets/host_node.py +++ b/unilabos/ros/nodes/presets/host_node.py @@ -22,6 +22,7 @@ from unilabos_msgs.srv import ( ) # type: ignore from unique_identifier_msgs.msg import UUID +from unilabos.app.register import register_devices_and_resources from unilabos.config.config import BasicConfig from unilabos.registry.registry import lab_registry from unilabos.resources.graphio import initialize_resource @@ -150,11 +151,7 @@ class HostNode(BaseROS2DeviceNode): self.device_status_timestamps = {} # 用来存储设备状态最后更新时间 if BasicConfig.upload_registry: from unilabos.app.mq import mqtt_client - - for device_info in lab_registry.obtain_registry_device_info(): - mqtt_client.publish_registry(device_info["id"], device_info) - for resource_info in lab_registry.obtain_registry_resource_info(): - mqtt_client.publish_registry(resource_info["id"], resource_info) + register_devices_and_resources(mqtt_client, lab_registry) else: self.lab_logger().warning("本次启动注册表不报送云端,如果您需要联网调试,请使用unilab-register命令进行单独报送,或者在启动命令增加--upload_registry") time.sleep(1) # 等待MQTT连接稳定