1. Linux installation

The instructions for installing the Discovery Server tool in a Linux environment are provided in this page. In order to use the Discovery Server tool, its necessary to have a compatible version of eProsima Fast DDS installed (over release 2.0.2).

eProsima Fast DDS dependencies as tinyxml must be accessible, either because Fast DDS was build-installed defining THIRDPARTY=ON or because those libraries have been specifically installed. The cross-platform tool colcon was chosen to simplify the installation of the several mutually dependent CMake projects. In order to use colcon, Python3 and CMake must be first installed.

1.1. Requirements

The installation of the Discovery Server tool in a Linux environment from sources requires the following tools to be installed in the system:

1.1.1. CMake, g++, pip3, wget and git

These packages provide the tools required to install the Discovery Server tool and its dependencies from command line. Install CMake, g++, pip3, wget and git using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:

sudo apt install cmake g++ python3-pip wget git

1.1.2. Python3 modules

To execute the tests that verify the proper operation of the Discovery Server discovery mechanism, it is necessary to install some Python3 modules. These can be installed using pip.

pip3 install jsondiff==1.2.0 xmltodict==0.12.0

1.2. Dependencies

The Discovery Server tool and eProsima Fast DDS has the following dependencies, when installed from binaries in a Linux environment:

1.2.1. Asio and TinyXML2 libraries

Asio is a cross-platform C++ library for network and low-level I/O programming, which provides a consistent asynchronous model. TinyXML2 is a simple, small and efficient C++ XML parser. Install these libraries using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:

sudo apt install libasio-dev libtinyxml2-dev

1.2.2. OpenSSL

OpenSSL is a robust toolkit for the TLS and SSL protocols and a general-purpose cryptography library. Install OpenSSL using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:

sudo apt install libssl-dev

1.3. Installation steps

colcon is a command line tool based on CMake aimed at building sets of software packages. This section explains how to use it to compile the Discovery Server tool and its dependencies.

  1. Install the ROS 2 development tools (colcon and vcstool) by executing the following command:

    pip3 install -U colcon-common-extensions vcstool
    

    Note

    If this fails due to an Environment Error, add the --user flag to the pip3 installation command.

  2. Create a Discovery Server workspace and download the repos file that will be used to install the Discovery Server tool and its dependencies:

    $ mkdir -p discovery-server-ws/src && cd discovery-server-ws
    $ wget https://raw.githubusercontent.com/eProsima/Discovery-Server/master/discovery-server.repos
    $ vcs import src < discovery-server.repos
    

    The discovery-server.repos file is provided in order to profit from vcstool capabilities to download the needed repositories.

    Note

    In order to avoid using vcstool the following repositories should be downloaded from Github into the discovery-server-ws/src directory:

    PACKAGE

    URL

    BRANCH

    eProsima/Fast-CDR

    https://github.com/eProsima/Fast-CDR.git

    master

    eProsima/Fast-RTPS

    https://github.com/eProsima/Fast-RTPS.git

    master

    eProsima/Discovery-Server

    https://github.com/eProsima/Discovery-Server.git

    master

    eProsima/foonathan_memory_vendor

    https://github.com/eProsima/foonathan_memory_vendor.git

    master

  3. Finally, use colcon to compile all software. Choose the build configuration by declaring CMAKE_BUILD_TYPE as Debug or Release. For this example, the Debug option has been chosen, which would be the choice of advanced users for debugging purposes.

    $ colcon build --base-paths src \
            --packages-up-to discovery-server \
            --cmake-args -DLOG_LEVEL_INFO=ON -DCOMPILE_EXAMPLES=ON -DINTERNALDEBUG=ON -DCMAKE_BUILD_TYPE=Debug
    

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.

1.4. Run an application

  1. If you installed the Discovery Server tool following the steps outlined above, you can try the HelloWorldExampleDS. To run the example navigate to the following directory

    <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS

    and run

    $ ./HelloWorldExampleDS --help
    

    to display the example usage instructions.

    In order to test the HelloWorldExampleDS open three terminals and run the above command. Then run the following command in each terminal:

    • Terminal 1:

      $ cd <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS
      $ ./HelloWorldExampleDS publisher
      
    • Terminal 2:

      $ cd <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS
      $ ./HelloWorldExampleDS subscriber
      
    • Terminal 3:

      $ cd <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS
      $ ./HelloWorldExampleDS server