2.1 前提
在使用ROS官方Tutorial之前,你需要安装如下的软件包。
$ sudo apt-get install ros-<distro>-ros-tutorials |
将<distro>替换为对应的ROS版本,如indigo、kinect。
2.2 ROS文件系统概览
(1)Packages
Packages是ROS代码软件结构的最小单元。每一个package都会包含libraries, executables, scripts, 以及一些其他文件。
(2)Manifests (package.xml)
一个manifest文件是一个package的描述,它用来定义该package的dependencies, version, maitainer, license, 等。
(3)Stacks
stackes的概念在catkin中被去除了,以此来简化快速增长的代码并提供更好的软件包发行。
2.3 文件系统工具
$ rospack find PACKAGE_NAME |
Returns the path to this package. eg. $ roapack find roscpp /opt/ros/indigo/share/roscpp |
$ roscd PACKAGE_NAME |
Change directory (cd) directly to a package or a stack. eg. $ roscd roscpp $ pwd YOUR_INSTALL_PATH/share/roscpp |
$ pwd |
print the current working directory |
$ echo $ROS_PACKAGE_PATH |
To see what is in your ROS_PACKAGE_PATH. eg. $ echo $ROS_PACKAGE_PATH /opt/ros/kinetic/base/install/share:/opt/ros/kinetic/base/install/stacks |
$ roscd PACKAGE_NAME/SubdirName |
roscd can also move to a subdirectory of a package or stack. eg. $ roscd roscpp/cmake $ pwd |
$ roscd log |
roscd log will take you to the folder where ROS stores log files. eg. $ roscd log |
$ rosls [locationname[/subdir]] |
rosls is part of the rosbash suite. It allows you to ls directly in a package by name rather than by absolute path. eg. $ rosls roscpp_tutorials cmake launch package.xml srv |
Tab Completion |
ROS support TAB completion to complete a package name automatically. eg. $ roscd roscpp_tut<<< now push the TAB key >>> |