@ferstar
2015-08-03T23:25:24.000000Z
字数 1753
阅读 2093
ROS
my_package/
CMakeLists.txt
package.xml
workspace_folder/ -- 工作目录
src/ -- 源码目录
CMakeLists.txt -- 顶层CMake file, 由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
$ cd ~/catkin_ws/src
然后新建一个beginner_tutorials
的软件包,依赖于std_msgs, roscpp, and rospy
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
输出
Created file beginner_tutorials/CMakeLists.txt
Created file beginner_tutorials/package.xml
Created folder beginner_tutorials/include/beginner_tutorials
Created folder beginner_tutorials/src
Successfully created files in /home/ferstar/catkin_ws/src/beginner_tutorials. Please adjust the values in package.xml.
catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
$ cd ~/catkin_ws
$ catkin_make
输出
Base path: /home/ferstar/catkin_ws
Source space: /home/ferstar/catkin_ws/src
Build space: /home/ferstar/catkin_ws/build
Devel space: /home/ferstar/catkin_ws/devel
Install space: /home/ferstar/catkin_ws/install
......
导出软件包路径到环境变量
$ . ~/catkin_ws/devel/setup.zsh
输出 无
rospack depends1 beginner_tutorials
输出
std_msgs
rospy
roscpp
所有依赖关系都存储在package.xml文件中
$ roscd beginner_tutorials
$ cat package.xml
...
catkin
roscpp
rospy
std_msgs
...
tab补全时如果发现如下权限不够的提示:
error while crawling /home/ferstar: boost::filesystem::status: Permission denied: "/home/ferstar/.gvfs
直接干掉这个目录
sudo umount ~/.gvfs
sudo rm -rf .gvfs
输出无
顾名思义,就是依赖的包还有依赖。。。囧rz
比如rospack depends1 rospy
输出
genpy
roscpp
rosgraph
rosgraph_msgs
roslib
std_msgs
这个略烦,好在ros有自己的办法列出所有依赖关系
rospack depends beginner_tutorials
输出同wiki
默认catkin_create_pkg工具已经自动建立该文件,照猫画虎即可,可以修改的信息有,描述,标签,许可,依赖等等
也是自动生成,用以指导编译程序如何编译安装软件包