目录
一个catkin程序包由什么组成?
一个程序包要想称为catkin程序包必须符合以下要求:
-
该程序包必须包含catkin compliant package.xml文件
- 这个package.xml文件提供有关程序包的元信息。
-
程序包必须包含一个catkin 版本的CMakeLists.txt文件,而Catkin metapackages中必须包含一个对CMakeList.txt文件的引用。
- 每个目录下只能有一个程序包。
- 这意味着在同一个目录下不能有嵌套的或者多个程序包存在。
最简单的程序包也许看起来就像这样:
-
my_package/ CMakeLists.txt package.xml
在catkin工作空间中的程序包
开发catkin程序包的一个推荐方法是使用catkin工作空间,但是你也可以单独开发(standalone)catkin 软件包。一个简单的工作空间也许看起来像这样:
-
workspace_folder/ -- WORKSPACE src/ -- SOURCE SPACE CMakeLists.txt -- 'Toplevel' CMake file, provided by catkin package_1/ CMakeLists.txt -- CMakeLists.txt file for package_1 package.xml -- Package manifest for package_1 ... package_n/ CMakeLists.txt -- CMakeLists.txt file for package_n package.xml -- Package manifest for package_n
在继续本教程之前请先按照创建catkin工作空间教程创建一个空白的catkin工作空间。
Let's create a catkin workspace:
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
Even though the workspace is empty (there are no packages in the 'src' folder, just a single CMakeLists.txt link) you can still "build" the workspace:
$ cd ~/catkin_ws/
$ catkin_make
The catkin_make command is a convenience tool for working with catkin workspaces. If you look in your current directory you should now have a 'build' and 'devel' folder. Inside the 'devel' folder you can see that there are now several setup.*sh files.
NOTE!! Sourcing any of these files will overlay this workspace on top of your environment. To understand more about this see the general catkin documentation: catkin. Before continuing source your new setup.*sh file:
$ source devel/setup.bash
To make sure your workspace is properly overlayed by the setup script, make sure ROS_PA
Let's create a catkin workspace:
$ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace
Even though the workspace is empty (there are no packages in the 'src' folder, just a single CMakeLists.txt link) you can still "build" the workspace:
$ cd ~/catkin_ws/ $ catkin_make
The catkin_make command is a convenience tool for working with catkin workspaces. If you look in your current directory you should now have a 'build' and 'devel' folder. Inside the 'devel' folder you can see that there are now several setup.*sh files.
NOTE!! Sourcing any of these files will overlay this workspace on top of your environment. To understand more about this see the general catkin documentation: catkin. Before continuing source your new setup.*sh file:
$ source devel/setup.bash
To make sure your workspace is properly overlayed by the setup script, make sure ROS_PA

本文档介绍了如何创建ROS的catkin程序包,包括创建catkin工作空间,理解catkin程序包的组成,如必须包含的package.xml和CMakeLists.txt文件,以及如何管理程序包的依赖关系。通过catkin_create_pkg命令创建名为'beginner_tutorials'的程序包,依赖于std_msgs、roscpp和rospy,并展示了如何查看一级和间接依赖。最后,概述了如何自定义package.xml和CMakeLists.txt文件。
最低0.47元/天 解锁文章
7970

被折叠的 条评论
为什么被折叠?



