Skip to content

Commit

Permalink
chore: ignore rosbag2_recorder
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatake2222 committed Dec 2, 2024
1 parent cbc7d7e commit 7189239
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion 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 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
3 changes: 2 additions & 1 deletion 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 Down

0 comments on commit 7189239

Please sign in to comment.