mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 21:11:12 +00:00
fix: running logic
This commit is contained in:
@@ -29,7 +29,9 @@ def start_backend(
|
||||
|
||||
backend_thread = threading.Thread(
|
||||
target=main if not without_host else slave,
|
||||
args=(devices_config, resources_config, graph, controllers_config, bridges)
|
||||
args=(devices_config, resources_config, graph, controllers_config, bridges),
|
||||
name="backend_thread",
|
||||
daemon=True,
|
||||
)
|
||||
backend_thread.start()
|
||||
logger.info(f"Backend {backend} started.")
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import argparse
|
||||
import asyncio
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
|
||||
import yaml
|
||||
from copy import deepcopy
|
||||
import threading
|
||||
@@ -125,7 +128,7 @@ def main():
|
||||
print_unilab_banner(args_dict)
|
||||
|
||||
# 注册表
|
||||
registry_dict = build_registry(args_dict["registry_path"])
|
||||
build_registry(args_dict["registry_path"])
|
||||
|
||||
|
||||
if args_dict["graph"] is not None:
|
||||
@@ -180,14 +183,17 @@ def main():
|
||||
enable_rviz=True
|
||||
elif args_dict["visual"] == "web":
|
||||
enable_rviz=False
|
||||
resource_visualization = ResourceVisualization(devices_and_resources, args_dict["resources_config"],registry_dict,enable_rviz=enable_rviz)
|
||||
resource_visualization = ResourceVisualization(devices_and_resources, args_dict["resources_config"] ,enable_rviz=enable_rviz)
|
||||
devices_config_add = add_resource_mesh_manager_node(resource_visualization.resource_model, args_dict["resources_config"])
|
||||
args_dict["devices_config"] = {**args_dict["devices_config"], **devices_config_add}
|
||||
|
||||
server_thread = threading.Thread(target=start_server)
|
||||
server_thread.start()
|
||||
start_backend(**args_dict)
|
||||
|
||||
from unilabos.ros.nodes.base_device_node import ROS2DeviceNode
|
||||
while ROS2DeviceNode.get_loop() is None:
|
||||
time.sleep(0.1)
|
||||
asyncio.set_event_loop(ROS2DeviceNode.get_loop())
|
||||
resource_visualization.start()
|
||||
start_server()
|
||||
else:
|
||||
start_backend(**args_dict)
|
||||
start_server()
|
||||
|
||||
@@ -35,7 +35,8 @@ class MQTTClient:
|
||||
self.client.on_disconnect = self._on_disconnect
|
||||
|
||||
def _on_log(self, client, userdata, level, buf):
|
||||
logger.info(f"[MQTT] log: {buf}")
|
||||
# logger.info(f"[MQTT] log: {buf}")
|
||||
pass
|
||||
|
||||
def _on_connect(self, client, userdata, flags, rc, properties=None):
|
||||
logger.info("[MQTT] Connected with result code " + str(rc))
|
||||
|
||||
Reference in New Issue
Block a user