ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROS2 SLAM_Toolbox Failed Colcon Build

asked 2022-06-30 02:50:39 -0500

JordanE gravatar image

Ive been trying to get the SLAM toolbox up and running to work on a project, but I keep running into the same issue. I get the files into place using GIT sourcing and then try to build the application, but it fails. I get the following message: CMake Error at CMakeLists.txt:13 (find_package): By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ament_cmake", but CMake did not find one.

Could not find a package configuration file provided by "ament_cmake" with any of the following names:


Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set "ament_cmake_DIR" to a directory containing one of the above files. If "ament_cmake" provides a separate development package or SDK, be sure it has been installed.

This is happening on both my Linux machine and my Windows machine running an Ubuntu Terminal. They are both running 20.04 and ROS2 Humble. I may not understand the instructions fully as they are just given as:

ROSDep will take care of the major things rosdep install -q -y -r --from-paths src --ignore-src Or install via apt apt install ros-eloquent-slam-toolbox Run your colcon build procedure of choice. You can run via ros2 launch slam_toolbox

Maybe I need a specific argument for colcon? I dont fully understand how all these things work together. Im pretty new to this.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-07-13 03:19:10 -0500

rodrigo55 gravatar image

You don't have to compile slam_toolbox from source to use it, unless you want to modify the source code. You can install it with atp:

sudo apt update
sudo apt install ros-humble-slam-toolbox
source /opt/ros/humble/setup.bash

After installing it, you can use the following launch file to use it:

ros2 launch slam_toolbox

You'll probably want to see it building in rviz2, you can add the /map topic once the file above is launched.

To save it, run

ros2 run nav2_map_server map_saver_cli -f [name of map]

If you want to see this done step by step, check out this video:

edit flag offensive delete link more


@rodrigo55 Thanks for that answer - all I had to do beyond that was to modify the config for my "base_link" and I'm getting 1 /map every 5 seconds on a Raspberry Pi4B from the YDLidar X4 /scan. Shame the OP didn't mark your answer as solution - worked for me.

RobotDreams gravatar image RobotDreams  ( 2022-10-25 18:10:00 -0500 )edit

Question Tools

1 follower


Asked: 2022-06-30 02:50:39 -0500

Seen: 483 times

Last updated: Jul 13 '22