问题描述

  在catkin_make 编译ROS工程时,通常会出现如下的错误:

-- Could NOT find octomap_ros (missing: octomap_ros_DIR)
-- Could not find the required component 'octomap_ros'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "octomap_ros" with
  any of the following names:

    octomap_rosConfig.cmake
    octomap_ros-config.cmake

  Add the installation prefix of "octomap_ros" to CMAKE_PREFIX_PATH or set
  "octomap_ros_DIR" to a directory containing one of the above files.  If
  "octomap_ros" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  rotors_simulator/rotors_gazebo_plugins/CMakeLists.txt:106 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/lanx/Project/ROS/UAV/build/CMakeFiles/CMakeOutput.log".
See also "/home/lanx/Project/ROS/UAV/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

在这里插入图片描述

这种情况通常是因为缺少工程编译所需的依赖包,解决方法如下。

解决方法

以上述错误为例,注意看下面几句话
在这里插入图片描述

其说明缺少依赖包octomap-msgs,这个时候把提示里面的octomap_msgsConfig.cmake后面的Config.cmake删掉,即为缺少的包,并把其中的下划线_用连字符-替换,替换后就变成octomap-msgs,然后在前面加上ros-noetic即可。这里的noetic是我安装ROS的版本,根据你们自己的版本,替换成kinetic等版本。
最后输入下面代码进行安装

sudo apt-get install ros-noetic-octomap-msgs

安装成功后重新catkin_make即可。

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐