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 or Ubuntu 24.04 Noble Numbat and ROS Jazzy

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.

Build and install ifm3d-ros2

Building and installing ifm3d-ros2 is accomplished by utilizing the ROS 2 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/.

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.

$ source /opt/ros/humble/setup.bash
$ 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/
$ rosdep install --from-paths src --ignore-src -r -y
$ colcon build
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 container see the Dockerfile.