1. Linux installation from sources¶
The instructions for installing the eProsima DDS Enabler from sources and its required dependencies are provided in this page.
1.1. Dependencies installation¶
eProsima DDS Enabler depends on eProsima Fast DDS library and certain Debian packages. This section describes the instructions for installing eProsima DDS Enabler dependencies and requirements in a Linux environment from sources. The following packages will be installed:
foonathan_memory_vendor, an STL compatible C++ memory allocation library.fastcdr, a C++ library that serializes according to the standard CDR serialization mechanism.fastdds, the core library of eProsima Fast DDS library.cmake_utils, an eProsima utils library for CMake.cpp_utils, an eProsima utils library for C++.ddspipe, an eProsima internal library that enables the communication of DDS interfaces.
First of all, the Requirements and Dependencies detailed below need to be met. Afterwards, the user can choose whether to follow either the colcon or the CMake installation instructions.
1.1.1. Requirements¶
The installation of eProsima DDS Enabler in a Linux environment from sources requires the following tools to be installed in the system:
CMake, g++, pip, wget and git
Colcon [optional, for colcon installation only]
sudo apt install cmake g++ pip wget git
pip3 install -U colcon-common-extensions vcstool # optional, for colcon installation only
1.1.2. Dependencies¶
eProsima DDS Enabler has the following dependencies, when installed from sources in a Linux environment:
Asio and TinyXML2 libraries
OpenSSL library
YAML-CPP library
sudo apt install libasio-dev libtinyxml2-dev libssl-dev libyaml-cpp-dev
1.1.2.1. eProsima dependencies¶
If it already exists in the system an installation of Fast DDS and DDS Pipe libraries, just source these libraries when building eProsima DDS Enabler by running the following commands. In other case, just skip this step.
source <fastdds-installation-path>/install/setup.bash
source <ddspipe-installation-path>/install/setup.bash
1.1.2.2. Gtest¶
Gtest is a unit testing library for C++. By default, eProsima DDS Enabler does not compile tests. It is possible to activate them with the opportune CMake options when calling colcon or CMake. For more details, please refer to the CMake options section. For a detailed description of the Gtest installation process, please refer to the Gtest Installation Guide.
It is also possible to clone the Gtest Github repository into the eProsima DDS Enabler workspace and compile it with colcon as a dependency package. Use the following command to download the code:
git clone --branch release-1.12.0 https://github.com/google/googletest src/googletest-distribution
1.2. Colcon installation (recommended)¶
Create a
DDS-Enablerdirectory and download the.reposfile that will be used to install eProsima DDS Enabler and its dependencies:mkdir -p ~/DDS-Enabler/src cd ~/DDS-Enabler wget https://raw.githubusercontent.com/eProsima/DDS-Enabler/main/ddsenabler.repos vcs import src < ddsenabler.repos
Note
In case there is already a Fast DDS installation in the system it is not required to download and build every dependency in the
.reposfile. It is just needed to download and build the eProsima DDS Enabler project having sourced its dependencies. Refer to section eProsima dependencies in order to check how to source Fast DDS library.Build the packages:
colcon build
Note
Being based on CMake, it is possible to pass the CMake configuration options to the colcon build command.
For more information on the specific syntax, please refer to the CMake specific arguments page of the colcon manual.
To see the specific option for the eProsima DDS Enabler packages, please refer to the CMake options section.
1.3. CMake installation¶
This section explains how to compile eProsima DDS Enabler with CMake, either locally or globally.
Note
This section is not required if you have already installed the eProsima DDS Enabler using Colcon.
1.3.1. Local installation¶
Create a
DDS-Enablerdirectory where to download and build eProsima DDS Enabler and its dependencies:mkdir -p ~/DDS-Enabler/src mkdir -p ~/DDS-Enabler/build cd ~/DDS-Enabler wget https://raw.githubusercontent.com/eProsima/DDS-Enabler/main/ddsenabler.repos vcs import src < ddsenabler.repos
Compile all dependencies using CMake.
-
cd ~/DDS-Enabler mkdir build/foonathan_memory_vendor cd build/foonathan_memory_vendor cmake ~/DDS-Enabler/src/foonathan_memory_vendor -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DBUILD_SHARED_LIBS=ON cmake --build . --target install
-
cd ~/DDS-Enabler mkdir build/fastcdr cd build/fastcdr cmake ~/DDS-Enabler/src/fastcdr -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install cmake --build . --target install
-
cd ~/DDS-Enabler mkdir build/fastdds cd build/fastdds cmake ~/DDS-Enabler/src/fastdds -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install
-
# CMake Utils cd ~/DDS-Enabler mkdir build/cmake_utils cd build/cmake_utils cmake ~/DDS-Enabler/src/dev-utils/cmake_utils -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install # C++ Utils cd ~/DDS-Enabler mkdir build/cpp_utils cd build/cpp_utils cmake ~/DDS-Enabler/src/dev-utils/cpp_utils -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install
-
# ddspipe_core cd ~/DDS-Enabler mkdir build/ddspipe_core cd build/ddspipe_core cmake ~/DDS-Enabler/src/ddspipe/ddspipe_core -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install # ddspipe_participants cd ~/DDS-Enabler mkdir build/ddspipe_participants cd build/ddspipe_participants cmake ~/DDS-Enabler/src/ddspipe/ddspipe_participants -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install # ddspipe_yaml cd ~/DDS-Enabler mkdir build/ddspipe_yaml cd build/ddspipe_yaml cmake ~/DDS-Enabler/src/ddspipe/ddspipe_yaml -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install
-
Once all dependencies are installed, install eProsima DDS Enabler:
# dds_enabler_participants cd ~/DDS-Enabler mkdir build/dds_enabler_participants cd build/dds_enabler_participants cmake ~/DDS-Enabler/src/dds_enabler/dds_enabler_participants -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install # dds_enabler_yaml cd ~/DDS-Enabler mkdir build/dds_enabler_yaml cd build/dds_enabler_yaml cmake ~/DDS-Enabler/src/dds_enabler/dds_enabler_yaml -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install # dds_enabler cd ~/DDS-Enabler mkdir build/dds_enabler_tool cd build/dds_enabler_tool cmake ~/DDS-Enabler/src/dds_enabler/dds_enabler -DCMAKE_INSTALL_PREFIX=~/DDS-Enabler/install -DCMAKE_PREFIX_PATH=~/DDS-Enabler/install cmake --build . --target install
Note
By default, eProsima DDS Enabler does not compile tests. However, they can be activated by downloading and installing Gtest and building with CMake option
-DBUILD_TESTS=ON.
1.3.2. Global installation¶
To install eProsima DDS Enabler system-wide instead of locally, remove all the flags that appear in the configuration steps of Fast-CDR, Fast-DDS, Dev-Utils, DDS-Pipe, and DDS-Enabler, and change the first in the configuration step of foonathan_memory_vendor to the following:
-DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
1.4. Run an example¶
In this section, we will run a publish example mimicking the behavior of the classic Hello World ROS 2 talker in a specific domain. For simplicity, we will use the eProsima DDS Enabler example application with the already provided configuration file and sample data from a test case in the dds_enabler_test package.
Note
To run a service or action example, please refer to the corresponding readme in the examples folder.
To run this eProsima DDS Enabler example, source the installation path and execute the executable file that has been installed in <install-path>/dds_enabler_tool/bin/dds_enabler:
# TERMINAL ROS2 LISTENER
source <ROS2-installation-path>/setup.bash
export ROS_DOMAIN_ID=33
ros2 run demo_nodes_cpp listener
# TERMINAL DDS ENABLER
# If built has been done using colcon, all projects could be sourced as follows
cd <dds-enabler-workspace>
source install/setup.bash
export TEST_PATH=$PWD/src/DDS-Enabler/ddsenabler_test/compose/test_cases/publish/discovered_type
./install/ddsenabler/examples/publish/ddsenabler_example_publish --config $TEST_PATH/config.yml --timeout 10 --expected-types 1 --expected-topics 1 --publish-path $TEST_PATH/samples --publish-topic rt/chatter --publish-period 200 --publish-initial-wait 5000
Important
To run the eProsima DDS Enabler examples, it is necessary to have compiled the eProsima DDS Enabler project with the CMake option -DCOMPILE_EXAMPLES=ON. For more details, please refer to the CMake options section.
Note
Be sure that the executable have execution permissions.