关于package.xml文件

记录一下自己学package.xml文件的心得

<?xml version="1.0"?> <!-- 头和尾都是一个根标签 -->
<package format="2">
  <name>positioncmd_generator</name> <!-- 这个包的名字是我们自己创建的 -->
  <version>0.0.0</version> <!-- 这个version也是自己自定义的 -->
  <description>The positioncmd_generator package</description> <!-- 包的描述也是自定义的 -->

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="root@todo.todo">root</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/positioncmd_generator</url> -->


  <!-- Author tags are optional, multiple are allowed, one per tag -->
  <!-- Authors do not have to be maintainers, but could be -->
  <!-- Example: -->
  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->


  <!-- The *depend tags are used to specify dependencies -->
  <!-- Dependencies can be catkin packages or system dependencies -->
  <!-- Examples: -->
  <!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
  <!--   <depend>roscpp</depend> -->
  <!--   Note that this is equivalent to the following: -->
  <!--   <build_depend>roscpp</build_depend> -->
  <!--   <exec_depend>roscpp</exec_depend> -->
  <!-- Use build_depend for packages you need at compile time: -->
  <!--   <build_depend>message_generation</build_depend> -->
  <!-- Use build_export_depend for packages you need in order to build against this package: -->
  <!--   <build_export_depend>message_generation</build_export_depend> -->
  <!-- Use buildtool_depend for build tool packages: -->
  <!--   <buildtool_depend>catkin</buildtool_depend> -->
  <!-- Use exec_depend for packages you need at runtime: -->
  <!--   <exec_depend>message_runtime</exec_depend> -->
  <!-- Use test_depend for packages you need only for testing: -->
  <!--   <test_depend>gtest</test_depend> -->
  <!-- Use doc_depend for packages you need only for building documentation: -->
  <!--   <doc_depend>doxygen</doc_depend> -->
  <buildtool_depend>catkin</buildtool_depend> <!-- 编译工具的依赖,这里是catkin -->
  <!-- 编译依赖 -->
  <build_depend>quadrotor_msgs</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <!-- <build_depend>uav_utils</build_depend>编译导出依赖 -->
  <build_export_depend>quadrotor_msgs</build_export_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <!-- <build_export_depend>uav_utils</build_export_depend>运行依赖 -->
  <exec_depend>quadrotor_msgs</exec_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>



  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

以上述文件为例

1、头和尾

<?xml version="1.0"?> <!-- 头和尾都是一个根标签 -->
<package format="2">
  <name>positioncmd_generator</name> <!-- 这个包的名字是我们自己创建的 -->
  <version>0.0.0</version> <!-- 这个version也是自己自定义的 -->
  <description>The positioncmd_generator package</description> <!-- 包的描述也是自定义的 -->

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="root@todo.todo">root</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> <!-- 开源协议的许可 -->


中间省略了



</package>

头和尾都是一个根标签。然后前面包含五个要素:

  1. xml的version
  2. 包的名字
  3. 包的版本
  4. 维护者的邮箱和名字
  5. 开源协议的许可

2、编译依赖

 <buildtool_depend>catkin</buildtool_depend> <!-- 编译工具的依赖,这里是catkin -->
  <!-- 三个为一组 -->
  <!-- 编译依赖 -->
  <build_depend>quadrotor_msgs</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <!-- <build_depend>uav_utils</build_depend>编译导出依赖 -->
  <build_export_depend>quadrotor_msgs</build_export_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <!-- <build_export_depend>uav_utils</build_export_depend>运行依赖 -->
  <exec_depend>quadrotor_msgs</exec_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>

包含四个要素:

  1. 编译工具的依赖,一般都是catkin
  2. 编译依赖build_depend
  3. 编译导出依赖build_export_depend
  4. 运行依赖exec_depend

2、3、4三个依赖(一般都是一起出现的)也可以用以下写法替代:

  <depend>quadrotor_msgs</depend>
  <depend>roscpp</depend>
  <depend>std_msgs</depend>

  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值