-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added nested subnamespaces and more options to hide or group topics. #13
Added nested subnamespaces and more options to hide or group topics. #13
Conversation
The "Group Namespaces" checkbox has been replaced with a numeric spinner, where the user can specify the desired layers of depth.
…ompressedDepth) image_fix
Parameter topics include /parameter_descriptions and /parameter_updates.
@dirk-thomas These changes have gone 22 days since they have been revised and split into separate requests with no response. Overall, they provide significant improvements to the user experience and I would like them to be implemented as soon as possible. |
@mastereric The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new feature looks very nice on more complex graphs 👍
I added some comments inline - mostly nitpicks.
Beside them the toolbar looks a bit off for me:
- the spacing between the three horizontal layouts is not equal
- the second and third "row" seems to be indented (not sure if that was the case before already?)
- the "highlight" and "fit" label in the second "row" is not aligned with the other options in that "row"
src/rqt_graph/dotcode.py
Outdated
@@ -420,6 +428,136 @@ def _accumulate_action_topics(self, nodes_in, edges_in, node_connections): | |||
nodes.remove(n) | |||
return nodes, edges, action_nodes | |||
|
|||
def _populate_node_graph(self, cluster_namespaces_level, node_list, dotcode_factory, dotgraph, rank, orientation, simplify): | |||
namespace_clusters = {} | |||
if (cluster_namespaces_level > 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove parenthesis around the condition.
Same below.
src/rqt_graph/dotcode.py
Outdated
if (cluster_namespaces_level > 0): | ||
for node in node_list: | ||
if (str(node.strip()).count('/') > 2): | ||
for i in range(2, min(2+cluster_namespaces_level, len(node.strip().split('/')))): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add spaces around operators.
Same below.
src/rqt_graph/dotcode.py
Outdated
for n in removal_nodes: | ||
if n in nodes: | ||
nodes.remove(n) | ||
if len(tf_topic_edges_in) == 0 and len(tf_topic_edges_out) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More Pythonic: if not tf_topic_edges_in and not tf_topic_edges_out:
src/rqt_graph/dotcode.py
Outdated
parent_namespace = '/'.join(node.strip().split('/')[:i-1]) | ||
if namespace not in namespace_clusters: | ||
if parent_namespace == '': | ||
namespace_clusters[namespace] = dotcode_factory.add_subgraph_to_graph(dotgraph, namespace, rank=rank, rankdir=orientation, simplify=simplify) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove trailing whitespace.
src/rqt_graph/dotcode.py
Outdated
edges where the edges to tf topics have been removed, and | ||
a map with all the connections to the resulting tf group node''' | ||
removal_nodes = [] | ||
tf_nodes = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigned but never used?
src/rqt_graph/dotcode.py
Outdated
edges, | ||
node_connections, | ||
hide_single_connection_topics, | ||
hide_dead_end_topics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid arbitrary indentation (even though it was that way before your patch 😉). Either indent up to the open parenthesis or wrap directly after the parenthesis and indent all argument just one level / 4 spaces. The second option is preferred since it avoids the long indentation.
Same below.
src/rqt_graph/dotcode.py
Outdated
namespace_clusters = self._populate_node_graph(cluster_namespaces_level, (nt_nodes or []) | ||
+ [action_prefix + ACTION_TOPICS_SUFFIX for (action_prefix, _) in action_nodes.items()] | ||
+ [image_prefix + IMAGE_TOPICS_SUFFIX for (image_prefix, _) in image_nodes.items()] | ||
+ nn_nodes if nn_nodes is not None else [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap after the open parenthesis and make the operators trailing the previous lines.
src/rqt_graph/dotcode.py
Outdated
# cluster topics with same namespace | ||
if (cluster_namespaces_level > 0 and | ||
n.strip().count('/') > 1 and | ||
len(n.strip().split('/')[1]) > 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the indentation level doesn't allow to distinguish the condition from the block. Instead use:
if (
cluster_namespaces_level > 0 and
n.strip().count('/') > 1 and
len(n.strip().split('/')[1]) > 0
):
...
Same below.
src/rqt_graph/dotcode.py
Outdated
else: | ||
namespace = '/'.join(n.strip().split('/')[:cluster_namespaces_level+1]) | ||
if namespace not in namespace_clusters: | ||
print("Namespace '"+namespace+"' not found.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this happen? Is that an error?
Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were cases where namespace
was not in namespace_clusters
during testing; this line will be removed.
src/rqt_graph/dotcode.py
Outdated
print("Namespace '"+namespace+"' not found.") | ||
self._add_topic_node_group('n'+n, dotcode_factory=dotcode_factory, dotgraph=namespace_clusters[namespace], quiet=quiet) | ||
else: | ||
self._add_topic_node_group('n'+n, dotcode_factory=dotcode_factory, dotgraph=dotgraph, quiet=quiet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three loops look partially very similar. Maybe the code would get shorter by refactoring some of this into a helper function?
Update: and a fourth time below.
This repo only has a single I would rather not create separate branches in this repo for this feature but that would require to backport the |
Hey @dirk-thomas, |
@dirk-thomas If the latest pull request ros-visualization/qt_gui_core#117 is approved promptly, do you think the changes to rqt_graph can be approved in time for the long-term supported Melodic release? |
@ros-pull-request-builder retest this please |
package.xml
Outdated
@@ -23,7 +23,7 @@ | |||
|
|||
<run_depend version_gte="0.2.19">python_qt_binding</run_depend> | |||
<run_depend>python-rospkg</run_depend> | |||
<run_depend>qt_dotgraph</run_depend> | |||
<run_depend version_gte="0.3.8">qt_dotgraph</run_depend> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version dependency won't work for Indigo where the next patch release will be 0.2.x. I will remove it from the patch.
With the Thank you for the contribution. |
ros-visualization#13) * pyqtgraph < 0.10 fail to run `from pyqtgraph import __version__ `, use pkg_resources ``` $ rqt_plot /joint_state/position[0] Traceback (most recent call last): File "/opt/ros/kinetic/bin/rqt_plot", line 6, in <module> from rqt_plot.plot import Plot File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_plot/plot.py", line 43, in <module> from .data_plot import DataPlot File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_plot/data_plot/__init__.py", line 44, in <module> from .pyqtgraph_data_plot import PyQtGraphDataPlot File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_plot/data_plot/pyqtgraph_data_plot.py", line 46, in <module> from pyqtgraph import __version__ as pyqtgraph_version File "/usr/lib/python2.7/dist-packages/pyqtgraph/__init__.py", line 13, in <module> from .Qt import QtGui File "/usr/lib/python2.7/dist-packages/pyqtgraph/Qt.py", line 104, in <module> from PyQt4 import QtGui, QtCore, uic RuntimeError: the PyQt4.QtCore and PyQt5.QtCore modules both wrap the QObject class ``` * cath RuntimeError and add a comment when it is expected to be raised.
rqt_graph has had a long-standing problem; in real use cases, graphs quickly become unwieldy and unreadable, with dynamic reconfigure's parameter topics everywhere, and don't even start with images.
This pull request aims to solve these problems with several changes, including:
These changes, originally implemented in #9, have been split into six separate commits, with formatting changes removed, for ease of review.
These changes are dependent on pull request ros-visualization/qt_gui_core#87.
Note that the Hide section of the toolbar has been shifted down to a new line, and margins have been changed as the creation of a new line caused spacing problems.
Three files are attached to this pull request; the launch file I used for testing, a before picture, and an after picture, displaying what rqt_graph looks like before and after the changes.
Attachments(1).zip