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 topic syntax is ambiguous "Invalid topic spec" #402

Closed
sloretz opened this issue Oct 20, 2016 · 2 comments
Closed

rqt_plot topic syntax is ambiguous "Invalid topic spec" #402

sloretz opened this issue Oct 20, 2016 · 2 comments

Comments

@sloretz
Copy link
Contributor

sloretz commented Oct 20, 2016

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
@dirk-thomas
Copy link
Contributor

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
Copy link
Contributor

This issue was moved to ros-visualization/rqt_plot#7

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