Introduction to Ros File System (II)

Source: Internet
Author: User

This tutorial introduces the Ros file system concepts, including the use of command-line tools ROSCD, Rosls, and Rospack.

Content:
Preliminary work Quick Understanding File System Concept File System Tools
Using Rospack
Using ROSCD
ROSCD Log
Using Rosls
Tab AutoComplete Input Review

preparatory work

In this tutorial we will use the Ros-tutorials package, please install first:

$ sudo apt-get install ros-<distro>-ros-tutorials

will be replaced with the version you installed (such as Jade, Indigo, hydro, groovy, fuerte, etc.).

Quick understanding of File system Concepts

Packages: A software package that is an organizational unit of ROS application code, each of which can contain libraries, executables, scripts, or other manually created items.

Manifest (package.xml): A manifest is a description of the ' package ' related information that defines the dependencies between package-related meta-information, including versions, maintainers, and license agreements. 

Show Note about Stacks

File System Tools

program code is distributed among many Ros packages and is cumbersome to navigate using command-line tools such as LS and CD, so Ros provides specialized command tools to simplify these operations.

using Rospack

Rospack allows you to obtain information about the package. In this tutorial, we only refer to the Find parameter option in Rospack, which returns the path information for the package.

# rospack Find [package name]
$ rospack Find Roscpp

Should your_install_path/share/roscpp be installed on the Ubuntu Linux operating system via apt to install ROS, you should be able to see exactly:

    /opt/ros/groovy/share/roscpp

using ROSCD

ROSCD is part of the Rosbash command set, which allows you to switch (CD) working directories directly into a package or package set.

Usage:

# ROSCD [Local package name [/subdirectory]]

Example:

$ ROSCD Roscpp

To verify that we have switched to the Roscpp package directory, we can now use the UNIX command pwd to output the current working directory:

$ pwd

You should see:

    Your_install_path/share/roscpp

You can see that the your_install_path/share/roscpp is the same as the path name previously obtained using Rospack find.

Note that, like other tools in Ros, ROSCD can only switch to packages that are already contained in the ROS_PACKAGE_PATH environment variable, and to see the paths contained in the Ros_package_path can be entered:

$ echo $ROS _package_path

Your ROS_PACKAGE_PATH environment variable should contain the paths where the Ros packages are stored, separated by colons between each path. A typical Ros_package_path environment variable is as follows:

    /opt/ros/groovy/base/install/share:/opt/ros/groovy/base/install/stacks

Similar to other PATH environment variables, you can add additional paths in Ros_package_path, each separated by a colon ': '.

Sub-directories

You can also switch to a sub-directory of a package or package set using ROSCD.

Perform:

$ ROSCD roscpp/cmake
$ pwd

You should see:

    Your_install_path/share/roscpp/cmake

ROSCD Log

Use ROSCD log to switch to the Ros save journal file directory. It should be noted that if you have not performed any ROS programs, the system will say that the directory does not exist.

If you have already run a ROS program, you can try:

$ ROSCD Log

using Rosls

Rosls is part of the Rosbash command set, which allows you to execute the LS command (listing directories) directly by the name of the package instead of the absolute path.

Usage:

# ROSLS [Local package name [/subdirectory]]

Example:

$ Rosls Roscpp_tutorials

Should output:

    CMake  package.xml  SRV

Tab Auto-Complete input

It becomes tedious to enter a full package name. In the previous example Roscpp tutorials was a fairly long name, fortunately, some Ros tools support tab autocomplete.

Input:

# ROSCD roscpp_tut<<< Now press the TAB key >>>

When you press the TAB key, the remaining parts should be automatically replenished on the command line:

$ ROSCD roscpp_tutorials/

This should be useful because roscpp tutorials is currently the only Ros package with a name that begins with Roscpp Tut.

Now try to enter:

# ROSCD tur<<< Now press the TAB key >>>

When you press the TAB key, the command should be automatically replenished as complete as possible:

$ ROSCD Turtle

However, in this case there are multiple packages that start with turtle, and when you press the TAB key again, all Ros packages starting with Turtle should be listed:

    turtle_actionlib/  turtlesim/  turtle_tf/

At this point in the command line you should still see only:

$ ROSCD Turtle

Now enter S after Turtle and press the TAB key:

# ROSCD turtles<<< Please press the TAB key >>>

Because only one package name starts with turtles, you should see:

$ ROSCD turtlesim/

Original address: Http://wiki.ros.org/cn/ROS/Tutorials/NavigatingTheFilesystem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.