Got it! I'll find ways to monitor multiple ROS 2 topic frequencies simultaneously in a single command-line or GUI interface, avoiding the need to open multiple terminals. I'll update you with the best available tools and techniques shortly.
Monitoring Multiple ROS 2 Topic Frequencies in One View
When you need to observe multiple ROS 2 topic publish rates simultaneously without juggling many terminals, there are both built-in solutions and third-party tools to help. Below are several approaches (CLI and GUI) to aggregate topic frequency information in a single interface, along with usage examples.
Built-In ROS 2 Tools
ros2 topic hz
(CLI)
The ros2 topic hz
command measures the publishing frequency of a topic. In older ROS 2 distributions (e.g. Humble), it accepts only one topic at a time, meaning you’d normally run one instance per topicgithub.com. However, newer ROS 2 versions have added support for monitoring multiple topics in one command (similar to ROS 1’s rostopic hz
)docs.ros.org. This prints a table of each topic’s rate and statistics:
- Usage (single topic):
bash
ros2 topic hz /topic_name
This subscribes to /topic_name
and periodically prints its average rate (Hz), min/max interval, std dev, and window size.
- Usage (multiple topics): (Available in ROS 2 Rolling and newer)docs.ros.org
bash
ros2 topic hz /topic1 /topic2 /topic3
This will subscribe to all listed topics and display a table of their publishing rates side by side (each row per topic). For example, in ROS 1 the output looked like:
bash
topic rate min_delta max_delta std_dev window /topic1 9.995 0.09971 0.10040 0.00019 10 /topic2 9.996 0.09978 0.10040 0.00017 10
In ROS 2’s multi-topic mode, you can expect a similar table updated continuously in one terminal. Use Ctrl+C
to stop monitoring. You can also adjust the statistics window with -w
(number of messages to average).
RQt Topic Monitor (GUI)
ROS 2’s RQt GUI includes the Topic Monitor plugin (from the rqt_topic
package) which displays all active topics and their publishing rates in one windowwiki.ros.org. This is essentially a graphical equivalent of rostopic hz
for multiple topics.
- Usage: Launch RQt and open Plugins > Topics > Topic Monitor, or run the plugin directly:
bash
ros2 run rqt_topic rqt_topic
This will open a GUI listing each topic name, its message type, number of publishers/subscribers, and live publishing ratewiki.ros.org. The rate (in Hz) updates in real-time for each topic, so you can monitor many topics at once. For example, you might see a list with columns for “Topic Name” and “Rate (Hz)” where multiple topics (e.g. /odom
, /cmd_vel
, /camera/image_raw
, etc.) each display their current frequency. This one interface replaces having separate ros2 topic hz
consoles for each topic.
Tip: Ensure you have the rqt_topic
plugin installed (it’s part of the RQt common plugins). This tool is very handy for a quick overview of all topic frequencies in your ROS 2 system.
Third-Party Utilities
multiple_topic_monitor
(CLI)
multiple_topic_monitor is a ROS 2 package designed for exactly this purpose – monitoring multiple topics’ frequencies (and optionally message delay) concurrentlydocs.ros.orgdocs.ros.org. It provides a single command-line tool that aggregates outputs for several topics:
-
Installation: Clone the multiple_topic_monitor repository into your workspace and build (via
colcon build
)docs.ros.org, or install via ROS packages if available. -
Usage:
bash
ros2 topic multiple_topic_monitor /topic1 /topic2 /topic3 -w 10
This will subscribe to /topic1
, /topic2
, /topic3
and print each of their frequencies in one console, updating every second (by default). The -w 10
sets the window size for averaging (here 10 messages)docs.ros.org. Example output for three topics might look like:
less
[INFO] [topic_monitor]: /topic1 Hz: 10.00 [INFO] [topic_monitor]: /topic2 Hz: 39.62 [INFO] [topic_monitor]: /topic3 Hz: 9.98
These lines update periodically, giving you the live rate of each specified topic without needing separate commandsdocs.ros.orgdocs.ros.org. (If the messages have a header timestamp, the tool can also compute latency/delay.) The utility also supports a --csv
mode to log data to CSV if neededdocs.ros.org.
Intel Benchtool (CLI)
Benchtool is a high-performance topic frequency measurement tool from Intel’s ROS 2 utility suite. It’s useful if you have many topics or very high-frequency topics and want to monitor and record their rates reliablyamrdocs.intel.com. Benchtool can listen to multiple topics at once and produce output for each (including writing to a CSV file for analysis)amrdocs.intel.com.
- Installation: Install the package (for ROS 2 Humble or later) via apt:
bash
sudo apt install ros-${ROS_DISTRO}-benchtool
and prepare a configuration file ( TOML format) specifying which topics to monitor. Benchtool uses a config file to list topics (and message types) of interest.
- Usage:
Create a config (e.g.,benchtool.toml
) listing topics, then run:
bash
ros2 run benchtool benchtool --ros-args -p toml:=./benchtool.toml -p o_csv:=./results.csv
This launches Benchtool with your topic list and writes the frequency data to results.csv
amrdocs.intel.com. It will continuously measure the publish rate of each configured topic with high accuracy (it’s designed to handle high data rates more reliably than ros2 topic hz
in some casesamrdocs.intel.com). You can later inspect the CSV or even integrate Benchtool with monitoring stacks (it has advanced options for Prometheus/Grafana visualizationamrdocs.intel.comamrdocs.intel.com).
Note: Benchtool is a more advanced solution—ideal for benchmarking or logging, but it requires a setup step (creating the config file) rather than a quick one-liner.
Foxglove Studio (GUI)
Foxglove Studio is a third-party visualization and observability tool for robotics datadocs.ros.org. While not a dedicated frequency monitor, it allows you to view multiple ROS 2 topics in one dashboard and inspect their data streams side by side. This can help you visually gauge frequencies or detect if a topic is lagging.
- Usage: Install Foxglove Studio (web or desktop) and run the ROS 2 Foxglove bridge:
bash
sudo apt install ros-${ROS_DISTRO}-foxglove-bridge ros2 launch foxglove_bridge foxglove_bridge_launch.xml
In Foxglove Studio, connect to the ROS 2 bridge (WebSocket connection). You can then add panels such as Timeline or Chart for each topic. For example, add a Time Series chart for multiple topics’ header timestamps or sequence numbers – the slope/spacing of points will indicate their frequency. Foxglove doesn’t directly display “Hz” values, but by observing the timeline or using measurement cursors, you can determine the publish rates. All topics are shown in one unified interface, which is easier than monitoring separate terminal windows.Example: Display /scan
, /odom
, and /camera_info
on three timeline tracks. If /scan
updates ~5 times in a 1-second span, you know it’s ~5 Hz, while /odom
might show ~20 messages in that same second (20 Hz), etc., all in one synchronized view.
PlotJuggler (GUI)
PlotJuggler is another third-party tool that can subscribe to multiple ROS 2 topics and plot their data in real-time. It’s primarily for plotting time-series data rather than explicitly showing “Hz”, but by visualizing message streams you can infer frequency. For instance, you could plot each topic’s message header timestamp or sequence number over time – the spacing between points reveals the rate. PlotJuggler allows combining multiple plots in one window, so you get a multi-topic overview. This is more of a workaround for advanced users, but it can be useful for visually comparing frequencies or detecting drops/spikes in rate on a timeline.(Both Foxglove and PlotJuggler require a running ROS 2 system and offer a GUI to observe many topics at once. They are overkill if you just need raw numbers, but they shine in giving a visual sense of what’s happening on each topic.)
Workarounds & Custom Scripts
If the above tools are not available, here are a few workarounds to aggregate topic rates in one place:
- Terminal Multiplexing: Use a terminal splitter like tmux or terminator to run several
ros2 topic hz
commands in one window. For example, in tmux you can split panes and runros2 topic hz /topic1
in one pane,/topic2
in another, etc., all within a single terminal window. This isn’t truly “one command”, but it avoids juggling separate terminal applications. Everything is visible at once (just arranged in panels). - The
watch
Command: You can combine Linux’swatch
with short-livedros2 topic hz
calls. For instance:
bash
watch -n5 "ros2 topic hz -w 5 /topic1; ros2 topic hz -w 5 /topic2"
This attempts to refresh output every 5 seconds by running each ros2 topic hz
with a fixed window of 5 messages for /topic1
and /topic2
sequentially. The idea is to let each command gather a few samples and print a one-time result. In practice, you may need to experiment (since ros2 topic hz
is continuous by default). Another approach is using timeout
to run each for a short interval. While a bit clunky, watch
can periodically update a single screen with multiple topics’ rates.
- Custom Python Script/Node: For a more robust solution, you can write a small ROS 2 node (in Python or C++) that subscribes to multiple topics and prints their frequencies. For example, using rclpy, create subscriptions to each topic and track the timestamps of incoming messages. Every few seconds, calculate the rate (messages/second) for each subscription and log them together. This script can be run in one terminal and act like a multi-topic monitor. (Essentially, this is what the multiple_topic_monitor tool is already doing for you, so you might reuse or adapt such code rather than writing from scratch.)
- Enable Topic Statistics: ROS 2 has a QoS feature to automatically compute topic statistics (like frequency, mean/min/max period) for a given subscription. If you enable statistics on the topics (via node parameters), the middleware will publish stats messages (on a
/statistics
topic). You could then echo or visualize those stats for multiple topics. This is an indirect method and requires modifying the publishers or subscribers to enable stats, so it’s more involved. If configured, though, you might get periodic statistic messages that include observed frequency which you can collect in one place.
By leveraging the tools above, you can avoid opening a dozen terminals just to watch topic rates. For a quick built-in solution, try RQt’s Topic Monitor for a GUI or the improved ros2 topic hz
(with multi-topic support) for CLI. For more advanced monitoring, utilities like multiple_topic_monitor or Benchtool provide aggregated frequency outputs in one shotdocs.ros.orgamrdocs.intel.com. And if you prefer a custom or visual approach, consider using Foxglove Studio or writing a small monitoring node. All of these approaches let you keep an eye on multiple topic frequencies simultaneously in one interface, making it easier to ensure your ROS 2 system is running as expected.
Sources:
- ROS 2
ros2topic
tool changelog – added multi-topic support forros2 topic hz
docs.ros.org - ROS 2 CLI reference (ROS 1 vs ROS 2
topic hz
capability)github.com - rqt_topic plugin (Topic Monitor) – displays publishers, subscribers, and publishing rate for topicswiki.ros.org
- Usage of
rqt_topic
standalone in ROS 2sites.google.com - multiple_topic_monitor package – monitors frequency of multiple topics (usage and output)docs.ros.orgdocs.ros.org
- Intel Benchtool – purpose and usage for multi-topic frequency benchmarkingamrdocs.intel.comamrdocs.intel.com
- Foxglove Studio – ROS 2 visualization/observability tool (multi-topic support)docs.ros.org