Mastering ROS for Robotics Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

ROS metapackages

Metapackages are specialized packages in ROS that only contain one file, that is, a package.xml file. They don't contain folders and files like a normal package.

Metapackages simply group a set of multiple packages as a single logical package. In the package.xml file, the metapackage contains an export tag, as shown here:

  <export> 
    <metapackage/> 
  </export>  

Also, in metapackages, there are no <buildtool_depend> dependencies for catkin; there are only <run_depend> dependencies, which are the packages grouped in the metapackage.

The ROS navigation stack is a good example of metapackages. If ROS and its navigation package are installed, we can try the following command, by switching to the navigation metapackage folder:

$ roscd navigation  

Open package.xml using your favorite text editor (gedit in the following case):

$ gedit package.xml  

This is a lengthy file; here is a stripped-down version of it:

Figure 5: Structure of meta-package package.xml