From 78bb1ce1247444561c7b5f66a95b30dc79bbaf30 Mon Sep 17 00:00:00 2001 From: mnhaqq <118978306+mnhaqq@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:12:47 +0000 Subject: [PATCH] Update Understanding-ROS2-Topics.rst (#4803) * Update Understanding-ROS2-Topics.rst Introduce bw and find commands to understanding topics tutorial * Update Understanding-ROS2-Topics.rst Rephrase description of bw command for clarity Fixes #4610 * Update Understanding-ROS2-Topics.rst Remove redundant lines * Update Understanding-ROS2-Topics.rst * Update Understanding-ROS2-Topics.rst Changes for readability and remove unnecessary lines Signed-off-by: mnhaqq <118978306+mnhaqq@users.noreply.github.com> (cherry picked from commit a839c3b0faee22a8ac9f0737293ed1dd7eb2ccf7) --- .../Understanding-ROS2-Topics.rst | 52 ++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst b/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst index a944c78f70..13963e1e5b 100644 --- a/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst +++ b/source/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.rst @@ -313,7 +313,7 @@ If the message does not use a full header, but just has a field with type ``buil 8 ros2 topic hz ^^^^^^^^^^^^^^^ -For one last introspection on this process, you can view the rate at which data is published using: +You can also view the rate at which data is published using: .. code-block:: console @@ -329,12 +329,52 @@ It will return data on the rate at which the ``/turtlesim`` node is publishing d Recall that you set the rate of ``turtle1/cmd_vel`` to publish at a steady 1 Hz using ``ros2 topic pub --rate 1``. If you run the above command with ``turtle1/cmd_vel`` instead of ``turtle1/pose``, you will see an average reflecting that rate. -.. 9 rqt_plot - ^^^^^^^^^^ - Can't do this section now because there's some significant UI issues with rqt_plot for ROS 2 +9 ros2 topic bw +^^^^^^^^^^^^^^^ + +The bandwidth used by a topic can be viewed using: + +.. code-block:: console + + ros2 topic bw /turtle1/pose + +It returns the bandwidth utilization and number of messages being published to the ``/turtle1/pose`` the topic. + +.. code-block:: console -9 Clean up -^^^^^^^^^^ + Subscribed to [/turtle1/pose] + 1.51 KB/s from 62 messages + Message size mean: 0.02 KB min: 0.02 KB max: 0.02 KB + +10 ros2 topic find +^^^^^^^^^^^^^^^^^^ + +To list a list of available topics of a given type use: + +.. code-block:: console + + ros2 topic find + +Recall that the ``cmd_vel`` topic has the type: + +.. code-block:: console + + geometry_msgs/msg/Twist + +Using the ``find`` command outputs topics available when given the message type: + +.. code-block:: console + + ros2 topic find geometry_msgs/msg/Twist + +This outputs: + +.. code-block:: console + + /turtle1/cmd_vel + +11 Clean up +^^^^^^^^^^^ At this point you'll have a lot of nodes running. Don't forget to stop them by entering ``Ctrl+C`` in each terminal.