Inferensys

Glossary

ROS Topic

A ROS Topic is a named bus over which nodes exchange asynchronous, many-to-many messages using a publish-subscribe communication model.
MLOps engineer reviewing model serving infrastructure on laptop, container orchestration visible, technical workspace.
ROBOT OPERATING SYSTEM (ROS)

What is a ROS Topic?

A ROS Topic is the primary asynchronous, many-to-many communication channel in the Robot Operating System (ROS) framework.

A ROS Topic is a named bus over which ROS nodes exchange asynchronous messages using a publish-subscribe communication model. A node that generates data publishes messages to a topic, while any number of other nodes can subscribe to that same topic to receive the data. This decoupled, many-to-many pattern is fundamental for streaming sensor data (e.g., camera images, LiDAR scans) and state information (e.g., odometry, joint positions) throughout a robotic system.

Each topic carries messages of a single, strictly defined ROS message type (.msg), ensuring data consistency. Communication is managed by a ROS Master (in ROS 1) or via decentralized discovery (in ROS 2). Topics are ideal for continuous data streams where timing is not guaranteed, contrasting with the synchronous request-response pattern of a ROS Service. The system's communication topology, formed by nodes and topics, is visualized as the ROS Graph.

COMMUNICATION PATTERN

Core Characteristics of a ROS Topic

A ROS Topic is the primary mechanism for asynchronous, many-to-many data exchange in the Robot Operating System. Its design embodies key principles that enable scalable, decoupled communication between robotic software components.

01

Asynchronous Publish-Subscribe

A ROS Topic implements a publish-subscribe communication pattern. Publisher nodes send messages to a topic without knowledge of subscribing nodes. Subscriber nodes receive messages from topics of interest without knowing the publishing source. This creates a many-to-many, asynchronous, and decoupled data flow, which is ideal for streaming sensor data (e.g., camera images, LiDAR scans) or broadcasting system state (e.g., odometry, joint positions).

02

Named, Typed Data Bus

Every topic is identified by a unique string name (e.g., /camera/rgb/image_raw) and carries messages of a single, strictly defined data type. This type is defined in a .msg file (e.g., sensor_msgs/Image). The ROS middleware handles the serialization and deserialization of these typed messages, ensuring data integrity. Publishers and subscribers must agree on the topic name and message type to communicate successfully.

03

Transport Agnostic & Decentralized

Topic communication is transport-agnostic. The underlying middleware (ROS 1 TCPROS/ UDPROS or ROS 2 DDS) manages the actual network transport, discovery, and connection. The graph is decentralized; there is no central broker. Nodes discover each other dynamically via a distributed discovery protocol. This peer-to-peer architecture enhances robustness and scalability in distributed robotic systems.

04

Configurable Quality of Service (QoS)

In ROS 2, topic communication is governed by configurable Quality of Service (QoS) policies. These allow developers to tune communication behavior for specific needs:

  • Reliability: Choose between RELIABLE (guaranteed delivery) or BEST_EFFORT.
  • Durability: Set VOLATILE (no history) or TRANSIENT_LOCAL (late-joining subscribers get last message).
  • History Depth: Control how many messages are kept in a queue.
  • Deadline: Specify the expected maximum period between messages. This enables support for systems ranging from best-effort logging to strict real-time control.
05

Contrast with Services & Actions

Topics are one of three core communication methods in ROS, each suited for different scenarios:

  • Topic (Pub-Sub): Asynchronous streaming (e.g., sensor data).
  • Service (Req-Rep): Synchronous request-response for quick tasks (e.g., querying a map).
  • Action (Goal-Feedback-Result): Asynchronous, long-running tasks with feedback and preemption (e.g., navigating to a goal). Topics provide the continuous, fire-and-forget data backbone, while services and actions handle procedural interactions.
06

Runtime Introspection & Tools

The ROS ecosystem provides powerful command-line and graphical tools for runtime introspection of topics, which is critical for debugging:

  • ros2 topic list: Lists all active topics.
  • ros2 topic echo <topic_name>: Prints messages published to a topic.
  • ros2 topic info <topic_name>: Shows the topic's message type, publishers, and subscribers.
  • ros2 topic hz <topic_name>: Calculates the publishing rate.
  • rqt_graph: Visualizes the live node and topic graph. These tools make the dynamic communication topology visible and debuggable.
ROS COMMUNICATION PRIMER

How ROS Topic Communication Works

ROS Topics form the backbone of asynchronous, many-to-many data exchange in robotic systems, enabling loosely coupled communication between nodes.

A ROS Topic is a named communication channel that facilitates the asynchronous, many-to-many exchange of strictly typed data messages between nodes using a publish-subscribe pattern. Publishers broadcast messages to a topic without knowledge of subscribing nodes, while subscribers receive messages from topics of interest, creating a decoupled and scalable data flow. This model is ideal for continuous data streams like sensor readings (e.g., /camera/image_raw) or velocity commands (/cmd_vel).

Communication is managed by a ROS Master (in ROS 1) or via decentralized discovery using DDS (in ROS 2), which handles node registration and topic matching. The data structure is defined by a ROS Message (.msg file), ensuring type safety. Quality of Service (QoS) policies in ROS 2 allow fine-tuning of reliability, durability, and delivery guarantees, making topics suitable for both best-effort telemetry and real-time control loops within the ROS Graph.

COMMUNICATION MODEL COMPARISON

ROS Topic vs. Other ROS Communication Patterns

A feature comparison of the primary communication patterns available within the Robot Operating System (ROS) framework, highlighting their distinct use cases, synchronization models, and data flow characteristics.

FeatureTopic (Publish/Subscribe)Service (Request/Response)Action (Goal/Feedback/Result)

Communication Model

Asynchronous, one-way stream

Synchronous, blocking call

Asynchronous, long-running task

Data Flow Pattern

Many-to-many

One-to-one (client/server)

One-to-one (client/server)

Primary Use Case

Continuous sensor data, state broadcasts

On-demand computation, configuration queries

Long-duration tasks (navigation, manipulation)

Built on Top Of

Core DDS pub/sub

Two paired DDS topics (request/reply)

Five DDS topics (goal, cancel, result, feedback, status)

Client Blocking Behavior

Non-blocking (fire-and-forget)

Blocks until response or timeout

Non-blocking; can poll for result or cancel

Feedback Mechanism

None (only periodic data)

None (single reply only)

Yes (periodic feedback stream)

Preemption/Cancellation

No

No (request must complete)

Yes (client can send cancel goal)

Typical Latency

Low (direct pub/sub)

Medium (server processing time)

Variable (task duration)

QoS Policy Applicability

Full (Reliability, Durability, Deadline)

Limited (applies to request/reply topics)

Full (separate policies per underlying topic)

Example ROS 2 Package

rclcpp::Publisher / rclcpp::Subscription

rclcpp::Service / rclcpp::Client

rclcpp_action::Server / rclcpp_action::Client

ROS TOPIC

Frequently Asked Questions

A ROS Topic is the primary mechanism for asynchronous, many-to-many data exchange in the Robot Operating System. This FAQ addresses common questions about its operation, design, and role in robotic software architecture.

A ROS Topic is a named communication channel that facilitates asynchronous, many-to-many data exchange between ROS Nodes using a publish-subscribe model. A node that produces information publishes messages to a topic, while nodes that need that information subscribe to the same topic. The ROS Master facilitates the initial connection (discovery) between publishers and subscribers, after which they communicate peer-to-peer. Messages are transmitted as serialized data structures defined by ROS Message (.msg) files. This decoupled architecture allows sensor data (e.g., from a camera node) to be broadcast to multiple consumer nodes (e.g., for perception, logging, and visualization) simultaneously without the publishers needing to know the subscribers exist.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.