修复可能的web template找不到的问题

新增联网获取json启动
删除非-g传入启动json的方式
兼容传参参数名短横线与下划线
更新版本到0.10.1
修复Upload Registry镜像不匹配
This commit is contained in:
Xuwznln
2025-07-31 19:12:22 +08:00
parent 2b3cec5640
commit 2580e80d6f
13 changed files with 132 additions and 66 deletions

View File

@@ -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] 设备和资源注册完成.")

View File

@@ -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连接稳定