relay is ROS node that subscribes to a topic and republishes all incoming data to another topic. It can work with any message type.
relay is part of the topic_tools package.
relay <intopic> [outtopic]
Subscribe to <intopic> and republish to another topic.
intopic: Incoming topic to subscribe to
outtopic: Outgoing topic to publish on (default: intopic_relay)
e.g. rename base_scan to my_base_scan:
rosrun topic_tools relay base_scan my_base_scan
New in Lunar
This is almost the same as a normal relay but it relays only if the topic specified by param ~monitor_topic is being subscribed by any other nodes except itself.
When input topic of relay and monitor topic are pointing to the same topic (this is the default configuration), the relay node subscribes input topic only when other nodes also subscribe the input topic. It looks like relay node subscribes without increment subscription count.
This feature is useful for publishing topics for visualization with lazy transport (e.g. nodelet_lazy in nodelet_topic_tools ). For example, lazy-transport-enabled nodes don't subscribe input topics unless other nodes subscribe the output topics of the nodes, but some nodes are expected to always subscribe topics (e.g. RViZ) and this breaks "laziness" of the nodes. Putting relay node with stealth mode between RViZ and the lazy node will solve this issue.
~unreliable (bool, default: False)
- If True, prefer to negotiate an unreliable connection for the inbound data. (New in ROS 1.1.11)
- If True, don't subscribe to input topic unless there is at least one subscriber on the output topic. (New in ros_comm 1.5.0)
- If True, relay messages only if the topic specified by ~monitor_topic is subscribed by any other nodes.
- In ~stealth mode, this node relays messages if the topic specified by this parameter is subscribed by any other nodes except this node itself.
- Polling rate for monitoring subscribers of ~monitor_topic in ~stealth mode.