mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-10 17:55:12 +00:00
fix container value
add parent_name to edge device id
This commit is contained in:
@@ -486,20 +486,17 @@
|
|||||||
"name": "气源",
|
"name": "气源",
|
||||||
"children": [],
|
"children": [],
|
||||||
"parent": "ComprehensiveProtocolStation",
|
"parent": "ComprehensiveProtocolStation",
|
||||||
"type": "device",
|
"type": "container",
|
||||||
"class": "container",
|
"class": "container",
|
||||||
"position": {
|
"position": {
|
||||||
"x": 650,
|
"x": 650,
|
||||||
"y": 150,
|
"y": 150,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {},
|
||||||
|
"data": {
|
||||||
"gas_type": "nitrogen",
|
"gas_type": "nitrogen",
|
||||||
"max_pressure": 5.0
|
"max_pressure": 5.0
|
||||||
},
|
|
||||||
"data": {
|
|
||||||
"status": "Off",
|
|
||||||
"current_pressure": 0.0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -543,7 +543,6 @@ virtual_transfer_pump:
|
|||||||
current_volume: Float64
|
current_volume: Float64
|
||||||
max_volume: Float64
|
max_volume: Float64
|
||||||
transfer_rate: Float64
|
transfer_rate: Float64
|
||||||
from_vessel: String
|
|
||||||
action_value_mappings:
|
action_value_mappings:
|
||||||
transfer:
|
transfer:
|
||||||
type: Transfer
|
type: Transfer
|
||||||
|
|||||||
@@ -193,15 +193,20 @@ class HostNode(BaseROS2DeviceNode):
|
|||||||
)
|
)
|
||||||
resource_with_parent_name = []
|
resource_with_parent_name = []
|
||||||
resource_ids_to_instance = {i["id"]: i for i in resources_config}
|
resource_ids_to_instance = {i["id"]: i for i in resources_config}
|
||||||
|
resource_name_to_with_parent_name = {}
|
||||||
for res in resources_config:
|
for res in resources_config:
|
||||||
if res.get("parent") and res.get("type") == "device" and res.get("class"):
|
if res.get("parent") and res.get("type") == "device" and res.get("class"):
|
||||||
parent_id = res.get("parent")
|
parent_id = res.get("parent")
|
||||||
parent_res = resource_ids_to_instance[parent_id]
|
parent_res = resource_ids_to_instance[parent_id]
|
||||||
if parent_res.get("type") == "device" and parent_res.get("class"):
|
if parent_res.get("type") == "device" and parent_res.get("class"):
|
||||||
resource_with_parent_name.append(copy.deepcopy(res))
|
resource_with_parent_name.append(copy.deepcopy(res))
|
||||||
|
resource_name_to_with_parent_name[resource_with_parent_name[-1]["id"]] = f"{parent_res['id']}/{res['id']}"
|
||||||
resource_with_parent_name[-1]["id"] = f"{parent_res['id']}/{res['id']}"
|
resource_with_parent_name[-1]["id"] = f"{parent_res['id']}/{res['id']}"
|
||||||
continue
|
continue
|
||||||
resource_with_parent_name.append(copy.deepcopy(res))
|
resource_with_parent_name.append(copy.deepcopy(res))
|
||||||
|
for edge in self.resources_edge_config:
|
||||||
|
edge["source"] = resource_name_to_with_parent_name.get(edge.get("source"), edge.get("source"))
|
||||||
|
edge["target"] = resource_name_to_with_parent_name.get(edge.get("target"), edge.get("target"))
|
||||||
try:
|
try:
|
||||||
for bridge in self.bridges:
|
for bridge in self.bridges:
|
||||||
if hasattr(bridge, "resource_add"):
|
if hasattr(bridge, "resource_add"):
|
||||||
|
|||||||
Reference in New Issue
Block a user