diff --git a/unilabos/ros/main_slave_run.py b/unilabos/ros/main_slave_run.py index 60dc189e..15265c4d 100644 --- a/unilabos/ros/main_slave_run.py +++ b/unilabos/ros/main_slave_run.py @@ -2,11 +2,9 @@ import copy import json import os import threading -import traceback from typing import Optional, Dict, Any, List import rclpy -from rclpy.callback_groups import ReentrantCallbackGroup from unilabos_msgs.msg import Resource # type: ignore from unilabos_msgs.srv import ResourceAdd, SerialCommand # type: ignore from rclpy.executors import MultiThreadedExecutor @@ -67,6 +65,9 @@ def main( thread = threading.Thread(target=executor.spin, daemon=True, name="host_executor_thread") thread.start() + while True: + input() + def slave( devices_config: Dict[str, Any] = {}, @@ -120,6 +121,8 @@ def slave( response = rclient.call_async(request).result() logger.info(f"Slave resource added.") + while True: + input() if __name__ == "__main__": main() diff --git a/unilabos/ros/utils/driver_creator.py b/unilabos/ros/utils/driver_creator.py index 24c98b21..2ea30856 100644 --- a/unilabos/ros/utils/driver_creator.py +++ b/unilabos/ros/utils/driver_creator.py @@ -225,6 +225,7 @@ class PyLabRobotCreator(DeviceClassCreator[T]): from unilabos.ros.nodes.base_device_node import ROS2DeviceNode ROS2DeviceNode.run_async_func(getattr(self.device_instance, "setup")).add_done_callback(lambda x: logger.debug(f"PyLabRobot设备实例 {self.device_instance} 设置完成")) + class ProtocolNodeCreator(DeviceClassCreator[T]): """ ProtocolNode设备类创建器