Packages

Usually when we talk about packages, we refer to a typical structure of files and folders. This structure looks as follows:

  • include/package_name/: This directory includes the headers of the libraries that you would need.
  • msg/: If you develop nonstandard messages, put them here.
  • scripts/: These are executable scripts that can be in Bash, Python,
    or any other scripting language.
  • src/: This is where the source files of your programs are present. You can create a folder for nodes and nodelets or organize it as you want.
  • srv/: This represents the service (srv) types.
  • CMakeLists.txt: This is the CMake build file.
  • package.xml: This is the package manifest.

To create, modify, or work with packages, ROS gives us tools for assistance, some of which are as follows:

  • rospack: This command is used to get information or find packages in the system.
  • catkin_create_pkg: This command is used when you want to create a new package.
  • catkin_make: This command is used to compile a workspace.
  • rosdep: This command installs the system dependencies of a package.
  • rqt_dep: This command is used to see the package dependencies as a graph. If you want to see the package dependencies as a graph, you will find a plugin called package graph in rqt. Select a package and see the dependencies.

To move between packages and their folders and files, ROS gives us a very useful package called rosbash, which provides commands that are very similar to Linux commands. The following are a few examples:

  • roscd: This command helps us change the directory. This is similar to the cd command in Linux.
  • rosed: This command is used to edit a file.
  • roscp: This command is used to copy a file from a package.
  • rosd: This command lists the directories of a package.
  • rosls: This command lists the files from a package. This is similar to the ls command in Linux.

Every package must contain a package.xml file, as it is used to specify information about the package. If you find this file inside a folder, it is very likely that this folder is a package or a metapackage.

If you open the package.xml file, you will see information about the name of the package, dependencies, and so on. All of this is to make the installation and the distribution of these packages easier .

Two typical tags that are used in the package.xml file are <build_depend> and
<run _depend>.

The <build_depend> tag shows which packages must be installed before installing the current package. This is because the new package might use functionality contained in another package.

The <run_depend> tag shows the packages that are necessary for running the code of the package. The following screenshot is an example of the package.xml file:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.192.183