Repository Summary
Description | Example project of DDS-TSN integration |
Checkout URI | https://github.com/nxp/dds-tsn.git |
VCS Type | git |
VCS Version | main |
Last Updated | 2023-05-03 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
Name | Version |
---|---|
dds_tsn_demo | 0.0.1 |
README
DDS-TSN integration demo
This repository demonstrates basic advantages of integrating the Data Distribution Service (DDS) and Time-Sensitive Networking (TSN) Ethernet. The demo is based on the Gazebo plugin gazebo_ros_diff_drive
, modeling a differential drive vehicle in the Robot Operating System (ROS) 2 environment, as well as on the GNU/Linux VLAN and traffic control framework.
The structure of this repository is as follows:
-
dds_tsn_demo
: the ROS2 application implementation for the demo; -
scripts
: script to bring up VLAN interface with QoS configuration on Linux; -
tools
: a traffic analysis framework and tools to analyze.pcapng
files for a specific protocol; -
images
: system block diagram of the demo. -
licenses
: license files
The demo video below shows the challenging moose test in the Gazebo simulator, where the white ego vehicle performs a time-critical evasive maneuver. Three different scenarios are shown:
- successful driving without intereference,
- collisions due to network interference without TSN features,
- TSN features enable a successful drive with network interference.
https://user-images.githubusercontent.com/88086083/140656406-81919e7b-8d37-4a7a-a331-be7cd32f6673.mp4
As illustrated below, this demo uses three machines connected to a TSN Ethernet switch, imitating a robot sharing Ethernet links for streams with different criticality levels.
The components in grey are used for performance measurement, which we descrbe in deatail in the measurement section below.
Machine C
runs the Gazebo simulation. The control of the modeled vehicle runs on an embedded controller machine A
and publishes the safety-critical topic /command
based on the data from the /odometry
topic.
An interference machine B
floods the egress of port 3
and interfere with the control traffic in the /command
topic.
This interference is likely to trigger a collision in the simulation.
Interference may originate from a bug in machine B
, see the bug icon, or from a network design sharing an Ethernet link between traffic streams with different criticality levels, see the fire icon.
Fortunately, if we link the safety-critical DDS topic /command
to a TSN stream with a high priority using
IEEE 802.1Q Priority-Based Scheduling (PBS
), then the vehicle completes the moose test successfully.
Furthermore, we can de-burst the interference traffic using the TSN’s protocol
IEEE 802.1Qav Credit-Based Shaper (CBS
) to ensure its egress bandwidth is limited.
The DDS-TSN mapping demo instructions below leverage the DDS XML profiles for Connext DDS and Fast DDS. The XML files bind the DDS communication sockets to the VLAN interface, which has a built-in VLAN tagging rule assigning the outgoing traffic a higher priority, as we describe in configuration Option A
. Another option is to map the DSCP/TOS filed in the IP header to the VLAN PCP value, which we describe in configuration Option B
.
Prerequisites
- Three machines with Ubuntu 20.04, machines A and B can be embedded ARM-based systems, machine C will benefit from a discrete GPU.
- A TSN-capable Ethernet switch with PCP and VLAN support included in IEEE 802.1Q-2014 and onwards. For example, the NXP SJA1110. In our experiment, we use the SJA1110 switch on the S32G-VNP-RDB board, which is the S32G reference design for vehicle network processing.
- ROS2 Foxy base and
iproute2
for thetc
command on machine A: follow the official ROS2 installation instructions to install ROS2 Foxy base. Then install other dependencies:
sudo apt install -y python3-colcon-ros iproute2
- To use configuration Option B described in the Configuration section below, build the following kernel modules for machine A to enable Linux Traffic Control (tc) actions, packet classification, and U32 filter for outgoing packets:
CONFIG_NET_CLS_ACT=y
CONFIG_NET_CLS_FLOW=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NET_CLS_U32=y
CONFIG_CLS_U32_MARK=y
In our experiment, the machine A runs on the i.MX 8M NavQ Linux companion computer platform. The NavQ kernel can be configured and built following instructions here.
-
iperf3
on machine B:
sudo apt install -y iperf3
- ROS2 Foxy and Gazebo on machine C: follow the official ROS2 installation instructions to install ROS2 Foxy desktop. Then install Gazebo and other dependencies:
sudo apt install -y python3-colcon-ros ros-foxy-gazebo-ros ros-foxy-gazebo-plugins iperf3 iproute2
Installation
- Our demonstration supports the Fast DDS, which is pre-installed and the default DDS middleware layer in ROS2 Foxy, and the RTI Connext DDS. The RTI Connext DDS can be installed by following the documentation here on machines A and C.
- For an Intel machine:
# install free debian packages for Connext DDS on Intel machine
sudo apt install -y ros-foxy-rmw-connext-cpp
source /opt/ros/foxy/setup.bash
git clone https://github.com/rticommunity/rmw_connextdds.git ~/rmw_connextdds
cd ~/rmw_connextdds
git checkout foxy
colcon build
# run the following commands in each new shell to choose this DDS distribution
source ~/rmw_connextdds/install/setup.sh
export RMW_IMPLEMENTATION=rmw_connextdds
- For an ARM machine: the free Debian package of Connext DDS is not available for `arm64`, however, you can download Connext DDS Professional from [here](https://www.rti.com/products) and build it on the `arm64` target. 1. Build the code from the repository root directory (with this README) on machines A and C. If you use the Connext DDS, set the environment as described in the previous step.
git clone https://github.com/NXP/dds-tsn.git
cd dds-tsn
source /opt/ros/foxy/setup.bash
colcon build
source install/setup.sh
Configuration
Option A: VLAN-to-PCP mapping using egress-qos-map
No specific Linux kernel modules are required for this option.
On machine A, create a VLAN interface with the IP address ending with .2
:
./scripts/make_vlan.bash
Most likely you’ll need to override network variables in the script for your system. For example, to use the physical interface eth0
, netmask 10.10.*.*
, and a specific egress-qos-map value (other than the default 0:5
):
PIF=eth0 NETMASK=10.10 EGRESS_QOS_MAP="egress-qos-map 0:4" ./scripts/make_vlan.bash
File truncated at 100 lines see the full file