mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-04 05:15:10 +00:00
Compare commits
3 Commits
7eacae6442
...
400bb073d4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
400bb073d4 | ||
|
|
3f63c36505 | ||
|
|
0ae94f7f3c |
@@ -9745,21 +9745,21 @@ liquid_handler.prcxi:
|
|||||||
- 0
|
- 0
|
||||||
handles:
|
handles:
|
||||||
input:
|
input:
|
||||||
- data_key: liquid
|
- data_key: sources
|
||||||
data_source: handle
|
data_source: handle
|
||||||
data_type: resource
|
data_type: resource
|
||||||
handler_key: sources
|
handler_key: sources_identifier
|
||||||
label: sources
|
label: 待移动液体
|
||||||
- data_key: liquid
|
- data_key: targets
|
||||||
data_source: executor
|
data_source: handle
|
||||||
data_type: resource
|
data_type: resource
|
||||||
handler_key: targets
|
handler_key: targets_identifier
|
||||||
label: targets
|
label: 转移目标
|
||||||
- data_key: liquid
|
- data_key: tip_rack
|
||||||
data_source: executor
|
data_source: handle
|
||||||
data_type: resource
|
data_type: resource
|
||||||
handler_key: tip_rack
|
handler_key: tip_rack_identifier
|
||||||
label: tip_rack
|
label: 墙头盒
|
||||||
output:
|
output:
|
||||||
- data_key: liquid
|
- data_key: liquid
|
||||||
data_source: handle
|
data_source: handle
|
||||||
|
|||||||
@@ -1319,19 +1319,32 @@ class BaseROS2DeviceNode(Node, Generic[T]):
|
|||||||
resource_inputs = action_kwargs[k] if is_sequence else [action_kwargs[k]]
|
resource_inputs = action_kwargs[k] if is_sequence else [action_kwargs[k]]
|
||||||
|
|
||||||
# 批量查询资源
|
# 批量查询资源
|
||||||
queried_resources = []
|
queried_resources: list = [None] * len(resource_inputs)
|
||||||
for resource_data in resource_inputs:
|
uuid_indices: list[tuple[int, str, dict]] = [] # (index, uuid, resource_data)
|
||||||
|
|
||||||
|
# 第一遍:处理没有uuid的资源,收集有uuid的资源信息
|
||||||
|
for idx, resource_data in enumerate(resource_inputs):
|
||||||
unilabos_uuid = resource_data.get("data", {}).get("unilabos_uuid")
|
unilabos_uuid = resource_data.get("data", {}).get("unilabos_uuid")
|
||||||
if unilabos_uuid is None:
|
if unilabos_uuid is None:
|
||||||
plr_resource = await self.get_resource_with_dir(
|
plr_resource = await self.get_resource_with_dir(
|
||||||
resource_id=resource_data["id"], with_children=True
|
resource_id=resource_data["id"], with_children=True
|
||||||
)
|
)
|
||||||
|
if "sample_id" in resource_data:
|
||||||
|
plr_resource.unilabos_extra["sample_uuid"] = resource_data["sample_id"]
|
||||||
|
queried_resources[idx] = plr_resource
|
||||||
else:
|
else:
|
||||||
resource_tree = await self.get_resource([unilabos_uuid])
|
uuid_indices.append((idx, unilabos_uuid, resource_data))
|
||||||
plr_resource = resource_tree.to_plr_resources()[0]
|
|
||||||
if "sample_id" in resource_data:
|
# 第二遍:批量查询有uuid的资源
|
||||||
plr_resource.unilabos_extra["sample_uuid"] = resource_data["sample_id"]
|
if uuid_indices:
|
||||||
queried_resources.append(plr_resource)
|
uuids = [item[1] for item in uuid_indices]
|
||||||
|
resource_tree = await self.get_resource(uuids)
|
||||||
|
plr_resources = resource_tree.to_plr_resources()
|
||||||
|
for i, (idx, _, resource_data) in enumerate(uuid_indices):
|
||||||
|
plr_resource = plr_resources[i]
|
||||||
|
if "sample_id" in resource_data:
|
||||||
|
plr_resource.unilabos_extra["sample_uuid"] = resource_data["sample_id"]
|
||||||
|
queried_resources[idx] = plr_resource
|
||||||
|
|
||||||
self.lab_logger().debug(f"资源查询结果: 共 {len(queried_resources)} 个资源")
|
self.lab_logger().debug(f"资源查询结果: 共 {len(queried_resources)} 个资源")
|
||||||
|
|
||||||
|
|||||||
@@ -808,6 +808,7 @@ class HostNode(BaseROS2DeviceNode):
|
|||||||
goal_msg = convert_to_ros_msg(action_client._action_type.Goal(), action_kwargs)
|
goal_msg = convert_to_ros_msg(action_client._action_type.Goal(), action_kwargs)
|
||||||
|
|
||||||
self.lab_logger().info(f"[Host Node] Sending goal for {action_id}: {str(goal_msg)[:1000]}")
|
self.lab_logger().info(f"[Host Node] Sending goal for {action_id}: {str(goal_msg)[:1000]}")
|
||||||
|
self.lab_logger().trace(f"[Host Node] Sending goal for {action_id}: {action_kwargs}")
|
||||||
self.lab_logger().trace(f"[Host Node] Sending goal for {action_id}: {goal_msg}")
|
self.lab_logger().trace(f"[Host Node] Sending goal for {action_id}: {goal_msg}")
|
||||||
action_client.wait_for_server()
|
action_client.wait_for_server()
|
||||||
goal_uuid_obj = UUID(uuid=list(u.bytes))
|
goal_uuid_obj = UUID(uuid=list(u.bytes))
|
||||||
|
|||||||
Reference in New Issue
Block a user