Skip to content
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

rqt_plot: cannot plot array elements - ROS Indigo #261

Closed
decabyte opened this issue Jul 26, 2014 · 22 comments
Closed

rqt_plot: cannot plot array elements - ROS Indigo #261

decabyte opened this issue Jul 26, 2014 · 22 comments

Comments

@decabyte
Copy link

Hi there,

after upgrading from the recent Indigo Beta to the latest version I've started to have problem with rqt_plot.

When plotting a specific element of an array field I'm getting this traceback just after typing the field name (ie. /<topic_name>/values[1]) in the gui:

Traceback (most recent call last):
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rqt_plot/plot_widget.py", line 204, in on_topic_edit_textChanged
    plottable, message = is_plottable(topic_name)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rqt_plot/plot_widget.py", line 104, in is_plottable
    fields, message = get_plot_fields(topic_name)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rqt_plot/plot_widget.py", line 80, in get_plot_fields
    return [ "%s[%d]" % (topic_name, i) for i in range(array_size) ], message
TypeError: range() integer end argument expected, got NoneType.

The ROS message I'm trying to plot is like this:

Header header
float32[] values

Previously with the version 0.3.6 of the package I was able to plot array elements correctly.

@decabyte decabyte changed the title rqt_plot: cannot plot element of array field - ROS Indigo rqt_plot: cannot plot array elements - ROS Indigo Jul 26, 2014
@dirk-thomas
Copy link
Contributor

@trainman419 Can you please take a look at this since it might be related to the recent changes?

@trainman419
Copy link
Contributor

I'll take a look at this.

@trainman419
Copy link
Contributor

I'm able to reproduce this error message on the version released into Hydro, but it doesn't prevent me from plotting array elements. In particular, I see this error when I put in the topic name and the name of the array field without brackets, but it doesn't cause rqt_plot to crash and doesn't prevent me from entering and plotting the array elements individually.

@decabyte is that causing rqt_plot to crash or preventing you from plotting array elements in Indigo?

@trainman419
Copy link
Contributor

Proposed fix for this is #262 .

@decabyte can you test this and confirm that it solves your problem?

@decabyte
Copy link
Author

Hi @trainman419 this is not fixing the problem and it is not producing any error on the console.

I'm still unable to plot a specific element from the array like: /topic/array[1]. Looking at the code you pointed me are you sure the empty list is enough to make a variable-length array plottable?

Cheers,
V.

@jczarnowski
Copy link

Hello everyone.

The commit that @trainman419 proposed fixes the error, but it does not allow to plot individual elements of the array.

The problem is that the function get_topic_type cannot handle the (..)/data[1] part of the topic_name and returns topic type = None.

In few seconds I'll create a pull request with a proposed solution to that problem.

@decabyte
Copy link
Author

Hi @jczarnowski the behaviour you described is correct and your fix is solving the problem on Indigo. 👍

I'm using it together with the previous fix of @trainman419.

@trainman419
Copy link
Contributor

I've confirmed that my fix works on Hydro, but not on Indigo. Odd.

@trainman419
Copy link
Contributor

The other half of this bug (on Indigo) is actually a bug in rostopic: ros/ros_comm#480

@trainman419
Copy link
Contributor

I'm able to reproduce this with the test_pub.py node in this package: https://github.com/trainman419/test_publishers

ablasdel added a commit that referenced this issue Aug 11, 2014
Handle variable-sized arrays. Fixes #261
@ablasdel
Copy link
Contributor

Whoops. Re-opening. The pull request didn't fix all the issues this issue brought up.

@ablasdel ablasdel reopened this Aug 11, 2014
@dirk-thomas
Copy link
Contributor

Which part of this ticket is still pending?

@ablasdel
Copy link
Contributor

Re-reading I guess just the ros_comm bug. Since that is ticketed separately on ros_comm then perhaps it makes sense to close this?

@dirk-thomas
Copy link
Contributor

The ros_comm ticket has been merged and released.

@ablasdel
Copy link
Contributor

Well then!

@RoboEvangelist
Copy link

Hi guys,

So the problem has not been solved yet?
It still does not work on my computer.

@dirk-thomas
Copy link
Contributor

@RoboEvangelist The packages have not been released yet since the patches have been committed. Are you actually using a from source build version of a current checkout of ros_comm and rqt_common_plugins?

@RoboEvangelist
Copy link

I'm using the ROS downloaded from the website, not the repository. So I guess my version is not as updated as the current github version.

Is there an easy way to intergrate the patch with my installed version of ROS withouth messing things up or having to start from scratch?

@dirk-thomas
Copy link
Contributor

The easiest way is to clone these repos into your workspace and build them from source together with your other packages.

You could also patch the files under /opt/ros/indigo directly with the multiple patches referenced from this ticket but that would be the more nasty approach.

@trainman419
Copy link
Contributor

Bump. This showed up on ROS Answers today: http://answers.ros.org/question/190686/rqt_plot-issues-in-indigo/

@ablasdel is it a good time to do a release of rqt_common_plugins, so that this fix makes its way into the world?

@dirk-thomas
Copy link
Contributor

This has already been done 2 days ago: ros/rosdistro#5315

And the fixed version is waiting in shadow-fixed for a sync: http://www.ros.org/debbuild/indigo.html?q=rqt_common_plugins

@RoboEvangelist
Copy link

The problem is solved. I just did a sudo upgrade on ubuntu, and now I can plot arrays on rqt_plot.

Yay!!! My boss is gonna be happy.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants