ros-visualization / rqt_graph

http://wiki.ros.org/rqt_graph
27 stars 27 forks source link

Incorrect QoS tooltip info displayed (ROS 2) #59

Open jacobperron opened 3 years ago

jacobperron commented 3 years ago

I've noticed in systems with many nodes running the QoS tooltip (added in #53) is not always correct. In particular, it seems easy to reproduce if we are using simulation time with a clock publisher.

Reproduction

To reproduce, create a file clock_pub.py with the following contents:

from time import sleep

import rclpy
from rclpy.qos import QoSProfile

from rosgraph_msgs.msg import Clock

def main(args=None):
    rclpy.init(args=args)

    node = rclpy.create_node('clock_publisher')

    publisher = node.create_publisher(Clock, '/clock', QoSProfile(depth=1, durability=rclpy.qos.DurabilityPolicy.TRANSIENT_LOCAL))

    msg = Clock()

    while rclpy.ok():
        publisher.publish(msg)
        sleep(1)  # seconds
        msg.clock.sec += 1

    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

Then create a launch file with a bunch of talkers, a listener, and clock_pub.py:

<launch>
  <set_parameter name="use_sim_time" value="true" />

  <node name="talker_0" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_1" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_2" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_3" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_4" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_5" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_6" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_7" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_8" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_9" pkg="demo_nodes_cpp" exec="talker" />
  <node name="talker_10" pkg="demo_nodes_cpp" exec="talker" />
  <node name="listener" pkg="demo_nodes_cpp" exec="listener" />

  <executable name="clock_pub" cmd="python3 clock_pub.py" />
</launch>

Launch the system:

ros2 launch repro.launch.xml

Start rqt_graph

rqt_graph

Switch to the "Node/Topics" view from the drop-down menu and hover over some of the arrows to see the QoS. You'll notice that sometimes it is incorrectly displaying tooltips for other connections. E.g. we see the clock publisher (reliable/transient_local) or clock subscription (best_effort/volatile) QoS information overlayed on the talker/listener "chatter" topic arrows, which should be reliable/volatile.

Additional info

I instrumented the code a little bit to print out extra information in the tooltip. Doing this I can confirm the tooltip being displayed is for an edge in the graph that we are not currently hovering over. So, I'm not sure if this is a bug in rqt_graph itself, or the upstream libraries responsible for rendering tooltips.