mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
fix: slave mode spin not working
This commit is contained in:
@@ -2,11 +2,9 @@ import copy
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
|
||||||
from typing import Optional, Dict, Any, List
|
from typing import Optional, Dict, Any, List
|
||||||
|
|
||||||
import rclpy
|
import rclpy
|
||||||
from rclpy.callback_groups import ReentrantCallbackGroup
|
|
||||||
from unilabos_msgs.msg import Resource # type: ignore
|
from unilabos_msgs.msg import Resource # type: ignore
|
||||||
from unilabos_msgs.srv import ResourceAdd, SerialCommand # type: ignore
|
from unilabos_msgs.srv import ResourceAdd, SerialCommand # type: ignore
|
||||||
from rclpy.executors import MultiThreadedExecutor
|
from rclpy.executors import MultiThreadedExecutor
|
||||||
@@ -67,6 +65,9 @@ def main(
|
|||||||
thread = threading.Thread(target=executor.spin, daemon=True, name="host_executor_thread")
|
thread = threading.Thread(target=executor.spin, daemon=True, name="host_executor_thread")
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
input()
|
||||||
|
|
||||||
|
|
||||||
def slave(
|
def slave(
|
||||||
devices_config: Dict[str, Any] = {},
|
devices_config: Dict[str, Any] = {},
|
||||||
@@ -120,6 +121,8 @@ def slave(
|
|||||||
response = rclient.call_async(request).result()
|
response = rclient.call_async(request).result()
|
||||||
logger.info(f"Slave resource added.")
|
logger.info(f"Slave resource added.")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
input()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ class PyLabRobotCreator(DeviceClassCreator[T]):
|
|||||||
from unilabos.ros.nodes.base_device_node import ROS2DeviceNode
|
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} 设置完成"))
|
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]):
|
class ProtocolNodeCreator(DeviceClassCreator[T]):
|
||||||
"""
|
"""
|
||||||
ProtocolNode设备类创建器
|
ProtocolNode设备类创建器
|
||||||
|
|||||||
Reference in New Issue
Block a user