fix: cloud bridge error fallback to local

This commit is contained in:
wznln
2025-05-07 00:31:05 +08:00
parent 5df304bc64
commit 3d60cb36b8
3 changed files with 3 additions and 2 deletions

View File

View File

@@ -5,7 +5,7 @@ import time
from rclpy.executors import MultiThreadedExecutor from rclpy.executors import MultiThreadedExecutor
from rclpy.action import ActionServer from rclpy.action import ActionServer
from sensor_msgs.msg import JointState from sensor_msgs.msg import JointState
from ilabos_msgs.action import SendCmd from unilabos_msgs.action import SendCmd
from rclpy.action.server import ServerGoalHandle from rclpy.action.server import ServerGoalHandle
from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode from unilabos.ros.nodes.base_device_node import BaseROS2DeviceNode
from tf_transformations import quaternion_from_euler from tf_transformations import quaternion_from_euler

View File

@@ -643,7 +643,8 @@ class HostNode(BaseROS2DeviceNode):
self.lab_logger().debug(f"[Host Node-Resource] Retrieved from bridge: {len(r)} resources") self.lab_logger().debug(f"[Host Node-Resource] Retrieved from bridge: {len(r)} resources")
except Exception as e: except Exception as e:
self.lab_logger().error(f"[Host Node-Resource] Error retrieving from bridge: {str(e)}") self.lab_logger().error(f"[Host Node-Resource] Error retrieving from bridge: {str(e)}")
r = [] r = [resource for resource in self.resources_config if resource.get("id") == request.id]
self.lab_logger().warning(f"[Host Node-Resource] Retrieved from local: {len(r)} resources")
else: else:
# 本地物料服务,根据 id 查询物料 # 本地物料服务,根据 id 查询物料
r = [resource for resource in self.resources_config if resource.get("id") == request.id] r = [resource for resource in self.resources_config if resource.get("id") == request.id]