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

rostopic echo of array indices fails #480

Closed
trainman419 opened this issue Jul 29, 2014 · 11 comments
Closed

rostopic echo of array indices fails #480

trainman419 opened this issue Jul 29, 2014 · 11 comments
Assignees
Labels

Comments

@trainman419
Copy link
Contributor

This is part of the root cause for ros-visualization/rqt_common_plugins#261

When publishing an array message (on topic /array):

Header header
float32[] values

rostopic echo /array/values[0] fails, but rostopic echo /array/values succeeds.

This worked on Hydro, and fails on Indigo. It looks like the underlying bug here is a change somewhere in rostopic's _get_topic_type()

@trainman419
Copy link
Contributor Author

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

@dirk-thomas
Copy link
Member

Please try #481 and check if it also fixes the problem you have with rqt_plot.

@trainman419
Copy link
Contributor Author

I'm not near my Indigo machine at the moment; I'll try to test this when I get home tonight.

@trainman419
Copy link
Contributor Author

Confirmed; this fixes rostopic echo for array members, and rqt_plot for the same cases, although I do get some rather ugly stacktraces whlie typing that don't happen in the hydro version:

Traceback (most recent call last):
  File "/home/htpc/catkin_ws/src/rqt_common_plugins/rqt_plot/src/rqt_plot/plot_widget.py", line 208, in on_topic_edit_textChanged
    plottable, message = is_plottable(topic_name)
  File "/home/htpc/catkin_ws/src/rqt_common_plugins/rqt_plot/src/rqt_plot/plot_widget.py", line 108, in is_plottable
    fields, message = get_plot_fields(topic_name)
  File "/home/htpc/catkin_ws/src/rqt_common_plugins/rqt_plot/src/rqt_plot/plot_widget.py", line 49, in get_plot_fields
    topic_type, real_topic, _ = topic_helpers.get_topic_type(topic_name)
  File "<string>", line 421, in get_topic_type
  File "<string>", line 404, in _get_topic_type
  File "<string>", line 305, in msgevalgen
AssertionError: Topic name 'values[0' contains '[' but does not end with ']'

@dirk-thomas
Copy link
Member

What exactly did you try when you got the stack trace? From the assertion it looks like you passed a topic name with an open bracket but without a closing one.

@trainman419
Copy link
Contributor Author

Yep. I got that stack while typing the full topic name.

@dirk-thomas
Copy link
Member

Can you please post a reproducible example?

@trainman419
Copy link
Contributor Author

I used the topic entry box to interactively select the topic in question, using the test_pub.py node from my test_publishers package: https://github.com/trainman419/test_publishers

With the test_pub.py node running, run rqt_plot (no arguments), and then type the topic name in the Topic box: /array/values[0] - upon entering the [ and the 0, you should see errors on the console.

@dirk-thomas
Copy link
Member

So rqt_plot is calling the API with an invalid topic name. Before it was silently ignored - now it prints the assertion. Do you want to modify rqt_plot to not call the API with temporary (invalid) user input? Or should I change the patch to silently ignore invalid input again?

@trainman419
Copy link
Contributor Author

rqt_plot is calling get_topic_type to determine what is and is not a valid topic/field name. The previous version of get_topic_type handled this by returning None for invalid topics, and rqt_plot then indicated that the topic was invalid.

I don't expect to modify rqt_plot so that it doesn't call get_topic_type with an invalid topic name.

I think it makes sense to wrap the call to get_topic_type in rqt_plot with a try/catch so that this error
can be passed to the user more gracefully.

@dirk-thomas
Copy link
Member

Sorry, but the last two paragraphs seem to contradict each other:

I don't expect to modify rqt_plot...

...wrap the call to get_topic_type in rqt_plot...

I have modified the pull request to not change API behavior - for an invalid topic it will return None as the msg eval function.

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

No branches or pull requests

2 participants