try fix add protocol

This commit is contained in:
Xuwznln
2025-09-19 06:21:29 +08:00
parent 6f8f070f40
commit 2eaa0ca729
4 changed files with 3 additions and 10 deletions

View File

@@ -169,7 +169,7 @@ def generate_add_protocol(
# 固体加样 # 固体加样
add_kwargs = { add_kwargs = {
"vessel": vessel_id, # 🔧 使用 vessel_id "vessel": {"id": vessel_id}, # 🔧 使用 vessel_id
"reagent": reagent, "reagent": reagent,
"purpose": purpose, "purpose": purpose,
"event": event, "event": event,

View File

@@ -636,11 +636,8 @@ class HostNode(BaseROS2DeviceNode):
向设备发送目标请求 向设备发送目标请求
Args: Args:
device_id: 设备ID
action_type: 动作类型 action_type: 动作类型
action_name: 动作名称
action_kwargs: 动作参数 action_kwargs: 动作参数
goal_uuid: 目标UUID如果为None则自动生成
server_info: 服务器发送信息,包含发送时间戳等 server_info: 服务器发送信息,包含发送时间戳等
""" """
u = uuid.UUID(item.job_id) u = uuid.UUID(item.job_id)

View File

@@ -191,12 +191,11 @@ class ROS2ProtocolNode(BaseROS2DeviceNode):
execution_error = "" execution_error = ""
execution_success = False execution_success = False
protocol_return_value = None protocol_return_value = None
self.get_logger().info(f"Executing {protocol_name} action...") self.lab_logger().info(f"Executing {protocol_name} action...")
action_value_mapping = self._action_value_mappings[protocol_name] action_value_mapping = self._action_value_mappings[protocol_name]
step_results = [] step_results = []
try: try:
print("+" * 30) self.lab_logger().warning("+" * 30)
print(protocol_steps_generator)
# 从目标消息中提取参数, 并调用Protocol生成器(根据设备连接图)生成action步骤 # 从目标消息中提取参数, 并调用Protocol生成器(根据设备连接图)生成action步骤
goal = goal_handle.request goal = goal_handle.request
protocol_kwargs = convert_from_ros_msg_with_mapping(goal, action_value_mapping["goal"]) protocol_kwargs = convert_from_ros_msg_with_mapping(goal, action_value_mapping["goal"])

View File

@@ -284,9 +284,6 @@ class ProtocolNodeCreator(DeviceClassCreator[T]):
""" """
super().__init__(cls, children, resource_tracker) super().__init__(cls, children, resource_tracker)
def attach_resource(self):
pass # WorkstationNode不直接附加资源
def create_instance(self, data: Dict[str, Any]) -> T: def create_instance(self, data: Dict[str, Any]) -> T:
""" """
从数据创建ProtocolNode设备实例 从数据创建ProtocolNode设备实例