Notes on how to install ROS 1-1

Source: Internet
Author: User
Tags echo command

Notes on how to install ROS 1-1

Installation

After installation, Step 1.6 sets the environment, and the echo Command Used in the stage is a common command. Its function is to send the input string to the standard output. When the format is echo file content> file name, the file content is added to the file.

 

The bash file mainly defines the environment variables required for running.

Source setup. bash is to set setup. bash files are mounted to the ROS file system. When you execute some file system commands, you will not be prompted to find the packages or files in the workspace.

~ /. Bashrc: This file contains bash information dedicated to your bash shell. This file is read when you log on and every time you open a new shell.

Use source ~ /. Make bashrc take effect.

Source function: enables shell to read the specified shell program file and execute all statements in the file in sequence.

The source command is usually used to re-execute the modified initialization file so that it takes effect immediately without logging out and logging on again.

 

Another step during installation is to configure the source. list file. The statements used are as follows:

 

THE sh command is the shell command language interpreter. The command is executed to read from standard input or from a file. You can enter commands to communicate with the kernel. The-c parameter indicates that the command is read from the string after-c.

 

Two important ROS Environment Variables

ROS_PACKAGE_PATH: The Path to search for the ros package.

ROS_WORKSPACE job path. roscd location.

Both environment variables are in/opt/ros/indigo/setup. bash

/Home/xuhao/ros/ros_ws/devel/setup. bash

So it will overlap. The last one overwrites the previous one, and then we ~ /. Custom ROS_WORKSPACE in bashrc

In those two bash files, I cannot understand the language used.

 

 

ROS tools

Rosed

Rosed is one of the rosbash suites. With it, we can directly edit the files in the Feature Pack by name without having to know the path of the Feature Pack.

Usage:

$ Rosed [package_name] [filename]

The default rosed editor is vim. To set it to another default editor, you need to edit the file ~ /. Bashrc: Modify the EDITOR environment variable, including the following information:

In this example, emacs is used as the default EDITOR.

Rospack:

 

 

 

Catkin_make Process

Catkin_make is equivalent to the following command.

$ Cd ~ /Catkin_ws

$ Cd src

$ Catkin_init_workspace

$ Cd ..

$ Mkdir build

$ Cd build

$ Cmake ../src-DCMAKE_INSTALL_PREFIX = ../install-DCATKIN_DEVEL_PREFIX = ../devel

$ Make

It can be seen from the command that catkin_make must be executed in the ws folder, and the folder must have a src sub-folder, after the execution is complete, two new subfolders, build and devel, are displayed in the ws file.

The cmakelist.txt file for public use under srcis first compiled

Most of the content in this file is located at the location of the catkin package. Finally, execute a cmake function catkin_workspace. This function is defined in the/opt/ros/kinetic/share/catkin/cmake/catkin_workspace.cmake file. This function parses the parameters when catkin_make is executed, such as CATKIN_WHITELIST_PACKAGES. Then, traverse the folders in the workspace. If there is a package. xml file in the folder, use it as a software package. Add_subdirectory is also called for each software package. Add_subdirectoryis the internal directory of A cmake. the cmakelist.txt file in this folder will be used. In this way, the compilation of each software package is started.

Http://blog.csdn.net/bluewhalerobot/article/details/73658162)

The generated devel and build folders. devel is the abbreviation of develop, so it is the development environment.

 

The above is the content of the devel folder.

The bin contains compiled executable files. Lib is the library file of pkg. pc and python. Include is used to place header files. Share the generated pkgConfig. cmake file.

For build folders, some intermediate files are generated, such as files used to store environment variables. This folder is of little significance.

Summarize the entire compilation process
1. Run catkin_make.
2. Run catkin_workspace. Parse the catkin_make parameter and traverse the entire workspace and add all the folders with package. xml to the package list. Execute add_subdirectory for each package
3. Execute the cmakelist.txt file in each software package.
4. Run catkin_package. Parse the package. xml file and load the corresponding parameters. Load the corresponding software package Parameters Based on the dependency parameters. Generate the configuration file of the current software package based on the loading parameters.

 

Create an ROS package)

There are two basic concepts in the ROS File System: package and manifest, that is, package and inventory file.

Package is the most basic unit for organizing ROS code. Each Package can contain library files, executable files, scripts, and other files.

The Manifest file is a description of Package information. It provides dependencies between packages and metadata of a Package, such as version, maintenance, and license. That is, the package. xml file in each package.

A typical workspace structure is as follows:

 

Rospack is used to obtain information about a package. Here we will only introduce its find option. Its usage is as follows:

Rospack find [package_name]

The roscd command allows you to directly switch to the corresponding file directory using the package name. Of course, this is for the ROS file system. Its usage is as follows:

Roscd [package_name]

Roscd can only open the directories and Their subdirectories that exist in the environment variable ROS_PACKAGE_PATH.

A package consists of the following parts:

(1) A package. xml file must be included. The catkin_make process shows that the package. xml file is the package ID.

(2)packages Package A cmakelists.txt file, which is also required by catkin_make.

(3) Each folder can have only one package, and the package cannot be nested. A package is a set of functions that exist in a workspace and contain many code files.

A simple package is similar to the following:
My_package/
CMakeLists.txt
Package. xml

You can use catkin_create_pkg to easily create a package:

When using the catkin_create_pkg command, you are required to give the package name and selectively give the package on which the created package depends. It is used as follows:
Catkin_create_pkg package_name [depend1] [depend2] [depend3]

For example, catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

You can create a package named beginner_tutorials, which depends on the following three packages:

Std_msgs, rospy, and roscpp.
You can see package.xmland cmakelists.txt in the inner_tutorialsfolder.

Alternatively, use roscreate-pkg package_name [depend1] [depend2] [depend3] to create a package.

Then use rosmake package_name

** Catkin is an official ROS compilation and building system. It is the successor of the original ROS compilation and building system rosbuild.

 

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.