2. Windows installation¶
The instructions for installing the Discovery Server tool in a Windows 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 installed and accessible in the system. 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.
2.1. Requirements¶
The installation of eProsima Fast DDS in a Windows environment from sources requires the following tools to be installed in the system:
2.1.1. Visual Studio¶
Visual Studio is required to
have a C++ compiler in the system. For this purpose, make sure to check the
Desktop development with C++
option during the Visual Studio installation process.
If Visual Studio is already installed but the Visual C++ Redistributable packages are not,
open Visual Studio and go to Tools
-> Get Tools and Features
and in the Workloads
tab enable
Desktop development with C++
. Finally, click Modify
at the bottom right.
2.1.2. Chocolatey¶
Chocolatey is a Windows package manager. It is needed to install some of eProsima Fast DDS’s dependencies. Download and install it directly from the website.
2.1.3. CMake, pip3, wget and git¶
These packages provide the tools required to install the Discovery Server tool, eProsima Fast DDS and its
dependencies from command line.
Download and install CMake, pip3, wget and git by following the instructions detailed in the respective websites.
Once installed, add the path to the executables to the PATH
from the
Edit the system environment variables control panel.
2.1.4. 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
2.2. Dependencies¶
eProsima Fast RTPS has the following dependencies, when installed from sources in a Windows environment:
2.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. They can be downloaded directly from the links below:
After downloading these packages, open an administrative shell with PowerShell and execute the following command:
> choco install -y -s <PATH_TO_DOWNLOADS> asio tinyxml2
where <PATH_TO_DOWNLOADS>
is the folder into which the packages have been downloaded.
2.2.2. OpenSSL¶
OpenSSL is a robust toolkit for the TLS and SSL protocols and a general-purpose cryptography library.
Download and install the latest OpenSSL version for Windows at this
link.
After installing, add the environment variable OPENSSL_ROOT_DIR
pointing to the installation root directory.
For example:
> OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64
2.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.
Important
Run colcon within a Visual Studio prompt. To do so, launch a Developer Command Prompt from the search engine.
Install the ROS 2 development tools (colcon and vcstool) by executing the following command:
> pip3 install -U colcon-common-extensions vcstool
and add the path to the
vcs
executable to thePATH
from the Edit the system environment variables control panel.Note
If this fails due to an Environment Error, add the
--user
flag to thepip3
installation command.Create a Discovery Server workspace and download the repos file that will be used to install the Discovery Server tool and its dependencies:
> mkdir discovery-server-ws > cd discovery-server-ws > mkdir src > wget https://raw.githubusercontent.com/eProsima/Discovery-Server/master/discovery-server.repos > vcs import src < discovery-server.repos
A discovery-server.repos file is available 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
master
eProsima/Fast-RTPS
master
eProsima/Discovery-Server
master
eProsima/foonathan_memory_vendor
master
If the generator (compiler) of choice is Visual Studio, launch colcon from a visual studio console. Any console can be setup into a visual studio one by executing a batch file. For example, in VS2017 is usually
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat
.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. If using a multi-configuration generator like Visual Studio we recommend to build both in debug and release modes> 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 > colcon build --base-paths src \ --packages-up-to discovery-server \ --cmake-args -DCOMPILE_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
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.
2.4. Run an application¶
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 consoles and run the above command. Then run the following command in each console:Console 1:
> cd <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS > HelloWorldExampleDS publisher
Console 2:
> cd <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS > HelloWorldExampleDS subscriber
Console 3:
> cd <path/to/discovery-server-ws>/discovery-server-ws/install/discovery-server/examples/HelloWorldExampleDS > HelloWorldExampleDS server