Quick Overview of Filesystem Concepts
Packages: Packages are the software organization unit of ROS code. Each package can contain libraries, executables, scripts, or other artifacts.
Manifest (package.xml): A manifest is a description of a package. Its serves to define dependencies between packages and to capture meta information about the package like version, maintainer, license, etc...
Note: rosbuild users might be wondering where stacks went, the concept of stacks was removed with catkin to simplify the growing code base and to support better distribution of packages. In catkin you can define metapackages to collect similar packages and multiple packages can reside in a single VCS repository. Those two features replace the functionality of stacks.
Code is spread across many ROS packages. Navigating with command-line tools such as ls and cd can be very tedious which is why ROS provides tools to help you.
rospack allows you to get information about packages. In this tutorial, we are only going to cover the find option, which returns the path to package.
# rospack find [package_name]
$ rospack find roscpp
If you installed ROS from apt on Ubuntu Linux you would see exactly:
# roscd [locationname[/subdir]]
Run this example:
$ roscd roscpp
To verify that we have changed to the roscpp package directory. Now let's print the working directory using the Unix command pwd:
You should see:
You can see that YOUR_INSTALL_PATH/share/roscpp is the same path that rospack find gave in the previous example.
$ echo $ROS_PACKAGE_PATH
Similarly to other environment paths, you can add additional directories to your ROS_PACKAGE_PATH, with each path separated by a colon ':'.
roscd can also move to a subdirectory of a package or stack.
$ roscd roscpp/cmake $ pwd
You should see:
roscd log will take you to the folder where ROS stores log files. Note that if you have not run any ROS programs yet, this will yield an error saying that it does not yet exist.
If you have run some ROS program before, try:
$ roscd log
# rosls [locationname[/subdir]]
$ rosls roscpp_tutorials
cmake package.xml srv
It can get tedious to type out an entire package name. In the previous example, roscpp_tutorials is a fairly long name. Luckily, some ROS tools support TAB completion.
Start by typing:
# roscd roscpp_tut<<< now push the TAB key >>>
After pushing the TAB key, the command line should fill out the rest:
$ roscd roscpp_tutorials/
This works because roscpp_tutorials is currently the only ROS package that starts with roscpp_tut.
Now try typing:
# roscd tur<<< now push the TAB key >>>
After pushing the TAB key, the command line should fill out as much as possible:
$ roscd turtle
However, in this case there are multiple packages that begin with turtle. Try typing TAB another time. This should display all the ROS packages that begin with turtle:
turtle_actionlib/ turtlesim/ turtle_tf/
On the command line you should still have:
$ roscd turtle
Now type a s after turtle and then push TAB:
# roscd turtles<<< now push the TAB key >>>
Since there is only one package that start with turtles, you should see:
$ roscd turtlesim/
You may have noticed a pattern with the naming of the ROS tools:
- rospack = ros + pack(age)
- roscd = ros + cd
- rosls = ros + ls
This naming pattern holds for many of the ROS tools.