Skip to content

Commit

Permalink
chore: ignore rosbag recorder (#19)
Browse files Browse the repository at this point in the history
* chore: ignore rosbag2_recorder

* chore: organize default layout

Signed-off-by: iwatake2222 <[email protected]>

---------

Signed-off-by: iwatake2222 <[email protected]>
  • Loading branch information
iwatake2222 authored Dec 3, 2024
1 parent cbc7d7e commit 36047f7
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 25 deletions.
32 changes: 24 additions & 8 deletions setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"ignore_unconnected_nodes": true,
"ignore_node_list": [
"/node_name/to_be_ignored/in_regularexpression",
"/wild_card/is/.*"
"/wild_card/is/.*",
"/rosbag2_recorder"
],
"ignore_topic_list": [
"/topic_name/to_be_ignored/in_regularexpression",
Expand All @@ -17,37 +18,52 @@
"group_setting": {
"/sensing": {
"direction": "horizontal",
"offset": [0.0, 1.0, 2.5, 2.0],
"offset": [0.0, 0.0, 2.5, 2.0],
"color": [128, 0, 128]
},
"/localization": {
"direction": "horizontal",
"offset": [0.0, 3.5, 2.5, 2.0],
"offset": [0.0, 2.5, 2.5, 2.0],
"color": [0, 0, 128]
},
"/map": {
"direction": "horizontal",
"offset": [0.0, 4.5, 1.0, 1.0],
"color": [0, 0, 128]
},
"/perception": {
"direction": "horizontal",
"offset": [3.0, 3.5, 4.0, 4.0],
"offset": [3.0, 0.0, 7.0, 3.0],
"color": [0, 128, 0]
},
"/planning": {
"direction": "horizontal",
"offset": [7.0, 0.0, 4.0, 4.0],
"offset": [3.0, 3.0, 4.0, 2.0],
"color": [128, 128, 0]
},
"/control": {
"direction": "horizontal",
"offset": [3.0, -0.8, 3.0, 1.5],
"offset": [8.0, 3.0, 3.0, 1.5],
"color": [196, 64, 0]
},
"/system": {
"direction": "horizontal",
"offset": [-0.5, -0.5, 1.0, 1.0],
"offset": [7.0, 6.0, 1.0, 5.0],
"color": [64, 64, 128]
},
"/adapi": {
"direction": "horizontal",
"offset": [8.0, 6.0, 1.0, 5.0],
"color": [0, 64, 64]
},
"/default_ad_api": {
"direction": "horizontal",
"offset": [9.0, 6.0, 1.0, 2.0],
"color": [0, 64, 64]
},
"__others__": {
"direction": "horizontal",
"offset": [0.5, -0.5, 1.0, 1.0],
"offset": [11.0, 6.0, 2.0, 5.0],
"color": [16, 64, 96]
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/dear_ros_node_viewer/dot2networkx.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def dot2networkx_nodeonly(graph_org: nx.classes.digraph.DiGraph,
graph.add_node(label)

for edge in graph_org.edges:
if 'label' not in graph_org.nodes[edge[0]] or 'label' not in graph_org.nodes[edge[1]] or 'label' not in graph_org.edges[edge]:
continue
node_pub = graph_org.nodes[edge[0]]['label']
node_sub = graph_org.nodes[edge[1]]['label']
label = graph_org.edges[edge]['label']
Expand Down
10 changes: 5 additions & 5 deletions src/dear_ros_node_viewer/graph_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def filter_node(self):
self.graph.remove_nodes_from(remove_node_list)
logger.info('%s nodes are removed by filter', len(remove_node_list))

if self.app_setting['ignore_unconnected_nodes']:
isolated_node_list = list(nx.isolates(self.graph))
logger.info('%s nodes are removed due to isolated', len(isolated_node_list))
self.graph.remove_nodes_from(isolated_node_list)

def filter_topic(self):
"""Remove topics which match filter setting"""
remove_edge_list = []
Expand All @@ -97,11 +102,6 @@ def filter_topic(self):
self.graph.remove_edges_from(remove_edge_list)
logger.info('%s topics are removed by filter', len(remove_edge_list))

if self.app_setting['ignore_unconnected_nodes']:
isolated_node_list = list(nx.isolates(self.graph))
logger.info('%s nodes are removed due to isolated', len(isolated_node_list))
self.graph.remove_nodes_from(isolated_node_list)

def clear_caret_path_dict(self):
""" Clear CARET path dict """
self.caret_path_dict.clear()
Expand Down
10 changes: 6 additions & 4 deletions src/dear_ros_node_viewer/ros2networkx.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,30 @@ def save_graph(self, filename: str = None) -> str:
time.sleep(5)
graph = Graph(self.node_)
graph.set_node_stale(5.0)
logger.info('graph.update start')
graph.update()
logger.info('graph.update done')

dotcode_generator = RosGraphDotcodeGenerator(self.node_)
logger.info('generate_dotcode start')
dotcode = dotcode_generator.generate_dotcode(
rosgraphinst=graph,
ns_filter='',
ns_filter='-/rosbag2_recorder',
topic_filter='',
# graph_mode='node_topic',
graph_mode='node_node',
hide_single_connection_topics=True,
hide_single_connection_topics=False,
hide_dead_end_topics=True,
cluster_namespaces_level=0,
# accumulate_actions=accumulate_actions,
dotcode_factory=PydotFactory(),
# orientation=orientation,
quiet=True,
unreachable=True,
group_tf_nodes=True,
hide_tf_nodes=True,
# group_image_nodes=group_image_nodes,
hide_dynamic_reconfigure=True
)
logger.info('generate_dotcode done')

if filename:
with open(filename, encoding='UTF8', mode='w') as dot_file:
Expand Down
32 changes: 24 additions & 8 deletions src/dear_ros_node_viewer/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"ignore_unconnected_nodes": true,
"ignore_node_list": [
"/node_name/to_be_ignored/in_regularexpression",
"/wild_card/is/.*"
"/wild_card/is/.*",
"/rosbag2_recorder"
],
"ignore_topic_list": [
"/topic_name/to_be_ignored/in_regularexpression",
Expand All @@ -17,37 +18,52 @@
"group_setting": {
"/sensing": {
"direction": "horizontal",
"offset": [0.0, 1.0, 2.5, 2.0],
"offset": [0.0, 0.0, 2.5, 2.0],
"color": [128, 0, 128]
},
"/localization": {
"direction": "horizontal",
"offset": [0.0, 3.5, 2.5, 2.0],
"offset": [0.0, 2.5, 2.5, 2.0],
"color": [0, 0, 128]
},
"/map": {
"direction": "horizontal",
"offset": [0.0, 4.5, 1.0, 1.0],
"color": [0, 0, 128]
},
"/perception": {
"direction": "horizontal",
"offset": [3.0, 3.5, 4.0, 4.0],
"offset": [3.0, 0.0, 7.0, 3.0],
"color": [0, 128, 0]
},
"/planning": {
"direction": "horizontal",
"offset": [7.0, 0.0, 4.0, 4.0],
"offset": [3.0, 3.0, 4.0, 2.0],
"color": [128, 128, 0]
},
"/control": {
"direction": "horizontal",
"offset": [3.0, -0.8, 3.0, 1.5],
"offset": [8.0, 3.0, 3.0, 1.5],
"color": [196, 64, 0]
},
"/system": {
"direction": "horizontal",
"offset": [-0.5, -0.5, 1.0, 1.0],
"offset": [7.0, 6.0, 1.0, 5.0],
"color": [64, 64, 128]
},
"/adapi": {
"direction": "horizontal",
"offset": [8.0, 6.0, 1.0, 5.0],
"color": [0, 64, 64]
},
"/default_ad_api": {
"direction": "horizontal",
"offset": [9.0, 6.0, 1.0, 2.0],
"color": [0, 64, 64]
},
"__others__": {
"direction": "horizontal",
"offset": [0.5, -0.5, 1.0, 1.0],
"offset": [11.0, 6.0, 2.0, 5.0],
"color": [16, 64, 96]
}
}
Expand Down

0 comments on commit 36047f7

Please sign in to comment.