gpt4 book ai didi

ros - catkin_package 与 find_package

转载 作者:行者123 更新时间:2023-12-02 15:06:28 35 4
gpt4 key购买 nike

在文件 CMakelists.txt 中我看到 find_packages 和 catkin_package:

find_package(catkin REQUIRED COMPONENTS roscpp rospy
image_transport std_msgs message_generation sensor_msgs
geometry_msgs )

catkin_package( CATKIN_DEPENDS message_runtime std_msgs sensor_msgs geometry_msgs )

这两件事有什么区别?

我尝试阅读教程中的每一件事,但还不够清楚。

最佳答案

答案基本上是由 CMakeLists.txt 中自动生成的注释给出的:

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS ...

## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(...

find_package命令是常见的cmake命令,需要加载catkin宏并指定对其他ROS包的依赖关系。

catkin_package 命令是这些 catkin 宏之一。它负责包的 ROS 特定配置。所以这是区分 ROS 包和普通 cmake 项目的重要部分。我不知道细节,但我猜想它是负责设置catkin工作区的正确构建路径的。
当其他 ROS 包依赖于此时,此处给出的参数(即依赖项)非常重要。

关于ros - catkin_package 与 find_package,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34419103/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com