Building and Installing the ifm3d-ros2 package

Prerequisites

Ubuntu and ROS

We suggest building the ifm3d-ros2 node on top of Ubuntu 22.04 Jammy Jellyfish and ROS Humble.

ifm3d C++ API

The ROS node ifm3d_ros2 requires the C++ API ifm3d to be installed locally for your system before compiling and running the ROS node. Refer to the compatibility matrix to find out the correct ifm3d API version.

Follow these instructions on how to install ifm3d (we recommend using the pre-built package): install ifm3d.

Testing prerequisite

These two packages are only required for testing but not at runtime:

  • launch_testing

  • launch_testing_ament_cmake

On debian based systems they may be installed as follows:

$ sudo apt install ros-${ROS_DISTRO}-launch-testing ros-${ROS_DISTRO}-launch-testing-ament-cmake

Note

The tests are currently a work in progress.

Build and install ifm3d-ros2

Building and installing ifm3d-ros2 is accomplished by utilizing the ROS2 colcon tool.

Installation directory

First, we need to decide where we want our software to be installed. For purposes of this document, we will assume that we will install our ROS packages at ~/colcon_ws/src.

Note

Below we assume humble. Adapting to other ROS distributions is left as an exercise for the reader.

Colcon workspace

Next, we want to create a colcon workspace that we can use to build and install that code from.

$ mkdir -p ~/colcon_ws/src

Get the ifm3d-ros2 code from GitHub

Next, we need to get the code from GitHub. Please adapt the commands when not following the suggested directory structure: ~/colcon_ws/src/

$ cd ~/colcon_ws/src
$ git clone https://github.com/ifm/ifm3d-ros2.git
$ git checkout <version> # Replace the targeted version

Note

The master branch is generally a work in progress.

We recommend picking a tagged released version for your builds, to ensure stability between builds.

Build ifm3d-ros2

Build your workspace:

$ cd ~/colcon_ws/
$ colcon build --cmake-args -DBUILD_TESTING=OFF
Starting >>> ifm3d_ros2
Finished <<< ifm3d_ros2 [17.6s]

Summary: 1 package finished [17.8s]

Note

The tests are not functional at the moment.

To confirm that the node is functional, try launching it and inspecting the published topics.

Docker containers

We provide a Dockerfile build instruction for building the ROS2 node inside a Docker container. For reference and for deployment of the ROS node via a Docker software Docker container see the Dockerfile.