Configure ROS working environment and brief introduction file System (II)

Source: Internet
Author: User

After installing the ROS operating system, the script environment should be configured accordingly. In order to ensure that environment variables such as Ros_root and Ros_package_path have been set correctly, the terminal input command

$ export | grep ROS

If the discovery is not configured, we will need some ' source ' setup.*sh ' files. After installing the ROS operating system via the APT tool on Ubuntu, we will see the setup.*sh file in the ' opt/ros/indigo/' directory. The system I installed here is Ros Indigo, which performs the following commands:

$ source/opt/ros/indigo/setup.bash
Each time you open the terminal you need to run the above command before you can run the Ros-related commands, in order to avoid this tedious process, You can advance in the. bashrc file (for beginners Please note: This file is in the home directory of the current system user) to add this command, so that when you log in after each time the system has helped you to perform these commands to configure the environment.

Next we need to create a Ros workspace, and for the Ros Indigo version of the system we recommend creating a Catkin workspace. Execute the following command

$ mkdir-p ~/catkin_ws/src
$ cd ~/CATKIN_WS/SRC

Usually there is no package in the SRC directory, only the CMakeLists.txt file. We can try to compile:

$ cd ~/catkin_ws/
$ catkin_make
The Catkin_make command is a very handy tool in the Catkin workspace.

To ensure that the workspace is configured correctly, make sure that the ROS_PACKAGE_PATH environment variable contains your workspace directory, which is viewed using the following command:

$ echo $ROS _package_path
Get the result is

/home/<youruser>/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
Here <youruser> is the current computer user name.

The ROS working environment has been built.

The following is a brief introduction to the Ros file system and the use of the command line tool Rosls,roscd,rospack.

the concept of file systems

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.

Ros provides a dedicated command tool to facilitate the management of file systems.

1. Rospack command

The Find parameter option in Rospack that returns the path information for the package. Usage:

# rospack Find [package name]
If you enter a command

$ rospack Find Roscpp

Output

/opt/ros/indigo/share/roscpp

2. ROSCD command

ROSCD is part of the Rosbash command set and is a direct switch (CD) working directory command. Usage:

# ROSCD [Local package name [/subdirectory]]
Example:

$ ROSCD Roscpp

Should output:

Your_install_path/share/roscpp
Here, the your_install_path/share/roscpp is the same as the path name previously obtained using Rospack find.

We can use the PWD command to view the current working directory.

ROSCD can only switch to packages that are already contained in the ROS_PACKAGE_PATH environment variable, to see the paths contained in the Ros_package_path can be entered:

$ echo $ROS _package_path
You can also switch to a package or package set using ROSCD. Sub-directoriesIn

Command Line Input:

$ ROSCD roscpp/cmake
$ pwd
Output:

Your_install_path/share/roscpp/cmake
3. ROSCD Log Command

ROSCD log can be switched to the directory where Ros saves the journal files.

4. Rosls command

Usage:

# ROSLS [Local package name [/subdirectory]]
To illustrate:

$ Rosls Roscpp_tutorials
Should output:

CMake  package.xml  SRV
In addition, some ROS tools Support tab Auto-complete inputThe function. When we want to enter a package name, the TAB key automatically complements the full name, greatly improving the efficiency of our input command line code.

remark:

How the Ros command tool is named:
Rospack = ros + Pack (age)
ROSCD = ros + cd
Rosls = ros + ls
This naming method is used in many ROS command tools.

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.