ROS 2 (tested using ubuntu 20.04 and ROS2 Foxy or Galactic).
Slicer built from source is required to build an extension, see Slicer build instructions. Remember the build directory for Slicer, it will be needed to compile the Slicer ROS 2 module.
Make sure we use the system/native OpenSSL libraries
otherwise you’ll get some errors when compiling the
Slicer ROS 2 module. After you ran CMake, in the Slicer
build directory, set
cmake . -DSlicer_USE_SYSTEM_OpenSSL=ON or
Older Slicer Make sure
CMAKE_CXX_STANDARD is set to
14 (required to compile Slicer code along ROS 2).
This code should be built with
colcon as a ROS2 package.
For now, we will assume the ROS workspace directory is
the source code for this module has been cloned under
You will first need to source the ROS setup script for ROS 2 (foxy or galactic):
Then build the module using colcon while providing the path to your Slicer build directory:
cd ~/ros2_ws colcon build --cmake-args -DSlicer_DIR:PATH=/home/your_user_name_here/something_something/Slicer-SuperBuild-Debug/Slicer-build
-DSlicer_DIR... option is only needed for the first
If you prefer to use CMake (
ccmake) instead of passing the
Slicer_DIR on the colcon command line,
you can run
colcon build once and then run
ccmake on the
slicer_ros2_module build directory.
You should see the following error messages if the
Slicer_DIR is not set properly (or if Slicer has not been built from scratch):
Could not find a package configuration file provided by "Slicer" with any of the following names: SlicerConfig.cmake slicer-config.cmake
If you see this message, run CMake on the build directory for
In CMake, set
Slicer_DIR to point to your Slicer build directory
c to configure until you can hit
g to generate the makefiles.
Then try to
colcon build again (after