diff --git a/setting.json b/setting.json index 659cad1..5880c35 100644 --- a/setting.json +++ b/setting.json @@ -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", diff --git a/src/dear_ros_node_viewer/dot2networkx.py b/src/dear_ros_node_viewer/dot2networkx.py index ac3823d..1ddbbf9 100644 --- a/src/dear_ros_node_viewer/dot2networkx.py +++ b/src/dear_ros_node_viewer/dot2networkx.py @@ -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'] diff --git a/src/dear_ros_node_viewer/graph_manager.py b/src/dear_ros_node_viewer/graph_manager.py index 97fc910..402fa2e 100644 --- a/src/dear_ros_node_viewer/graph_manager.py +++ b/src/dear_ros_node_viewer/graph_manager.py @@ -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 = [] @@ -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() diff --git a/src/dear_ros_node_viewer/ros2networkx.py b/src/dear_ros_node_viewer/ros2networkx.py index 845ce8e..ca0d581 100644 --- a/src/dear_ros_node_viewer/ros2networkx.py +++ b/src/dear_ros_node_viewer/ros2networkx.py @@ -60,16 +60,19 @@ 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, @@ -77,11 +80,10 @@ def save_graph(self, filename: str = None) -> str: # 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: diff --git a/src/dear_ros_node_viewer/setting.json b/src/dear_ros_node_viewer/setting.json index 659cad1..5880c35 100644 --- a/src/dear_ros_node_viewer/setting.json +++ b/src/dear_ros_node_viewer/setting.json @@ -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",