Skip to content

Commit

Permalink
add artifact name when parse runtime system
Browse files Browse the repository at this point in the history
  • Loading branch information
ipa-rwu committed Feb 15, 2024
1 parent ff28046 commit 997e6ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ros2model/api/runtime_parser/rossystem_runtime_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
)
import ros2model.core.metamodels.metamodel_ros as ROSModel
from pathlib import Path
from ros2model.core.utils import find_process_by_node_name


class RuntimeRossystem(ROSModel.Rossystem):
Expand All @@ -17,9 +18,14 @@ def get_nodes(self):
nodes = get_node_graph_names()
for n in nodes:
print("node name: ", n.namespace, n.name, n.full_name)
_, artifact = find_process_by_node_name(n.name, n.namespace)

parsed_node = parse(
ROSModel.GraphName(
name=n.name, namespace=n.namespace, full_name=n.full_name
name=n.name,
namespace=n.namespace,
full_name=n.full_name,
ref_name=f"{artifact}.{n.full_name}",
)
)
self.nodes.append(parsed_node)
Expand Down
1 change: 1 addition & 0 deletions ros2model/core/metamodels/metamodel_ros.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class GraphName(BaseModel):
name: str
namespace: str
full_name: Optional[str] = None
ref_name: Optional[str] = None

@field_validator("full_name")
def set_full_name(cls, v: str, info: ValidationInfo) -> str:
Expand Down
2 changes: 1 addition & 1 deletion templates/rossystem.rossystem.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
nodes:
{% for node in model.nodes %}
"{{ node.name.full_name }}":
from: "TODO.{{ node.name.full_name }}"
from: "{{ node.name.ref_name }}"
{% if node.publisher | length > 0 or node.subscriber | length > 0 or node.actionserver | length > 0 or node.actionclient | length > 0 or node.serviceserver | length > 0 or node.serviceclient | length > 0%}
interfaces:
{% for interface in node.publisher %}
Expand Down

0 comments on commit 997e6ba

Please sign in to comment.