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

topic syntax is ambiguous "Invalid topic spec" #7

Open
dirk-thomas opened this issue Apr 24, 2017 · 3 comments
Open

topic syntax is ambiguous "Invalid topic spec" #7

dirk-thomas opened this issue Apr 24, 2017 · 3 comments

Comments

@dirk-thomas
Copy link
Contributor

From @sloretz on October 20, 2016 1:30

rqt_plot uses slashes to specify the value in a published message that should be plotted. This syntax leads to the error "PlotWidget.update_plot(): error in rosplot: Invalid topic spec [...]" in cases like the following

To reproduce

  1. save the following as simple_pub.py and make it executable with chmod

    #!/usr/bin/env python
    
    import rospy
    import std_msgs
    import sys
    import random
    rospy.init_node("simple_pub", anonymous=True)
    pub = rospy.Publisher(sys.argv[1], std_msgs.msg.Float32, queue_size=10)
    r = rospy.Rate(10)
    while not rospy.is_shutdown():
        r.sleep()
        msg = std_msgs.msg.Float32()
        msg.data = random.random()
        pub.publish(msg)
    
  2. open 4 terminals, one with each command

    • roscore
    • ./simple_pub.py imu/data
    • ./simple_pub.py imu/data/processed
    • rqt_plot
  3. Type the following into the topic box and press the green + to add them to the plot

    1. /imu/data/data
    2. /imu/data/processed/data
  4. rqt_plot will correctly plot the first topic, /imu/data/data. The second topic will not be plotted, and the terminal from which rqt_plot was started will spam

    PlotWidget.update_plot(): error in rosplot: Invalid topic spec [/imu/data/processed/data]: 'Float32' object has no attribute 'processed'
    

This can be fixed by changing the character used to separate message fields. I think the ':' character is a good choice

  • /imu/data:data
  • /imu/data/processed:data

Copied from original issue: ros-visualization/rqt_common_plugins#402

@dirk-thomas
Copy link
Contributor Author

The choice of using the same character as a namespace as well as field separator is certainly a bad one. But that decision was made at a very early time in ROS and is implemented in some of the core ROS packages. So I don't think this package can do much about it if it doesn't want to diverge from the "standard". I am not sure how feasible it will be to change this in the core.

@dirk-thomas dirk-thomas changed the title rqt_plot topic syntax is ambiguous "Invalid topic spec" topic syntax is ambiguous "Invalid topic spec" Jul 18, 2017
@josephcoombe
Copy link

josephcoombe commented Jun 28, 2018

Would it be reasonable to enable the alternative syntax via an optional flag,
e.g. rosrun rqt_plot rqt_plot -a /imu/data/processed:data (-a for alternative)?

I would be willing to make these changes.

@dirk-thomas
Copy link
Contributor Author

While this could be easily worked around locally in this package I think this needs to be globally agreed on and being "defined" as part of the ROS naming standard. Otherwise every package might end up doing its own thing.

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

2 participants