sondahub

sondahub / DDS simulator

DDS simulator

A DDS participant with two worlds behind it: a ROS 2 robot that drives itself around a room — pose, lidar, camera, battery, the talker’s chatter — until you take over on /cmd_vel, and a pumping plant on keyed topics whose setpoints you write. Real RTPS: discovery, reliability, durability, keys and fragments, over UDP or Fast DDS’s TCP, with DDS Security if you want it, through a bridge that lends it ports on your computer.

Free, nothing to install but the bridge. Each connection gets its own participant, robot and plant.

Connect

Address
wss://api.sondahub.com/dds
From a DDS client
through the bridge: node bridge.mjs dds [domain] [tcp port] [--secure]
Domain
0, or the one you give the bridge (0 to 232)
Discovery
peer 127.0.0.1, or multicast 239.255.0.1:7400
Over TCP
127.0.0.1:5100, for Fast DDS’s TCPv4 transport
Security
with --secure: DDS Security, the playground PKI
Wire
DDSI-RTPS 2.3 over UDPv4 or TCPv4; samples in XCDR1, little-endian
Text messages
JSON, for any WebSocket client

The bridge binds the first free pair of ports of the standard mapping — 7410 for discovery and 7411 for data on domain 0, then 7412 and 7413, and so on — joins the discovery multicast group on every interface it can, listens on TCP port 5100 for Fast DDS over TCP, and carries each datagram and frame to the hub and back. The hub announces itself to the participants it can reach on your computer and answers the ones that announce themselves. The bridge prints what the hub finds and matches, and when a reader or writer does not match, why:

Run the bridge
curl -O https://sondahub.com/industrial/bridge.mjs
node bridge.mjs dds

DDS domain 0 · participant 0 · ports 7410 (discovery) and 7411 (data) · group 239.255.0.1:7400 · TCP 5100
→ wss://api.sondahub.com/dds — a client on this computer finds it at the peer 127.0.0.1 or by multicast
the hub is participant c3ff6f8d.3fb2ad77.3da88626 on domain 0
found participant 01106bff.9963e1f8.20b0bbbe — Cyclone DDS — at 127.0.0.1:7412
their reader on rt/chatter: matched — reliable, volatile
their writer on rt/cmd_vel: matched — the hub reads it, best effort
their reader on PlantReadings: not matched — type Reading, the hub's is plant::Reading

In a DDS client

Start the bridge first. Then point the client’s discovery at it: a unicast peer at 127.0.0.1 finds it on its own (DDS tries the ports of the first participant indexes; if the bridge says it took participant 2, the port is 7414), or multicast on the loopback or any interface the bridge joined. Use domain 0 unless you gave the bridge another one. Declare the types from sondahub-dds.idl exactly as they are — DDS matches types by their full names — and subscribe or publish. A Fast DDS client can come over TCP instead, and a client with DDS Security turned on needs the bridge started with --secure and the playground PKI.

In LockFlare Sonda: Discovery Peers only with the peer 127.0.0.1, the loopback interface (lo0 on macOS), and the types from the IDL file.

Topics

The robot, as ROS 2 sees it

A small differential-drive robot in an 8 × 8 m room with a pillar and a crate. It drives itself, turning away from what its lidar sees, until something arrives on rt/cmd_vel.

TopicWhat it carries
rt/chatter
ROS 2: /chatter
std_msgs::msg::dds_::String_
The hub writes it · 1 Hz
“Hello World: 1”, “Hello World: 2”… — what the ROS 2 demo talker says, so the demo listener hears it.
rt/robot/pose
ROS 2: /robot/pose
geometry_msgs::msg::dds_::PoseStamped_
The hub writes it · 5 Hz
Where the robot is, in the frame map: metres from the middle of an 8 × 8 m room, heading as a quaternion about z.
rt/robot/scan
ROS 2: /robot/scan
sensor_msgs::msg::dds_::LaserScan_
The hub writes it · 2 Hz
A 360° lidar, 180 rays two degrees apart from −π, ranging the walls, a pillar and a crate. No intensities.
rt/camera/image
ROS 2: /camera/image
sensor_msgs::msg::dds_::Image_
The hub writes it · 1 Hz
What the robot’s camera sees, 160 × 120 rgb8 (57,600 bytes of pixels): too big for one datagram, so every sample travels in 43 fragments, and a reader that loses one asks for it again.
rt/robot/battery
ROS 2: /robot/battery
sensor_msgs::msg::dds_::BatteryState_
The hub writes it · 1 Hz
A six-cell lithium-ion pack draining faster when the robot moves; at 15 % it charges where it stands, back to 95 %.
rt/cmd_vel
ROS 2: /cmd_vel
geometry_msgs::msg::dds_::Twist_
The hub reads it
Drives the robot: linear.x (−1 to 1 m/s) and angular.z (−2 to 2 rad/s). A command holds for 1.5 s; ten seconds after the last one the robot drives itself again.

The plant, as plain DDS

A tank filled through an inlet valve and pumped down through a filter: keyed topics, one instance per sensor, alarm and setpoint.

TopicWhat it carries
PlantReadings
plant::Reading
key: sensor
The hub writes it · 1 Hz × 6
One instance per sensor: TANK-LEVEL, FLOW-IN, FLOW-OUT, PUMP-SPEED, MOTOR-TEMP, FILTER-DP.
PlantAlarms
plant::Alarm
key: name
The hub writes it · on change
One instance per alarm — FILTER-DP, LEVEL-HIGH, MOTOR-HOT, SETPOINT — written when it raises or clears. The filter clogs every five minutes on its own.
PlantSetpoints
plant::Setpoint
key: name
The hub reads it
PUMP-SPEED (0 to 1800 rpm, 1200 to start with) and INLET-VALVE (0 to 100 %, 60 to start with). Anything else raises the SETPOINT alarm.

Types

All of them, with what they use, in one file: sondahub-dds.idl. The ROS 2 types keep their DDS names — geometry_msgs::msg::dds_::Twist_ — and their fields as ROS 2 defines them. The plant’s keyed types bound their key strings to 11 characters, so the key fits the 16 bytes of an RTPS key hash as it is.

plant::Setpoint
module plant {
struct Setpoint {
  @key string<11> name;
  double value;
};
};

The hub writes XCDR1 (encapsulation CDR_LE). It reads XCDR1 and XCDR2 — final or appendable types, either byte order; mutable types (parameter-list encodings) are not read.

QoS and matching

EndpointsWhat they offer or ask
The hub’s writersReliable, transient-local, keep last 10 of each instance, XCDR1, the default partition. Heartbeats every second, NACKs answered, a GAP for what is no longer kept.
The hub’s readersBest effort, volatile, XCDR1 and XCDR2, the default partition: any writer on the topic matches.
The participantVendor id 0x0000 (no vendor’s implementation), lease 30 s, an announcement every 3 s; it drops a participant whose lease runs out.

A match needs the same topic name and the same type name (no type information is exchanged), a durability the hub can give (volatile or transient-local; transient and persistent readers are refused), the default partition, and a data representation both sides take. A late transient-local reader gets the last ten samples of each instance before the live ones.

A camera frame is about 57 KB, more than a UDP datagram carries, so the hub sends each sample of rt/camera/image as 43 DATA_FRAG submessages of 1,344 bytes, one to a datagram, and its heartbeats let a reliable reader ask with NACK_FRAG for just the fragments it lost. It reassembles fragmented samples it reads, too. Set your reader to reliable to see the repair; a best-effort reader drops a frame that lost a fragment.

The plant

The pump starts when the tank reaches 4 m and stops at 1 m; between them, the inlet fills it and the pump empties it, about a twelve-minute cycle as it starts. The filter clogs on its own and backwashes every five minutes, raising and clearing FILTER-DP.

PlantReadings

SensorNotes
TANK-LEVEL
unit m
Level in the tank, 0 to 5 m. The pump starts at 4 m and stops at 1 m.
FLOW-IN
unit m3/h
Into the tank, through the inlet valve: 0.3 m³/h per percent open.
FLOW-OUT
unit m3/h
Pumped out: 45 m³/h at 1800 rpm, less as the filter clogs.
PUMP-SPEED
unit rpm
Ramps 200 rpm a second to the setpoint while the pump runs.
MOTOR-TEMP
unit degC
Settles at 25 °C plus 45 °C × (speed / 1800)², with a minute’s lag.
FILTER-DP
unit kPa
Across the filter: climbs from 20 to 85 kPa in five minutes, then a ten-second backwash.

PlantAlarms

AlarmNotes
FILTER-DP
severity 2
Filter differential pressure at 80 kPa or above; clears below 75 (after the backwash).
LEVEL-HIGH
severity 3
Tank at 4.5 m or above; clears below 4.3 m. Open the inlet or slow the pump to see it.
MOTOR-HOT
severity 2
Motor at 60 °C or above; clears below 55 °C. Run the pump at 1800 rpm for a couple of minutes.
SETPOINT
severity 1
The last setpoint was refused (unknown name or out of range); the next good one clears it.

PlantSetpoints

SetpointNotes
PUMP-SPEED
0–1800 rpm
The speed the pump runs at when it runs; 1200 rpm to start with. At 1800 the motor heats past 60 °C.
INLET-VALVE
0–100 %
How far the inlet is open; 60 % to start with. Open it and slow the pump to raise LEVEL-HIGH.

Over TCP

Fast DDS can carry RTPS over TCP instead of UDP: its TCPv4 transport frames each message with a small header of its own and opens logical ports inside one connection. The bridge listens on TCP port 5100 — or the next free one up to 5109, or the port you give it after the domain — and carries each frame to the hub, which answers the transport’s control messages (bind, open logical port, check ports, keep-alive) and serves discovery and data on logical ports 7410 and 7411. A Fast DDS participant needs only the hub as its initial peer:

sondahub-tcp.xml (Fast DDS)
<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
  <profiles>
    <transport_descriptors>
      <transport_descriptor>
        <transport_id>tcp</transport_id>
        <type>TCPv4</type>
      </transport_descriptor>
    </transport_descriptors>
    <participant profile_name="sondahub">
      <rtps>
        <userTransports>
          <transport_id>tcp</transport_id>
        </userTransports>
        <useBuiltinTransports>false</useBuiltinTransports>
        <builtin>
          <initialPeersList>
            <locator>
              <tcpv4>
                <address>127.0.0.1</address>
                <physical_port>5100</physical_port>
              </tcpv4>
            </locator>
          </initialPeersList>
        </builtin>
      </rtps>
    </participant>
  </profiles>
</dds>

Load the file and create the participant from the profile sondahub, or add is_default_profile="true" to it and point FASTRTPS_DEFAULT_PROFILES_FILE at the file (FASTDDS_DEFAULT_PROFILES_FILE from Fast DDS 3 on), which is how a ROS 2 node on Fast DDS picks it up. The client dials and the hub answers on the same connection, so nothing listens on your side. Only Fast DDS’s framing is understood: other implementations carry RTPS over TCP their own way.

DDS Security

Start the bridge with --secure and the hub’s participant uses the builtin plugins of DDS Security 1.1: PKI-DH to authenticate, Access-Permissions to check what each side may do, AES-GCM-GMAC to encrypt. It then talks only to participants that hold a certificate from the playground identity CA and permissions signed by the playground permissions CA. It is a playground, so the whole PKI is published below, the CA keys too: use the ready-made client identity, or issue your own.

Run the bridge with security
node bridge.mjs dds --secure

DDS domain 0 · participant 0 · ports 7410 (discovery) and 7411 (data) · group 239.255.0.1:7400 · TCP 5100 · DDS Security
→ wss://api.sondahub.com/dds — a client on this computer finds it at the peer 127.0.0.1 or by multicast
the hub is participant 800000da.27fea572.3477c5a8 on domain 0, secure, as C=US, O=sondahub, OU=hub-33791205, CN=sondahub hub
found participant f4a02a1a.ef5661d2.999e1ebd — Cyclone DDS — at 127.0.0.1:7412
participant f4a02a1a.ef5661d2.999e1ebd authenticated: C=US, O=sondahub, OU=playground, CN=sondahub client, grant sondahub_client
their reader on rt/chatter: matched — reliable, volatile, encrypted
their writer on rt/cmd_vel: matched — the hub reads it, best effort, encrypted

The playground PKI

FileWhat it is
identity_ca.pem
key: identity_ca_key.pem
The identity CA. It issued the hub’s certificate and the client’s; the hub accepts a certificate it issued directly.
permissions_ca.pem
key: permissions_ca_key.pem
The permissions CA. It signed the governance and the permissions documents.
governance.p7s
to read: governance.xml
The domain rules, signed. Use it as it is.
client.pem
key: client_key.pem
A client identity ready to use: CN=sondahub client, OU=playground, O=sondahub, C=US, with an ECDSA P-256 key.
client_permissions.p7s
to read: client_permissions.xml
Its permissions: the grant sondahub_client, to publish and subscribe to every topic on domains 0 to 230.
Get the files
mkdir dds-security && cd dds-security
for f in identity_ca.pem permissions_ca.pem governance.p7s client.pem client_key.pem client_permissions.p7s; do
  curl -O https://sondahub.com/industrial/dds-security/$f
done

The rules, for domains 0 to 230: no unauthenticated participants, join access control on, discovery, liveliness and RTPS messages unprotected, and every topic with read and write access control and its data encrypted, its metadata plain. A client whose own governance asks for something else on a topic — protected discovery, signed or encrypted submessages — does not match the hub there, and the bridge says why.

Cyclone DDS

Point CYCLONEDDS_URI at a file like this, with the paths where you put the files:

cyclonedds-secure.xml
<CycloneDDS>
  <Domain id="any">
    <Discovery>
      <ParticipantIndex>auto</ParticipantIndex>
      <Peers><Peer address="127.0.0.1"/></Peers>
    </Discovery>
    <Security>
      <Authentication>
        <Library path="dds_security_auth" initFunction="init_authentication" finalizeFunction="finalize_authentication"/>
        <IdentityCA>file:/path/to/dds-security/identity_ca.pem</IdentityCA>
        <IdentityCertificate>file:/path/to/dds-security/client.pem</IdentityCertificate>
        <PrivateKey>file:/path/to/dds-security/client_key.pem</PrivateKey>
      </Authentication>
      <AccessControl>
        <Library path="dds_security_ac" initFunction="init_access_control" finalizeFunction="finalize_access_control"/>
        <PermissionsCA>file:/path/to/dds-security/permissions_ca.pem</PermissionsCA>
        <Governance>file:/path/to/dds-security/governance.p7s</Governance>
        <Permissions>file:/path/to/dds-security/client_permissions.p7s</Permissions>
      </AccessControl>
      <Cryptographic>
        <Library path="dds_security_crypto" initFunction="init_crypto" finalizeFunction="finalize_crypto"/>
      </Cryptographic>
    </Security>
  </Domain>
</CycloneDDS>

Fast DDS

The same as participant properties, in an XML profile or set in code on the participant’s QoS. Over TCP, put the propertiesPolicy in the TCP profile’s participant.

sondahub-secure.xml (Fast DDS)
<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
  <profiles>
    <participant profile_name="sondahub">
      <rtps>
        <propertiesPolicy>
          <properties>
            <property><name>dds.sec.auth.plugin</name><value>builtin.PKI-DH</value></property>
            <property><name>dds.sec.auth.builtin.PKI-DH.identity_ca</name><value>file:///path/to/dds-security/identity_ca.pem</value></property>
            <property><name>dds.sec.auth.builtin.PKI-DH.identity_certificate</name><value>file:///path/to/dds-security/client.pem</value></property>
            <property><name>dds.sec.auth.builtin.PKI-DH.private_key</name><value>file:///path/to/dds-security/client_key.pem</value></property>
            <property><name>dds.sec.access.plugin</name><value>builtin.Access-Permissions</value></property>
            <property><name>dds.sec.access.builtin.Access-Permissions.permissions_ca</name><value>file:///path/to/dds-security/permissions_ca.pem</value></property>
            <property><name>dds.sec.access.builtin.Access-Permissions.governance</name><value>file:///path/to/dds-security/governance.p7s</value></property>
            <property><name>dds.sec.access.builtin.Access-Permissions.permissions</name><value>file:///path/to/dds-security/client_permissions.p7s</value></property>
            <property><name>dds.sec.crypto.plugin</name><value>builtin.AES-GCM-GMAC</value></property>
          </properties>
        </propertiesPolicy>
      </rtps>
    </participant>
  </profiles>
</dds>

Your own identity

The hub takes any certificate the playground identity CA issued directly — ECDSA P-256 only, no RSA and no intermediate CA — with permissions signed by the playground permissions CA that grant its subject the domain. With openssl:

Issue a certificate and its permissions
cd dds-security
for f in identity_ca_key.pem permissions_ca_key.pem client_permissions.xml; do curl -O https://sondahub.com/industrial/dds-security/$f; done

openssl ecparam -name prime256v1 -genkey -noout -out me_key.pem
openssl req -new -key me_key.pem -subj "/C=US/O=sondahub/CN=my client" -out me.csr
openssl x509 -req -in me.csr -CA identity_ca.pem -CAkey identity_ca_key.pem \
  -CAcreateserial -days 3650 -sha256 -out me.pem

# permissions: a copy of client_permissions.xml with your subject, then signed
sed 's/CN=sondahub client,OU=playground,O=sondahub,C=US/CN=my client,O=sondahub,C=US/' \
  client_permissions.xml > me_permissions.xml
openssl smime -sign -in me_permissions.xml -text -out me_permissions.p7s \
  -signer permissions_ca.pem -inkey permissions_ca_key.pem

Then use me.pem, me_key.pem and me_permissions.p7s in place of the client’s files. Narrow the grant and your client refuses to create the readers and writers it no longer allows; the hub checks the same rules on what it discovers.

When it does not connect

The bridge says why. A participant without security, on a hub started with --secure, or the other way round:

From the bridge
participant 011064d4.ff4ae998.4be50da1 is not secure: the hub was started with --secure and talks only to participants with a playground certificate
participant f4a02a1a.ef5663f2.80729fdc uses DDS Security: start the bridge with --secure to authenticate it

And a handshake that fails names what failed: a certificate from another CA or with a key that is not P-256, permissions signed by someone else or with no grant for the certificate’s subject or the domain, a signature that does not verify.

Which side starts the handshake is decided by the participants’ GUIDs, as the specification says; the hub’s certificate gives it a GUID that starts 80 00 00, so it nearly always starts, with ECDH (ECDH-CEUM+P256). It also answers a client that starts, with ECDH or DH (DH+MODP-2048-256). Every sample is encrypted with AES-256-GCM under its writer’s key, a camera frame fragment by fragment; the keys travel on the secure volatile channel, encrypted with the key both sides derived from the handshake.

JSON, from any WebSocket client

A text message is a request: subscribe to the topics the hub writes (the present value of each instance comes first, as a transient-local reader gets it), publish to the ones it reads, or list the topics with their types and IDL. Topics answer to their DDS or their ROS 2 names. "*" is every topic but the camera, whose 57 KB a second you ask for by name; its pixels come in base64.

Requests
{"subscribe":["rt/chatter","PlantAlarms"]}
{"subscribe":"*","cdr":true}             # every topic, payloads in hex
{"publish":"/cmd_vel","sample":{"linear":{"x":0.3},"angular":{"z":0.5}}}
{"publish":"PlantSetpoints","sample":{"name":"PUMP-SPEED","value":1500}}
{"unsubscribe":"*"}
{"topics":true}
A sample
{"topic":"PlantReadings","seq":214,"time":"2026-10-07T09:04:00.165Z",
 "sample":{"sensor":"TANK-LEVEL","value":3.629,"unit":"m"}}

The bridge, on the wire

For anyone writing a bridge of their own: it opens wss://api.sondahub.com/dds and says hello in text — {"bridge":"dds","version":1,"domain":0,"participant":0,"meta":7410,"user":7411,"addresses":["127.0.0.1",…],"multicast":true,"tcp":5100,"secure":false} — then each datagram is a binary message: a byte for the port (0 discovery, 1 data, 2 the multicast group), the IPv4 address and the port (big-endian) it came from or goes to, and the datagram. The hub’s text messages are {"log":…} lines.

TCP connections ride the same WebSocket, each under an id the bridge gives it: a byte for what happened (3 a frame, 4 a connection opened, 5 one closed), the id (four bytes, big-endian), two zero bytes, then for a 3 one whole RTCP frame as it came off the stream, and for a 4 who dialed and the address they dialed, IPv4 and port each. The hub sends 3 and 5 back. "tcp":0 in the hello means no TCP; "secure":true turns on DDS Security.

Questions

Why does DDS need the bridge?

DDS travels in UDP datagrams, and only HTTP reaches sondahub — no UDP comes in. So the participant runs on the hub and the bridge lends it two UDP ports on your computer, carrying every datagram over one WebSocket. To a DDS client on your computer the hub is simply another participant on the machine, on the ports of the standard mapping.

Which DDS implementations can talk to it?

Any that speaks DDSI-RTPS 2.x over UDP and IPv4: discovery (SPDP and SEDP), reliable and best-effort endpoints, heartbeats, ACKNACKs, GAPs and fragmented samples are handled as the specification describes. Fast DDS’s TCPv4 transport works too, and DDS Security’s builtin plugins with --secure. It has been run against Eclipse Cyclone DDS and eProsima Fast DDS, with security and without, and Fast DDS over TCP.

And shared memory?

Not offered, and it cannot be: shared memory carries samples between processes that share one computer’s memory, and the hub runs somewhere else. A client with shared memory turned on alongside UDP — Fast DDS’s default — uses UDP for a participant it cannot share memory with, so it reaches the hub anyway.

Is the security real?

The cryptography is: certificates and signatures are checked, keys are agreed with ECDH or DH, and every sample is encrypted with AES-GCM. The trust is not: every key of the playground PKI is published, so anyone can issue a certificate the hub accepts. It is there to test that a client’s DDS Security works — the handshake, the permissions, the encrypted samples — never to protect anything.

Can a ROS 2 node use the robot?

Its topics are named and typed the way ROS 2 maps topics onto DDS — rt/chatter is /chatter, with std_msgs/msg/String as std_msgs::msg::dds_::String_ — on domain 0, ROS 2’s default. With the bridge running on the same computer, a node subscribes to /chatter or publishes to /cmd_vel as it would on a robot.

Does what I publish reach other people?

No. Each connection gets its own participant, robot and plant: what you publish moves your robot and your pump, and disappears with the connection. When the bridge reconnects, the hub is a new participant, and the old one leaves when its lease runs out.