2. Linux installation from sources

This section explains how to build Vulcanexus in Ubuntu Jammy. Since Vulcanexus is a ROS 2 all-in-one tool set, certain ROS 2 prerequisites need to be met before building.

2.1. ROS 2 prerequisites

First of all, set up a UTF-8 locale as required by ROS 2. Locale settings can be checked and set up with the following commands:

locale  # check for UTF-8

sudo apt update && sudo apt install -y locales
# Any UTF-8 locale will work. Using en_US as an example
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

ROS 2 also requires that the Ubuntu Universe repository is enabled. This can be checked and enabled with the following commands:

apt-cache policy | grep universe

# This should print something similar to:
#
#  500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
# release v=22.04,o=Ubuntu,a=jammy,n=jammy,l=Ubuntu,c=universe,b=amd64
#
# Otherwise run

sudo apt install -y software-properties-common
sudo add-apt-repository universe -y

Now download ROS 2 GPG key into the keystore.

sudo apt update && sudo apt install -y curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

And then add ROS 2 repository to the repository manager sources list.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

With the ROS 2 repository properly set up the next step is to install the required dependencies and tools for cloning and testing the ROS 2 packages within the workspace.

sudo apt update && sudo apt install -y \
    build-essential \
    cmake \
    git \
    python3-colcon-common-extensions \
    python3-flake8 \
    python3-flake8-blind-except \
    python3-flake8-builtins \
    python3-flake8-class-newline \
    python3-flake8-comprehensions \
    python3-flake8-deprecated \
    python3-flake8-docstrings \
    python3-flake8-import-order \
    python3-flake8-quotes \
    python3-pip \
    python3-pytest \
    python3-pytest-cov \
    python3-pytest-repeat \
    python3-pytest-rerunfailures \
    python3-rosdep \
    python3-setuptools \
    python3-vcstool \
    wget

2.2. Get ROS 2 code

Create a workspace for Vulcanexus and clone the ROS 2 repositories

mkdir -p ~/vulcanexus_humble/src
cd ~/vulcanexus_humble
wget https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos
vcs import src < ros2.repos

Now download the required dependencies for these packages.

sudo apt upgrade -y
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"

2.3. Get Vulcanexus code

Add the Vulcanexus repositories and metadata files to the Vulcanexus workspace:

cd ~
cd vulcanexus_humble

# Remove ROS 2 packages overridden by Vulcanexus
rm -rf \
    src/eProsima/foonathan_memory_vendor/ \
    src/ros2/rosidl_typesupport_fastrtps/ \
    src/ros2/rosidl_dynamic_typesupport_fastrtps \
    src/ros2/rmw_fastrtps/ \
    src/ros2/rosidl/rosidl_adapter/ \
    src/ros2/rosidl/rosidl_cli/ \
    src/ros2/rosidl/rosidl_cmake/ \
    src/ros2/rosidl/rosidl_generator_c/ \
    src/ros2/rosidl/rosidl_generator_cpp/ \
    src/ros2/rosidl/rosidl_parser/ \
    src/ros2/rosidl/rosidl_runtime_c/ \
    src/ros2/rosidl/rosidl_runtime_cpp/ \
    src/ros2/rosidl/rosidl_typesupport_interface/ \
    src/ros2/rosidl/rosidl_typesupport_introspection_c/ \
    src/ros2/rosidl/rosidl_typesupport_introspection_cpp/ \
    src/ros2/rosidl/rosidl_typesupport_introspection_tests/

# Get Vulcanexus sources
wget https://raw.githubusercontent.com/eProsima/vulcanexus/humble/vulcanexus.repos
wget https://raw.githubusercontent.com/eProsima/vulcanexus/humble/colcon.meta
vcs import --force src < vulcanexus.repos

# Avoid compilation of some documentation and demo packages
touch src/eProsima/Fast-DDS-QoS-Profiles-Manager/docs/COLCON_IGNORE
touch src/eProsima/Vulcanexus-Base/docs/COLCON_IGNORE
touch src/eProsima/Vulcanexus-Base/code/COLCON_IGNORE

2.4. Install Vulcanexus dependencies

Some additional dependencies which are required for the Vulcanexus distribution must be installed. Install the Vulcanexus required development tools with the following command:

sudo apt update && sudo apt install -y \
    libasio-dev \
    libdocopt-dev \
    libengine-pkcs11-openssl \
    liblog4cxx-dev \
    liblz4-dev \
    libp11-dev \
    libqt5charts5-dev \
    libssl-dev \
    libtinyxml2-dev \
    libxerces-c-dev \
    libyaml-cpp-dev \
    libzstd-dev \
    openjdk-8-jdk \
    python3-sphinx \
    python3-sphinx-rtd-theme \
    qtbase5-dev \
    qtdeclarative5-dev \
    qtquickcontrols2-5-dev \
    swig

2.5. Build the code in the workspace

If any other Vulcanexus or ROS 2 distribution has been installed from binaries, please ensure that the build is done in a fresh environment (previous installation is not sourced). This can be checked running the following command:

printenv | grep 'VULCANEXUS\|ROS'

The output should be empty. Please, be aware that in case the environment sourcing has been added to .bashrc, it must be removed in order to get a fresh environment.

2.5.1. Build Fast DDS-Gen (Optional)

Fast DDS-Gen is a Java application that generates source code using the data types defined in an IDL file. This tool must be built separately following the instructions below. Please, refer to Fast DDS-Gen documentation for more information about this tool.

cd src/eProsima/Fast-DDS-Gen
./gradlew assemble

The generated Java application can be found in src/eProsima/Fast-DDS-Gen/share/fastddsgen. However, the scripts folder provides some user friendly scripts that are recommended to be used. This scripts can be made accessible to the session adding the scripts folder path to the PATH environment variable.

export PATH=~/vulcanexus_humble/src/eProsima/Fast-DDS-Gen/scripts:$PATH

2.5.2. Build workspace

In order to build the workspace, the command line tool colcon is used. This tool is based on CMake and it is aimed at building sets of software packages, handling ordering and setting up the environment to use them.

cd ~/vulcanexus_humble
colcon build

Important

In case that only a set of packages are going to be built, please ensure to include always vulcanexus_base package in the set. E.g.:

colcon build --packages-up-to demo_nodes_cpp vulcanexus_base

This auxiliary package is required to set several environment variables required by the distribution such as VULCANEXUS_DISTRO and VULCANEXUS_HOME.

2.6. Environment setup

In order to use the Vulcanexus installation, the environment must be set up sourcing the following file:

source ~/vulcanexus_humble/install/setup.bash

2.7. Try some examples

In one terminal, source the setup file and then run a C++ talker:

. ~/vulcanexus_humble/install/local_setup.bash
ros2 run demo_nodes_cpp talker

In another terminal source the setup file and then run a Python listener:

. ~/vulcanexus_humble/install/local_setup.bash
ros2 run demo_nodes_py listener

At this point, the talker should prompt Publishing: Hello World: <id> messages while the listener echoes I heard: [Hello World: <id>]. This verifies both the C++ and Python APIs are working properly. Hooray!