先下载课程主页提及的功能包:
wget https://labfile.oss.aliyuncs.com/courses/854/rosdemos_ws.zip
解压缩:
unzip rosdemos_ws.zip
选择,任一个按“ROS1云课→03工作空间”中内容,进行编译,以ros_tutorials为例:
功能包指的是一种特定结构的文件和文件夹组合。这种结构如下所示:
为了创建、修改或使用功能包,ROS提供了一些工具:
- shiyanlou:ros_tutorials/ $ rospack -h [15:59:02]
- USAGE: rospack <command> [options] [package]
- Allowed commands:
- help
- cflags-only-I [--deps-only] [package]
- cflags-only-other [--deps-only] [package]
- depends [package] (alias: deps)
- depends-indent [package] (alias: deps-indent)
- depends-manifests [package] (alias: deps-manifests)
- depends-msgsrv [package] (alias: deps-msgsrv)
- depends-on [package]
- depends-on1 [package]
- depends-why --target=
[package] (alias: deps-why) - depends1 [package] (alias: deps1)
- export [--deps-only] --lang=
--attrib= [package] - find [package]
- langs
- libs-only-L [--deps-only] [package]
- libs-only-l [--deps-only] [package]
- libs-only-other [--deps-only] [package]
- list
- list-duplicates
- list-names
- plugins --attrib=
[--top=] [package] - profile [--length=
] [--zombie-only] - rosdep [package] (alias: rosdeps)
- rosdep0 [package] (alias: rosdeps0)
- vcs [package]
- vcs0 [package]
- Extra options:
- -q Quiets error reports.
-
- If [package] is omitted, the current working directory
- is used (if it contains a package.xml or manifest.xml).
- shiyanlou:ros_tutorials/ $ rqt_dep -h [16:00:53]
- usage: main.pyc [-b BINDING] [--clear-config] [--force-discover] [-h]
- [--reload-import] [-t] [-v]
-
- Options for GUI instance:
- -b BINDING, --qt-binding BINDING
- choose Qt bindings to be used [pyqt|pyside]
- --clear-config clear the configuration (including all perspectives
- and plugin settings)
- --force-discover force a rediscover of plugins
- -h, --help show this help message and exit
- --reload-import reload every imported module
- -t, --on-top set window mode to always on top
- -v, --verbose output qDebug messages
若要在文件夹和功能包之间移动文件,ROS提供了非常有用的rosbash功能包,其中包含了一些非常类似于Linux命令的命令。例如:
文件package.xml必须在功能包中,用来说明此功能包相关的各类信息。如果你发现在某个文件夹内包含此文件,那么这个文件夹很可能是一个功能包或综合功能包。
打开一个package.xml文件,可以看到包的名称、依赖关系等信息。功能包清单的作用就是为了更容易地安装和分发这些功能包。
在package.xml文件中使用的两个典型标记是<build_depend>和<run_depend>。
<build_depend>标记会显示当前功能包安装之前必须先安装哪些功能包。这是因为新的功能包会使用其他包的一些功能。
<run_depend>标记显示运行功能包代码所需要的包。
补充:
- https://docs.ros.org/en/kinetic/api/catkin/html/howto/format2/index.html
- https://docs.ros.org/en/kinetic/api/catkin/html/howto/format2/migrating_from_format_1.html