序言
ROS使用catkin构建系统,可以轻松使用与ROS相关的构建、功能包管理和功能包之间的依赖关系。它实际上是一种CMake(Cross Platform Make),可以跨平台使用,使用CMakeLists.txt描述。
1、创建功能包
命令:
$ catkin_create_pkg [功能包名称][依赖功能包1][依赖功能包n]
会自动生成CMakeList.txt和package.xml文件。相关功能包可以在创建时指定,也可以创建后在package.xml中输入。功能包应包括:
include → include 目录
src → 源代码目录
CMakeLists.txt → 构建配置文件
package.xml → 功能包配置文件
2、修改功能包配置文件
package.xml是ROS必要的配置文件,它包含功能包信息,包括功能包名称、作者、许可证和依赖功能包。
打开package.xml文档,你会看到如下的信息
<?xml version="1.0"?>
<package format="2">
<name>my_first_ros_pkg</name>
<version>0.0.0</version>
<description>The my_first_ros_pkg package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="gong@todo.todo">gong</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/my_first_ros_pkg</