mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
Closes #3. Closes #12. * Update README and MQTTClient for installation instructions and code improvements * feat: 支持local_config启动 add: 增加对crt path的说明,为传入config.py的相对路径 move: web component * add: registry description * 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/ * fix: device.class possible null * fix: HPLC additions with online service * fix: slave mode spin not working * fix: slave mode spin not working * feat: 多ProtocolNode 允许子设备ID相同 feat: 上报发现的ActionClient feat: Host重启动,通过discover机制要求slaveNode重新注册,实现信息及时上报 --------- Co-authored-by: Harvey Que <Q-Query@outlook.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -6,8 +7,9 @@ from typing import Any
|
||||
import yaml
|
||||
|
||||
from unilabos.utils import logger
|
||||
from unilabos.ros.msgs.message_converter import msg_converter_manager
|
||||
from unilabos.ros.msgs.message_converter import msg_converter_manager, ros_action_to_json_schema
|
||||
from unilabos.utils.decorator import singleton
|
||||
from unilabos.utils.type_check import TypeEncoder
|
||||
|
||||
DEFAULT_PATHS = [Path(__file__).absolute().parent]
|
||||
|
||||
@@ -129,6 +131,7 @@ class Registry:
|
||||
action_config["type"] = self._replace_type_with_class(
|
||||
action_config["type"], device_id, f"动作 {action_name}"
|
||||
)
|
||||
action_config["schema"] = ros_action_to_json_schema(action_config["type"])
|
||||
|
||||
self.device_type_registry.update(data)
|
||||
|
||||
@@ -143,6 +146,16 @@ class Registry:
|
||||
f"[UniLab Registry] Device File-{i+1}/{len(files)} Not Valid YAML File: {file.absolute()}"
|
||||
)
|
||||
|
||||
def obtain_registry_device_info(self):
|
||||
devices = []
|
||||
for device_id, device_info in self.device_type_registry.items():
|
||||
msg = {
|
||||
"id": device_id,
|
||||
**device_info
|
||||
}
|
||||
devices.append(msg)
|
||||
return devices
|
||||
|
||||
|
||||
# 全局单例实例
|
||||
lab_registry = Registry()
|
||||
|
||||
Reference in New Issue
Block a user