ROS_tutorial02:Creat rospackage

所创建的包都在 /catkin_ws/src 文件夹下面。

ros的工作空间的文件结构如下:

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

创建ros package:

$ cd ~/catkin_ws
$ catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

然后进行sourcecatkin_make,教程中创建一个名为 beginner_tutorials  的包,依赖包为 roscpp、rospy、std_msgs 

创建:

$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

查看所创建的包有那些依赖包

$ rospack depends1 beginner_tutorials 

创建的包的依赖包又有自己的依赖包,称为非直接依赖包 indirect dependencies ,想要查看:

#命令
$ rospack depends beginner_tutorials    
#运行结果
cpp_common
rostime
roscpp_traits
roscpp_serialization
catkin
genmsg
genpy
message_runtime
gencpp
geneus
gennodejs
genlisp
message_generation
rosbuild
rosconsole
std_msgs
rosgraph_msgs
xmlrpcpp
roscpp
rosgraph
ros_environment
rospack
roslib
rospy

定制你的package:

在 /catkin_ws/src/beginner_tutorials 文件夹下有一个 package.xml  文件。

使用gedit打开可以进行编辑来定制,具体标签及描述作用文件内注释有说明,也可查看 package.xml 

主要有以下标签:

<?xml version="1.0"?>
<package format="2">
  <name>beginner_tutorials</name>    #包名
  <version>0.1.0</version>
  <description>The beginner_tutorials package</description>    #包的描述,可以随便写
  
  <maintainer email="you@yourdomain.tld">Your Name</maintainer>    #维护人员及联系方式

  <license>BSD</license>    #许可证,BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3

  <url type="website">http://wiki.ros.org/beginner_tutorials</url>    #website, bugtracker, or repository

  <author email="you@yourdomain.tld">Jane Doe</author>    #作者及联系方式
  
  <buildtool_depend>catkin</buildtool_depend>    #编译工具
   
<depend>……</depend> 和以下两者等价 <build_depend>roscpp</build_depend> #依赖包 <exec_depend>roscpp</exec_depend> #依赖包

<build_export_depend>roscpp</build_export_depend> #依赖包
 

定制 CMakeLists.txt 

posted @ 2019-10-30 22:02  QMark  阅读(130)  评论(0编辑  收藏  举报