How to fix ROS2 error: Could not find a package configuration file provided by "ros2_control_test_assets"

Problem

When building a ROS2 workspace, you might encounter the following error:

example.txt
CMake Warning at CMakeLists.txt:46 (find_package):
  By not providing "Findros2_control_test_assets.cmake" in CMAKE_MODULE_PATH
  this project has asked CMake to find a package configuration file provided
  by "ros2_control_test_assets", but CMake did not find one.

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

    ros2_control_test_assetsConfig.cmake
    ros2_control_test_assets-config.cmake

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


CMake Error at /opt/ros/jazzy/share/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake:77 (message):
  ament_target_dependencies() the passed package name
  'ros2_control_test_assets' was not found before
Call Stack (most recent call first):
  CMakeLists.txt:49 (ament_target_dependencies)

Solution

You need to install ros2-control for your ROS distribution, e.g.

install_ros2_control.sh
sudo apt install ros-jazzy-ros2-control ros-jazzy-ros2-controllers

Check out similar posts by category: Robotics, ROS