Skip to content

Software

topic_tools

By ROS 2 Tooling Working Groups, from github.com/ros-tooling/topic_tools (opens in a new tab)

  • Middleware
  • Tool
  • Apache-2.0

A ROS 2 package of composable nodes for redirecting, throttling, dropping, multiplexing, transforming and delaying ROS 2 topics at a meta level, without serializing the data.

Facts

GitHub stars
143read on 22 Nov 2026
Last update
14 Nov 2026Newest commit on rolling
Maintenance
Activea commit in the last 90 days
Difficulty
Intermediate

Checked on GitHub on 22 Nov 2026.

Licenses

Code
Apache-2.0 (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (Apache-2.0) at commit b3d7bd3 (opens in a new tab), on 15 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Relay subscribes to a topic and republishes it to another topic, working with any message type.
  • RelayField republishes one or more fields of a message into a different message type.
  • Transform converts a topic or one of its fields into another topic and type using a Python expression.
  • Throttle limits republishing either by message rate or by bandwidth in bytes per second over a time window.
  • Drop forwards only some messages, dropping X out of every Y, mainly to save bandwidth on wireless links.
  • Mux switches one output among N input topics, and Demux sends one input to one of N outputs, both with services to switch selection.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
Apache-2.0. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Active, last commit on 14 Nov 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit b3d7bd3

Robotheca read the repository at two versions: the summary at 1205546 and the facts and the README at b3d7bd3 (read on 22 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by ROS 2 Tooling Working Groups, at commit b3d7bd3, under Apache-2.0 (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

topic_tools

This package is the ROS 2 port of https://wiki.ros.org/topic_tools (opens in a new tab)

Tools for directing, throttling, selecting, and otherwise manipulating ROS 2 topics at a meta-level. These tools do not generally perform serialization on the streams being manipulated, instead acting on generic binary data using rclcpp's GenericPublisher and GenericSubscription.

The tools in this package are provided as composable ROS 2 component nodes, so that they can be spawned into an existing process, launched from launchfiles, or invoked from the command line.

Components
  • Relay: Subscribes to a topic and republishes to another.
  • RelayField: Republishes data in a different message type.
  • Transform: Manipulates a topic or a field and outputs data on another topic.
  • Throttle: Republishes data with bandwidth or rate limit.
  • Drop: Republishes by dropping X out of every Y incoming messages.
  • Mux: Multiplexes incoming topics to an output.
  • Demux: Demultiplexes an incoming topic to one of multiple outputs
  • Delay: Delays and republishes incoming data.
Relay

Relay is ROS 2 node that subscribes to a topic and republishes all incoming data to another topic. It can work with any message type.

Usage
ros2 run topic_tools relay <intopic> [outtopic]

Subscribe to intopic and republish to either

  • outtopic if specified
  • <intopic>_relay if not

E.g. rename base_scan to my_base_scan:

ros2 run topic_tools relay base_scan my_base_scan
Parameters
  • input_topic (string)
    • the same as if provided as a command line argument
  • output_topic (string, default=<input_topic>_relay)
    • the same as if provided as a command line argument
  • lazy (bool, default=False)
    • If True, only subscribe to input_topic if there is at least one subscriber on the output_topic
RelayField

RelayField is a ROS 2 node that allows to republish data in a different message type.

Usage
ros2 run topic_tools relay_field <input topic> <output topic> <output type> [<expression on m>]

Subscribe to input topic and republish one or many of its fields onto another field in a different message type

E.g. publish the contents of the data field in a std_msgs/msg/String onto the frame_id field of a std_msgs/msg/Header:

ros2 run topic_tools relay_field /chatter /header std_msgs/Header "{stamp: {sec: 0, nanosec: 0}, frame_id: m.data}"
Transform

Transform is a ROS 2 node that allows to take a topic or one of it fields and output it on another topic.

Usage
ros2 run topic_tools transform <input topic> <output topic> <output type> [<expression on m>] [--import <modules>] [--field <topic_field>]

Subscribe to input topic and convert topic content or its field into

  • output topic whose type is output type based on expression on m

E.g. transform imu orientation to norm:

ros2 run topic_tools transform /imu --field orientation /norm std_msgs/Float64 'std_msgs.msg.Float64(data=numpy.sqrt(numpy.sum(numpy.array([m.x, m.y, m.z, m.w]))))' --import std_msgs numpy
Throttle

Throttle is ROS 2 node that subscribes to a topic and republishes incoming data to another topic, either at a maximum bandwidth or maximum message rate.

Usage
throttle message (rate)
ros2 run topic_tools throttle messages <intopic> <msgs_per_sec> [outtopic]

Throttle messages on intopic to a particular rate.

  • intopic: Incoming topic to subscribe to
  • msgs_per_sec: Maximum messages per second to let through.
  • outtopic: Outgoing topic to publish on (default: intopic_throttle)

E.g. throttle bandwidth-hogging laser scans (base_scan) to 1Hz:

ros2 run topic_tools throttle messages base_scan 1.0
throttle bytes (bandwidth)
ros2 run topic_tools throttle bytes <intopic> <bytes_per_sec> <window> [outtopic]

Throttle messages on intopic to a particular rate.

  • intopic: Incoming topic to subscribe to
  • bytes_per_sec: Maximum bytes of messages per second to let through.
  • window: Time window in seconds to consider
  • outtopic: Outgoing topic to publish on (default: intopic_throttle)

E.g. throttle bandwidth-hogging laser scans (base_scan) to 1KBps:

ros2 run topic_tools throttle bytes base_scan 1024 1.0
Parameters
  • input_topic (string)
    • the same as if provided as a command line argument
  • output_topic (string, default=<input_topic>_throttle)
    • the same as if provided as a command line argument
  • lazy (bool, default=False)
    • If True, only subscribe to input_topic if there is at least one subscriber on the output_topic
  • use_wall_clock (bool, default=False)
    • If True, then perform all rate measurements against wall clock time, regardless of whether simulation / log time is in effect.
  • throttle_type (string, either messages or bytes)
    • Method how to throttle
  • msgs_per_sec (double)
    • Maximum messages per second to let through.
  • bytes_per_sec (integer)
    • Maximum bytes of messages per second to let through.
  • window (double)
    • Time window in seconds to consider
Drop

Drop is ROS 2 node that can subscribe to a topic and republish incoming data to another topic, dropping X out of every Y incoming messages. It's mainly useful for limiting bandwidth usage, e.g., over a wireless link. It can work with any message type.

Usage
ros2 run topic_tools drop <intopic> <X> <Y> [outtopic]

Subscribe to and drop every out of messages.

  • intopic: Incoming topic to subscribe to
  • X, Y: drop X out of every Y incoming messages
  • outtopic: Outgoing topic to publish on (default: intopic_drop, e.g. when intopic is "base_scan", then it will be base_scan_drop)

E.g. drop every other message published to base_scan:

ros2 run topic_tools drop base_scan 1 2
Parameters
  • input_topic (string)
    • the same as if provided as a command line argument
  • output_topic (string, default=<input_topic>_drop)
    • the same as if provided as a command line argument
  • lazy (bool, default=False)
    • If True, only subscribe to input_topic if there is at least one subscriber on the output_topic
  • X (int), Y (int)
    • Drop X out of every Y incoming messages
Mux

mux is a ROS2 node that subscribes to a set of incoming topics and republishes incoming data from one of them to another topic, i.e., it's a multiplexer that switches an output among 1 of N inputs. Services are offered to switch among input topics, and to add and delete input topics. At startup, the first input topic on the command line is selected.

Usage
ros2 run topic_tools mux <outtopic> <intopic1> [intopic2...]

Subscribe to ...N and publish currently selected topic to outtopic. mux will start with selected.

  • outtopic: Outgoing topic to publish on
  • intopicN: Incoming topic to subscribe to

E.g. mux two command streams (auto_cmdvel and joystick_cmdvel) into one (sel_cmdvel):

ros2 run topic_tools mux sel_cmdvel auto_cmdvel joystick_cmdvel
Parameters
  • input_topics (string array)
    • the same as if provided as a command line argument
  • output_topic (string, default=~/selected)
    • the same as if provided as a command line argument
  • lazy (bool, default=False)
    • If True, only subscribe to input_topic if there is at least one subscriber on the output_topic
  • initial_topic (str, default="")
    • Input topic to select on startup. If __none, start with no input topic. If unset, default to first topic in arguments
Demux

demux is a ROS2 node that subscribes to an incoming topic and republishes incoming data to one of many topic, i.e., it's a demultiplexer that switches an input towards 1 of N outputs. Services are offered to switch among output topics, and to add and delete output topics. At startup, the first output topic on the command line is selected.

Usage
ros2 run topic_tools demux <intopic> <outtopic1> [outtopic2...]

Subscribe to and publish currently to selected outtopic among ...N. demux will start with selected.

  • intopic: Incoming topic to subscribe to
  • outtopicN: Outgoing topic to publish on

E.g. demux one command stream (cmdvel) between two command streams (turtle1_cmdvel and turtle2_cmdvel):

ros2 run topic_tools demux cmdvel turtle1_cmdvel turtle2_cmdvel
Parameters
  • input_topic (string, default=~/input)
    • the same as if provided as a command line argument
  • output_topics (string array)
    • the same as if provided as a command line argument
  • initial_topic (str, default="")
    • Output topic to select on startup. If __none, start with no output topic. If unset, default to first topic in arguments
Delay

Delay is a ROS 2 node that can subscribe to a topic and republish incoming data to another topic, delaying the message by a fixed duration. It's useful to simulate computational results with high latency.

Usage
ros2 run topic_tools delay <intopic> <delay> [outtopic]

Subscribe to and republish on delayed by .

  • intopic: Incoming topic to subscribe to
  • delay: delay in seconds
  • outtopic: Outgoing topic to publish on (default: intopic_delay)

E.g. delay messages published to base_scan by 500ms:

ros2 run topic_tools delay base_scan 0.5
Parameters
  • input_topic (string)
    • the same as if provided as a command line argument
  • output_topic (string, default=<input_topic>_delay)
    • the same as if provided as a command line argument
  • delay (double, default=0.0)
    • delay in seconds
  • use_wall_clock (bool, default=False)
    • If True, then perform all rate measurements against wall clock time, regardless of whether simulation / log time is in effect.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.