Implementation of DDS (Data Distribution Service) on Jetson Nano for Real-Time IoT Communication
Objective
To implement DDS (Data Distribution Service) on Jetson Nano for high-performance, real-time IoT messaging. DDS is widely used in autonomous systems, robotics, industrial automation, and edge computing due to its low-latency, high-reliability, and decentralized architecture.
Methodology
- Install a DDS Middleware (Fast DDS or Eclipse Cyclone DDS) on Jetson Nano.
- Set up a DDS Publisher and Subscriber for sensor data transmission.
- Use Python or C++ to publish sensor data from Jetson Nano.
- Visualize real-time data on a remote device using DDS communication.
Implementation Steps
Hardware Requirements
1Jetson Nano (2GB/4GB)
2Raspberry Pi (for cross-device communication test, optional)
3Sensors (DHT11, MPU6050, etc.)
4Ethernet or Wi-Fi connectivity
Step 1: Install Fast DDS on Jetson Nano
1Update Jetson Nano:
2`sudo apt update && sudo apt upgrade -y`
3Install dependencies:
4`sudo apt install -y cmake g++ python3-pip git libasio-dev libtinyxml2-dev`
5Clone and install Fast DDS:
6`git clone --recurse-submodules https://github.com/eProsima/Fast-DDS.git`
7`cd Fast-DDS && mkdir build && cd build`
8`cmake ..`
9`make -j$(nproc)`
10`sudo make install`
Step 2: Configure Fast DDS
1Verify installation:
2`fastdds --help`
3Set environment variable:
4`export FASTRTPS_DEFAULT_PROFILES_FILE=$HOME/.fastdds/DEFAULT_FASTRTPS_PROFILES.xml`
5Create `DEFAULT_FASTRTPS_PROFILES.xml` file in `~/.fastdds/` with the following content:
6<?xml version="1.0" encoding="UTF-8"?>
7 <profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
8 <participant profile_name="default_participant_profile">
9 <rtps>
10 <name>JetsonNano_Participant</name>
11 </rtps>
12 </participant>
13 </profiles>
Step 3: Create DDS Publisher on Jetson Nano
Python code for DDS Publisher that reads data from a DHT11 sensor and publishes it to the DDS network.
1import fastdds
2 import time
3 import Adafruit_DHT
4
5 DHT_SENSOR = Adafruit_DHT.DHT11
6 DHT_PIN = 4
7
8 class TemperaturePublisher:
9 def __init__(self):
10 self.participant = fastdds.DomainParticipant(0)
11 self.publisher = self.participant.create_publisher()
12 self.topic = self.participant.create_topic("SensorData", fastdds.STRING_TYPE)
13 self.writer = self.publisher.create_datawriter(self.topic)
14
15 def publish(self):
16 while True:
17 humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN)
18 if humidity is not None and temperature is not None:
19 message = f'Temperature: {temperature}°C, Humidity: {humidity}%'
20 self.writer.write(message)
21 print(f"Published: {message}")
22 time.sleep(2)
23
24 if __name__ == "__main__":
25 pub = TemperaturePublisher()
26 pub.publish()
Step 4: Create DDS Subscriber on Jetson Nano or Another Device
Python code for DDS Subscriber that listens to the `SensorData` topic.
1import fastdds
2
3 class TemperatureSubscriber:
4 def __init__(self):
5 self.participant = fastdds.DomainParticipant(0)
6 self.subscriber = self.participant.create_subscriber()
7 self.topic = self.participant.create_topic("SensorData", fastdds.STRING_TYPE)
8 self.reader = self.subscriber.create_datareader(self.topic)
9
10 def listen(self):
11 while True:
12 data = self.reader.read()
13 if data:
14 print(f"Received: {data}")
15
16 if __name__ == "__main__":
17 sub = TemperatureSubscriber()
18 sub.listen()
Step 5: Testing DDS Communication
1Run the DDS Publisher on Jetson Nano:
2`python3 dds_publisher.py`
3Run the DDS Subscriber on another Jetson Nano or Raspberry Pi:
4`python3 dds_subscriber.py`
5Verify real-time data exchange over DDS.
Step 6: Visualizing Data in Real-Time
1Use Fast DDS Monitor to check real-time DDS traffic:
2`fastdds_monitor`
3Connect DDS to IoT dashboards like Grafana or ThingsBoard for visualization.
4Enable Quality of Service (QoS) policies for real-time reliability in edge/robotic systems.
Applications
- Autonomous vehicles and robotics where low-latency communication is critical.
- Real-time industrial control systems over local DDS mesh networks.
- Smart factories using DDS for machine-to-machine (M2M) communication.
Future Research Concepts
- Integrating DDS with ROS2 (Robot Operating System) for real-time robotics.
- Implementing secure DDS with RTPS over TLS.
- Deploying large-scale DDS-based networks using edge clusters and Jetson nodes.