Skip to main content

What is RTPS?

RTPS (Real-Time Publish Subscribe) is the wire protocol that enables DDS implementations to communicate with each other. Defined by OMG, it specifies exactly how messages are formatted and exchanged over the network.

Why RTPS Matters

RTPS is what makes DDS interoperable. Any compliant DDS implementation—whether HDDS, FastDDS, CycloneDDS, or RTI Connext—can communicate if they speak the same RTPS version.

RTPS Versions

VersionYearKey Features
2.02008Original specification
2.12010Security extensions
2.22014Performance improvements
2.32019Writer liveliness, content filters
2.52022Large data, participant redundancy

HDDS implements RTPS 2.5 with backward compatibility to 2.3.

Protocol Architecture

Message Structure

Every RTPS message consists of:

┌────────────────────────────────────────────────────────┐
│ RTPS Header │
│ ┌──────────┬──────────┬──────────┬─────────────────┐ │
│ │ Protocol │ Version │ Vendor │ GuidPrefix │ │
│ │ "RTPS" │ 2.5 │ HDDS │ 12 bytes │ │
│ └──────────┴──────────┴──────────┴─────────────────┘ │
├────────────────────────────────────────────────────────┤
│ Submessages │
│ ┌────────────────────────────────────────────────┐ │
│ │ Submessage 1 (e.g., DATA) │ │
│ └────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────┐ │
│ │ Submessage 2 (e.g., HEARTBEAT) │ │
│ └────────────────────────────────────────────────┘ │
│ ... │
└────────────────────────────────────────────────────────┘

Submessage Types

SubmessagePurpose
DATACarries user data samples
DATA_FRAGFragmented data for large samples
HEARTBEATAnnounces available sequence numbers
ACKNACKAcknowledges/requests data
GAPIndicates missing sequence numbers
INFO_TSProvides timestamp information
INFO_DSTSpecifies destination participant
INFO_SRCSpecifies source participant

Discovery Protocol

RTPS defines two discovery protocols:

SPDP (Simple Participant Discovery Protocol)

Discovers other participants in the domain:

  1. Each participant sends periodic announcements to a well-known multicast address
  2. Announcements include participant GUID, endpoints, and locators
  3. Other participants learn about new joiners

SEDP (Simple Endpoint Discovery Protocol)

Discovers endpoints (writers and readers):

  1. After participant discovery, endpoints are exchanged via unicast
  2. Each participant learns about remote writers/readers
  3. Matching (compatible QoS) writers and readers connect

Port Mapping

RTPS uses a deterministic port mapping based on domain ID:

Discovery Multicast Port = 7400 + (250 × domainId)
Discovery Unicast Port = 7410 + (250 × domainId) + (2 × participantId)
User Multicast Port = 7401 + (250 × domainId)
User Unicast Port = 7411 + (250 × domainId) + (2 × participantId)

Example for Domain 0, Participant 0:

Port TypePort Number
Discovery Multicast7400
Discovery Unicast7410
User Multicast7401
User Unicast7411
Firewall Configuration

Ensure ports 7400-7500 (and higher for multi-domain) are open for DDS traffic.

Data Serialization (CDR)

RTPS uses CDR2 (Common Data Representation) for serialization:

  • Platform-independent - Works across different CPU architectures
  • Self-describing - Optional type information included
  • Efficient - Minimal overhead compared to JSON/XML
CDR2 Serialization of Temperature { sensor_id: "room1", value: 23.5 }

┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ 0x00 │ 0x01 │ 0x00 │ 0x00 │ 'r' │ 'o' │ 'o' │ 'm' │
├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ '1' │ 0x00 │ padding │ padding │ 0x41 │ 0xBC │ 0x00 │ 0x00 │
└─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘
└─ string length ─┘ └── "room1" + null ──┘ └── 23.5 as f32 (LE) ──┘

Reliability Protocol

RTPS implements reliability through:

Best-Effort

  • Fire and forget
  • No acknowledgments
  • Lowest latency

Reliable

  • HEARTBEAT announces available samples
  • ACKNACK requests missing samples
  • Retransmission ensures delivery

RTPS vs Other Protocols

FeatureRTPSMQTTAMQPZeroMQ
BrokerNoneRequiredRequiredOptional
MulticastYesNoNoYes
QoSRich (22 policies)3 levelsBasicNone
DiscoveryAutomaticManualManualManual
Real-timeYesNoNoPartial
StandardOMGOASISOASISNone

Debugging RTPS

Using Wireshark

Wireshark has a built-in RTPS dissector:

  1. Capture traffic on UDP ports 7400-7500
  2. Filter: rtps
  3. Inspect individual submessages

Using hdds_viewer

Our hdds_viewer tool provides:

  • Live RTPS traffic capture
  • Message decoding with type information
  • Topology visualization
  • Latency analysis

Next Steps

Now you understand how DDS works under the hood. Let's get HDDS installed: