Compiling Ros Package--4

Source: Internet
Author: User

Compile the package (original blog, reprint please indicate the source-Zhou Xuewei)

1. Compile the package:

Once you have installed the required system dependencies, we can start compiling the package that we just created.

Note: If you install Ros through apt or other package management tools, all dependencies are installed by default.

Remember to source your environment configuration (Setup) file beforehand, the operation instructions in Ubuntu are as follows:

[Email protected]: Source/opt/ros/indigo/setup.bash

2. Using Catkin_make

Catkin_make is a command-line tool that simplifies the standard workflow of Catkin. You can think of Catkin_make as calling CMake and make in turn in the CMake standard workflow.

How to use::

# under Catkin workspace $ catkin_make [make_targets] [-dcmake_variables= ...]

CMake standard workflow can be divided into the following steps: If you run the following command is not valid, because it is only a demonstration CMake workflow example.

# in a CMake project $ mkdir build$ CD build$ cmake. $ make$ Make install  # (optional)

Each CMake project will perform this procedure at compile time. Instead, multiple Catkin projects can be compiled together in a workspace with the following workflow:

# in a catkin workspace[email protected]: Catkin_make[email protected]: Catkin_make install  # (optional)

The above command compiles all Catkin works under the src folder. If your source code is not in the default workspace (~/CATKIN_WS/SRC), for example, stored in my_src , you can use Catkin_make:

# in a Catkin workspace[email protected]:--source my_src[email protected]:-- SOURCE MY_SRC  # (optionally)

3. Start compiling packages

For readers who are about to compile their own code at once, take a look at the (c + +)/(Python) tutorial as you might need to modify the CMakeLists.txt file.

Following the previous tutorial on creating a Ros package, you should have created a Catkin workspace and a catkin package called beginner_tutorials . Now switch to Catkin workspace and view the src folder:

[email protected]: CD ~/catkin_ws/[email protected]: ls src

You can see a folder named beginner_tutorials , which you created in the previous catkin_create_pkg tutorial. Now we can use the Catkin_make to compile it:

[email protected]: catkin_make

Catkin_make first outputs the path where each space it uses. For more information on space , please refer to REP128 and catkin/workspaces. It is important to note that due to the default configuration of these spaces, several folders have been automatically generated in the Catkin workspace, using ls to view:

[email protected]: ls

The build directory is the default location for build space, and cmake and make are also called here to configure and compile your package. The devel directory is the default location for Devel space, and it is where you store executable and library files before you install the package.

Compiling Ros Package--4

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.