<<IncludeCSTemplate: execution failed [ascii] (see also the log)>>
Contents
Quick Overview of Filesystem Concepts
Packages: Packages are the lowest level of ROS software organization. They can contain anything: libraries, tools, executables, etc.
Manifest: A manifest is a description of a package. Its most important role is to define dependencies between packages.
Stacks: Stacks are collections of packages that form a higher-level library.
Stack Manifest: These are just like normal manifests, but for stacks.
When you look at the filesystem, it's easy to tell packages and stacks apart:
- A package is a directory with a manifest.xml file.
- A stack is a directory with a stack.xml file.
Filesystem Tools
For ROS there is lots of code spread across many packages and stacks. Navigating with command-line tools such as ls and cd would be very tedious. This is why ROS provides its own tools to help you.
Using rospack and rosstack
rospack and rosstack are part of the rospack suite. These allow you to get information about packages and stacks. In this tutorial, we are only going to cover the find option, which returns the path to package or stack.
Usage:
$ rospack find [package_name] $ rosstack find [stack_name]
Example:
$ rospack find roscpp
Would return:
YOUR_INSTALL_PATH/ros/core/roscpp
Using roscd
roscd is part of the rosbash suite. It allows you to change directory (cd) directly to a package or a stack.
Usage:
$ 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:
$ pwd
You should see:
YOUR_INSTALL_PATH/ros/core/roscpp
You can see that YOUR_INSTALL_PATH/ros/core/roscpp is the same path that rospack find gave in the previous example.
Subdirectories
roscd can also move to a subdirectory of a package or stack.
Try:
$ roscd roscpp/include $ pwd
You should see:
YOUR_INSTALL_PATH/ros/core/roscpp/include
Special cases for roscd
There are a few special places you can tell roscd to go, that are not a package or stack.
roscd with no arguments
roscd without an argument will take you to $ROS_ROOT. Try:
$ roscd $ pwd
You should see:
YOUR_INSTALL_PATH/ros
This path is the same as defined by $ROS_ROOT. Try:
$ echo $ROS_ROOT
You should see:
YOUR_INSTALL_PATH/ros
roscd log
roscd log will take you to the folder where ROS stores its log files. You might not have any use for log files yet.
Try:
$ roscd log
Using rosls
rosls is part of the rosbash suite. It allows you to ls directly in a package, stack, or common location by name rather than by package path.
Usage:
$ rosls [locationname[/subdir]]
Example:
$ rosls roscpp_tutorials
Would return:
add_two_ints_client listener_unreliable add_two_ints_server listener_with_tracked_object add_two_ints_server_class listener_with_userdata anonymous_listener Makefile babbler manifest.xml CMakeLists.txt node_handle_namespaces custom_callback_processing notify_connect listener srv listener_async_spin talker listener_multiple time_api listener_single_message timers listener_threaded_spin
Tab Completion
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_<<< 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_.
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_teleop/ 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/
Review
You may have noticed a pattern with the naming of the ROS tools:
- rospack = ros + pack(age)
- rosstack = ros + stack
- roscd = ros + cd
- rosls = ros + ls
This naming pattern holds for many of the ROS tools.
Now that you can get around in ROS, let's create a new package.






