FastDDS-source code compilation & installation & testing

Author of this series of tutorials: Xiaoyu
Public account: Yuxiang ROS
QQ exchange group: 139707339
Teaching video address: Xiaoyu's B station
Full document address: Yuxiang ROS official website
Copyright statement: Reprinting and commercial use are prohibited unless permitted.
No public

Hello everyone, I'm Xiaoyu. Yesterday, I was urged by friends in the group in the DDS-related article. I said that the source code is good to experience DDS. Xiaoyu can no longer coo, so I will share it today, FastDDS installation and experience.

1. On the three ways to open FastDDS

Like ordinary ROS packages, FastDDS has three installation methods: binary installation, source code compilation, and Docker.

Because the official put the binary and Docker on the official website. .
And you need to fill in your personal information to download. .
And the download speed is super super slow. .
And it is not convenient to observe the source code. .
So Xiaoyu takes you to install from source code.

Originally wanted to make a one-click installation, save everyone typing the script! !

Love a person must not be accustomed to him, so is fish meal, in order to make everyone think more when copying and pasting (actually, to make up the number of words in the article), Xiaoyu will take everyone to install and compile the source code step by step.

However, the source code installation is also very simple, don't be afraid. .

Because DDS is related to ROS2, we can also use colcon to compile without cmake (if you need cmake, you can find it on the official website)

2. Compile and install FastDDS from source code

Downloading and compiling DDS is divided into three steps. The first step can be skipped if you have already installed ROS2. .

1. Installation tool

sudo apt install python3-colcon-common-extensions python3-vcstool zip openjdk-8-jdk  -y

2. Create a directory and download the warehouse

mkdir -p fastdds_ws/src 
cd fastdds_ws && wget https://downloads.gradle-dn.com/distributions/gradle-6.4-bin.zip && unzip gradle-6.4-bin.zip 
wget http://fishros.com/tools/files/fastrtps.repos && vcs import src < fastrtps.repos

3. Compile

colcon build
cd src/fastddsgen/ &&  gradle assemble

Final Step: Configure Environment Variables

xxx is your directory prefix

echo 'source xxx/fastdds_ws/install/setup.bash' >> ~/.bashrc
echo 'export PATH=$PATH:xxx/fastdds_ws/gradle-6.4/bin/' >> ~/.bashrc
echo 'export DDSGEN=xxx/fastdds_ws/src/fastddsgen/scripts' >> ~/.bashrc

3. HelloFish routine

The RTPS used by DDS is the Real-Time Publish Subscribe protocol, which is actually the same as the publish and subscribe in ROS and ROS2, so we run a routine to send and receive messages, and the message content is calledHelloFish

The program written by Xiaoyu is ready and put on github. You can download it directly to compile and test~

download code

git clone https://github.com/fishros/dds_tutorial.git

compile routine

cd dds_tutorial/examples/01-hellofishros
mkdir build && cd build
cmake .. 
make

execute routine

open a terminal

./DDSHelloFishRosPublisher  

open another terminal

./DDSHelloFishRosSubscribe

View Results

The correct result is like the following, which has proved that everything is OK~
DDS pubsub test

4. Summary

Is it amazing to see the familiar publish and subscribe? The bottom layer of FASTDDS uses a variety of protocols for data transmission, including the unreliable but really fast UDP, the reliable but not very fast TCP, and the unreliable but not very fast TCP. Swap Memory (SHM).

In order to show you what is called low yield (lazy), Xiaoyu decided to explain the code to you tomorrow~

Guess you like

Origin blog.csdn.net/qq_27865227/article/details/121747897