Embodied AI Glossary中文

Publish-Subscribe

发布/订阅Pub/SubCommon

Senders publish messages on a topic and receivers subscribe to it, with neither side needing to know the other.

Publish-subscribe is a communication pattern: publishers send messages to a named “topic,” and every receiver subscribed to that topic gets them, without the publisher needing to know who's listening or subscribers needing to know who's sending. That keeps modules loosely coupled — adding a new subscriber, say for recording or visualization, doesn't require touching existing code. ROS / ROS 2's topic mechanism is a textbook example: a camera driver node publishes an image topic, and a perception node and RViz can both subscribe to it at once. It suits continuously flowing data such as sensor readings and state; a one-off request-response interaction should use a service instead, and a long-running task should use an action. ROS 2 implements this over DDS underneath, with QoS settings for tuning reliability and buffer depth.

ExampleA lidar node publishes the /scan topic, and both a mapping node and a rosbag recording session subscribe to it at the same time.

Also called
pub/sub, publisher/subscriber
Related
Topic (ROS) · Node (ROS) · Service (ROS) · Data Distribution Service · ROS 2 Quality of Service (QoS) · Middleware
Sources
ROS 2 Documentation: Understanding topics
Publish–subscribe pattern - Wikipedia

See it in the full glossary →