Bug in online plots with ROS 2 (eloquent, rqt-plot)

Since the upgrade to ROS 2 I could not use rqt-plot to plot the quantities streamed via ROS topics, such as joint encoders and motor torques, because when trying to do so I was getting the following error:

[ERROR] [get_message_class]: Malformed message_type: sequence<double>
Traceback (most recent call last):
  File "/opt/ros/eloquent/lib/python3.6/site-packages/rqt_plot/plot_widget.py", line 259, in on_topic_edit_textChanged
    plottable, message = is_plottable(self._node, topic_name)
  File "/opt/ros/eloquent/lib/python3.6/site-packages/rqt_plot/plot_widget.py", line 154, in is_plottable
    fields, message = get_plot_fields(node, topic_name)
  File "/opt/ros/eloquent/lib/python3.6/site-packages/rqt_plot/plot_widget.py", line 137, in get_plot_fields
    for slot, slot_type in field_class.get_fields_and_field_types().items():
AttributeError: 'NoneType' object has no attribute 'get_fields_and_field_types'

With some help from Majid and Max I’ve figured out there was a problem in the rqt-plot version shipped with ROS eloquent, which was fixed in subsequent ROS versions.

An easy way to fix the bug by yourself without updating the ROS distribution is to take the files modified in this PR, and replace the corresponding files in your installation of rqt-plot, which in my system were in /opt/ros/eloquent/lib/python3.6/site-packages/rqt_plot. I hope this can be of help for other people.

Andrea

Thank you very much for this Andrea!
I hope they will update the ROS2 version at some point.