ros-visualization / rqt_graph

http://wiki.ros.org/rqt_graph
26 stars 27 forks source link

Fix error when using rqt_graph with Python 3 with compressed image topics present #16

Closed kartikmohta closed 6 years ago

kartikmohta commented 6 years ago

Better fix for the issue reported in https://github.com/ros/ros_comm/pull/1457.

When using rqt_graph with Python 3 with compressed image topics present, it leads to the error:

PluginHandlerDirect._restore_settings() plugin "rqt_graph/RosGraph#0" raised an exception:
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python3.6/site-packages/qt_gui/plugin_handler_direct.py", line 116, in _restore_settings
    self._plugin.restore_settings(plugin_settings_plugin, instance_settings_plugin)
  File "/opt/ros/melodic/lib/python3.6/site-packages/rqt_graph/ros_graph.py", line 217, in restore_settings
    self._refresh_rosgraph()
  File "/opt/ros/melodic/lib/python3.6/site-packages/rqt_graph/ros_graph.py", line 246, in _refresh_rosgraph
    self._update_graph_view(self._generate_dotcode())
  File "/opt/ros/melodic/lib/python3.6/site-packages/rqt_graph/ros_graph.py", line 280, in _generate_dotcode
    hide_dynamic_reconfigure=hide_dynamic_reconfigure)
  File "/opt/ros/melodic/lib/python3.6/site-packages/rqt_graph/dotcode.py", line 876, in generate_dotcode
    hide_dynamic_reconfigure=hide_dynamic_reconfigure)
  File "/opt/ros/melodic/lib/python3.6/site-packages/rqt_graph/dotcode.py", line 698, in generate_dotgraph
    nt_nodes, edges, image_nodes = self._accumulate_image_topics(nt_nodes, edges, node_connections)
  File "/opt/ros/melodic/lib/python3.6/site-packages/rqt_graph/dotcode.py", line 553, in _accumulate_image_topics
    image_topic_edges_in.update(node_connections[n2].incoming)
TypeError: unhashable type: 'Edge'
dirk-thomas commented 6 years ago

What case did you test the patch with? Did it contain parallel edges in the graph?

kartikmohta commented 6 years ago

I tested it with a publisher using image_transport to publish raw + compressed images and another one with an actionlib server. I copied the changes to the tf section just to match the other two.

What exactly do you mean by parallel edges for this graph?

dirk-thomas commented 6 years ago

What exactly do you mean by parallel edges for this graph?

I was referring to two edges which have the same starting and ending node.

dirk-thomas commented 6 years ago

Since the object id was being used to hash the edge for the set I assume parallel edges weren't deduplicated before. That will continue to be the case with this patch using lists.

Thank you for the patch.