ROS catkin_make:重建包

Posted

技术标签:

【中文标题】ROS catkin_make:重建包【英文标题】:ROS catkin_make: rebuild package(s) 【发布时间】:2017-10-21 20:00:21 【问题描述】:

我发现我错误地将依赖项“std_msgs”命名为“std_msg”。 所以我修复了!但是等等,catkin 仍然认为草坪机器人描述需要“std_msg”作为依赖项,即使我修复了依赖项:

<?xml version="1.0"?>
<package format="2">
  <name>lawnbot_description</name>
  <version>0.0.0</version>
  <description>The lawnbot_description package</description>      

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>

执行 catkin_make --force-cmake 时的错误输出:

Base path: /home/josiah/PycharmProjects/lawnbot_ws
Source space: /home/josiah/PycharmProjects/lawnbot_ws/src
Build space: /home/josiah/PycharmProjects/lawnbot_ws/build
Devel space: /home/josiah/PycharmProjects/lawnbot_ws/devel
Install space: /home/josiah/PycharmProjects/lawnbot_ws/install
####
#### Running command: "make cmake_check_build_system" in 
"/home/josiah/PycharmProjects/lawnbot_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/josiah/PycharmProjects/lawnbot_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/josiah/PycharmProjects/lawnbot_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.6
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 8 packages in topological order:
-- ~~  - turtlebot3 (metapackage)
-- ~~  - turtlebot3_bringup
-- ~~  - turtlebot3_slam
-- ~~  - lawnbot_description
-- ~~  - lawnbot_gazebo
-- ~~  - turtlebot3_navigation
-- ~~  - turtlebot3_teleop
-- ~~  - turtlebot3_description
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'turtlebot3'
-- ==> add_subdirectory(turtlebot3/turtlebot3)
-- +++ processing catkin package: 'turtlebot3_bringup'
-- ==> add_subdirectory(turtlebot3/turtlebot3_bringup)
-- +++ processing catkin package: 'turtlebot3_slam'
-- ==> add_subdirectory(turtlebot3/turtlebot3_slam)
-- +++ processing catkin package: 'lawnbot_description'
-- ==> add_subdirectory(lawnbot_description)
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
  Could not find a package configuration file provided by "std_msg" with any
  of the following names:

    std_msgConfig.cmake
    std_msg-config.cmake

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


-- Could not find the required component 'std_msg'. 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/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "std_msg" with any
  of the following names:

    std_msgConfig.cmake
    std_msg-config.cmake

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


-- Configuring incomplete, errors occurred!
See also "/home/josiah/PycharmProjects/lawnbot_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/josiah/PycharmProjects/lawnbot_ws/build/CMakeFiles/CMakeError.log".
Makefile:290: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

它仍然认为草坪机器人描述包需要“std_msg”。为什么这么难?修改包裹信息并更新它不可能这么复杂。

我发现有一个名为:catkin_tools clean 的包,但是为什么我必须下载一个额外的包来简单地更新我的工作空间?

我试过了:

-catkin_make
-catkin_make --force-cmake
- I have seen solutions that involve deleting entire build/devel directories which horrifies me. That seems like a ton of work just to add an 's' to the end of a name

我担心 catkin clean meadowbot_description 会删除整个包。这是我最好的选择吗?

本地草坪机器人描述 cmake 文件:

cmake_minimum_required(VERSION 2.8.3)
project(lawnbot_description)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msg # I am not supposed to edit this right??? I tried editing and it still does not work
)

【问题讨论】:

【参考方案1】:

我发现编辑 CMakeLists 可以解决问题。但是,我需要更改 package.xml 和 CMakeLists 以指示依赖项的更改,这很烦人。

我认为如果我修复 package.xml,CMakeLists 将会更新。

因此,将来参考,编辑包中的 CMakeLists 以反映对包所做的更改。 catkin_make 似乎不会为您执行此操作。

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msg
)

应该是:

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs 
)

随着更新 package.xml

【讨论】:

我对有人找到更优雅的解决方案持开放态度,尤其是在包修改比这种情况更极端的情况下。

以上是关于ROS catkin_make:重建包的主要内容,如果未能解决你的问题,请参考以下文章

无法使用 catkin_make 构建 ROS 包。对包树感到困惑

ros学习笔记11——ROS中catkin_make install的用法

ROS Melodic笔记:catkin_make报错Invoking "make cmake_check_build_system" failed

在 ROS 工作空间中使用 catkin_make 时 Qt 出现的问题

如何用cmake搭建ros工程,make编译而不是catkin_make

在 Windows 10 的 ROS 中使用 catkin_make 时出现问题