Fast DDS installation

Fast DDS enables an RTPS/DDS interface that allows PX4 uORB topics to be shared with offboard components that participate in same DDS domain, including robotics and simulator tools. In particular, Fast DDS is the default middleware implementation for Robot Operating System 2 (ROS 2), and is essential for integrating PX4 with ROS2.

This topic explains how to install Fast DDS and Fast-RTPS-Gen to use in the PX4 build system and with the microRTPS bridge.

You do not have to install Fast DDS if you have ROS 2 Dashing (Ubuntu 18.04) or ROS 2 Foxy (Ubuntu 20.04) installed, as it comes included with the default base or desktop installations through the ros-<distro>-rmw-fastrtps package. This means you just need to install Fast-RTPS-Gen and have your ROS 2 environment sourced (source /opt/ros/<distro>/setup.bash) in order to be able to compile the rtps targets in the PX4-Autopilot repo.

For ROS2 Galactic and above, one has to install the rmw implementation through apt using apt install ros-galatic-rmw-fastrtps, since the default middleware for Galactic and above is CycloneDDS and the FastDDS middleware doesn't come installed by default.

Fast DDS is not an essential component of the PX4 Autopilot and should only be installed if you plan to interface the PX4 Autopilot with Fast RTPS/DDS participants. ROS 2 nodes are an example of these, though Fast DDS middleware and C++ implementations are installed by default on ROS 2 Foxy and below, as mentioned above.

Fast DDS was previously named FastRTPS (the name was changed in version 2.0.0 as it now includes a full DDS implementation, rather than just the RTPS wire protocol).

Prerequisites

eProsima Fast DDS requires the following packages to work.

At time of writing you will need to install from source for:

  • Ubuntu 18.04: Fast RTPS 1.8.4 (or later) and Fast-RTPS-Gen 1.0.4 (not later!).

  • Ubuntu 20.04: Fast DDS 2.0.2 (or later) and Fast-RTPS-Gen 1.0.4 (not later!).

Remember (again) you only need to install Fast DDS if you are not using ROS 2 and just want to leverage non-ROS2 DDS networks and applications. If you have ROS 2 installed (and rmw-fasrtps as its default middleware), you can skip to Fast-RTPS-Gen build and install.

Java

Java is required to build and use eProsima's RTPS/DDS from IDL code generation tool - Fast-RTPS-Gen. Java JDK 11 is recommended, and it is installed through the setup scripts made available in Ubuntu Development Environment.

Gradle

You also need to install Gradle to build Fast-RTPS-Gen. We recommend you install Gradle via sdkman.

Do not install Gradle version 7 or higher. The recommended version is 6.3.

Foonathan memory

In order to build Fast DDS you need to install the Foonathan Memory dependency.

git clone https://github.com/eProsima/foonathan_memory_vendor.git
cd foonathan_memory_vendor
mkdir build && cd build
cmake ..
cmake --build . --target install

If the last step fails, try running the command with the proper user privileges (sudo).

Installation from Sources

Fast DDS

Clone the project from Github:

$ git clone --recursive https://github.com/eProsima/Fast-DDS.git -b v2.0.2 ~/FastDDS-2.0.2
$ cd ~/FastDDS-2.0.2
$ mkdir build && cd build

If you are on Linux, execute:

$ cmake -DTHIRDPARTY=ON -DSECURITY=ON ..
$ make -j$(nproc --all)
$ sudo make install

This will install Fast DDS to /usr/local, with secure communications support. If you need to install to a custom location you can use: -DCMAKE_INSTALL_PREFIX=<path>.

Compile Options

The following additional arguments can be used when calling CMake:

  • -DCOMPILE_EXAMPLES=ON: Compile the examples

  • -DPERFORMANCE_TESTS=ON: Compile the performance tests

Fast-RTPS-Gen

Fast-RTPS-Gen is the Fast RTPS (DDS) IDL code generator tool. It should be installed after Fast RTPS (DDS) and made sure the fastrtpsgen application is in your PATH. You can check with which fastrtpsgen.

Then install Fast-RTPS-Gen 1.0.4 (Gradle is required for this):

git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git -b v1.0.4 ~/Fast-RTPS-Gen \
    && cd ~/Fast-RTPS-Gen \
    && gradle assemble \
    && sudo env "PATH=$PATH" gradle install

Installation from Binaries

Although the binaries are available, we recommend to build and install the code from source, given that the binaries may not come with required components and dependencies in place.

The latest binary release of eProsima Fast DDS can be downloaded from the company website.

Documentation on how to do this can be found here: Installation from Binaries on Linux and Installation from Binaries on Windows (eProsima Fast DDS official documentation)

Environmental Variables

  • FASTRTPSGEN_DIR: Root folder where eProsima Fast-RTPS-Gen is installed, usually set to /usr/local, which is the default installation directory. If the user sets a different install directory in the gradle install step, it must set this variable to that same directory as well. Otherwise, the code generation step, and consequently, the build of the rtps targets in PX4 will fail.

Further Information

Last updated