Svashasan Logo
Simulated data

Robotics and Middleware · ROS 2 concept

ROS 2 Topic

Also known as ROS topic, publisher, subscription, ROS message

BeginnerSource-checked · awaiting technical reviewLast reviewed 6 December 2026

A named, strongly typed publish-subscribe channel in ROS 2 for continuous data streams such as sensor readings and robot state, on which any number of publishers and subscribers exchange messages anonymously.

Explanation

Topics are one of the three main ROS 2 interface styles, alongside services and actions. Publishers and subscribers that use the same topic name communicate directly, and a topic can have zero or more of each. Communication is anonymous: a subscriber does not normally know which publisher sent a sample, so components can be swapped without affecting the rest of the system.

Topics are strongly typed. Each message type defines typed fields with well-defined meanings; for example, IMU messages specify angular velocity in radians per second. Every publisher and subscription has a QoS profile, and a connection is made only if the profiles are compatible. A reliable subscription, for instance, will not match a best-effort publisher.

Topics suit data streams and broadcast state, not request-response interactions. Message size and rate drive bandwidth and latency, so large data such as images benefits from intra-process or shared-memory transport.

How it works

A node creates a publisher for a topic name and message type and publishes message instances. The middleware serialises each message (for DDS, through generated type support) and sends it to all matched subscriptions, each of which invokes a callback for every message. Topics can be inspected at runtime; for example, recording simply adds another subscriber without disturbing the existing data flow.

Automotive applications

  • Streaming camera, LiDAR and radar data
  • Publishing localisation and odometry estimates
  • Broadcasting vehicle state and diagnostics
  • Recording data for offline analysis

Example

A LiDAR driver publishes sensor_msgs/PointCloud2 messages on /lidar/front/points at 10 Hz with the sensor-data QoS profile. A ground-segmentation node and a recorder both subscribe, and replacing the driver with a simulator publishing on the same topic needs no change to either consumer.

An illustrative example: any figures in it are worked numbers, not measurements.

References

  1. Topics (ROS 2 documentation source) (opens in a new tab)

    Open Robotics / ROS 2 documentation project · Project documentation · Publish/Subscribe; Anonymous; Strongly-typed; source of the docs.ros.org rolling page; docs.ros.org blocked automated access · retrieved 6 December 2026

    “Topics should be used for continuous data streams, like sensor data, robot state, etc.”
  2. Quality of Service settings (ROS 2 documentation source) (opens in a new tab)

    Open Robotics / ROS 2 documentation project · Project documentation · QoS compatibilities; source of the docs.ros.org rolling page; docs.ros.org blocked automated access · retrieved 6 December 2026

Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.