[Documentation] [TitleIndex] [WordIndex

Building Packages

Uma vez que toda as dependência de sistema em relação ao seu pacote foram instaladas, podemos gerar um novo pacote.

Note: Se você instalou o ROS usando apt ou outro gerenciador de pacote, você já deve todas as dependências necessárias.

If you installed ROS using apt or some other package manager, you should already have all of your dependencies.

Antes de continuarmos, lembre-se de inicializar seu arquivo de "setup" de ambiente, caso já não tenha feito.No Ubuntuo comendo é algo assim (nesse caso, a inicialização é do ambiente da distribuição ""Groovy""):

Before continuing remember to source your environment setup file if you have not already. On Ubuntu it would be something like this:

$ source /opt/ros/groovy/setup.bash

Using catkin_make

catkin_make é uma ferramente de linha de comando que adciona utilidades ao "workflow" padrão do catkin. Pode-se imaginar que o catkin_make combina chamadas do cmake e make em um "workflow" CMake padrão.

is a command line tool which adds some convenience to the standard catkin workflow. You can imagine that catkin_make combines the calls to cmake and make in the standard CMake workflow.

Usage:

# In a catkin workspace
$ catkin_make [make_targets] [-DCMAKE_VARIABLES=...]

For people who are unfamiliar with the standard CMake workflow, it breaks down as follows:

Note: If you run the below commands it will not work, as this is just an example of how CMake generally works.

# In a CMake project
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install  # (optionally)

This process is run for each CMake project. In contrast catkin projects can be built together in workspaces. Building zero to many catkin packages in a workspace follows this work flow:

# In a catkin workspace
$ catkin_make
$ catkin_make install  # (optionally)

The above commands will build any catkin projects found in the src folder. This follows the recommendations set by REP128. If your source code is in a different place, say my_src then you would call catkin_make like this:

Note: If you run the below commands it will not work, as the directory my_src does not exist.

# In a catkin workspace
$ catkin_make --source my_src
$ catkin_make install --source my_src  # (optionally)

For more advanced uses of catkin_make see the documentation: catkin/commands/catkin_make

Building Your Package

For readers of this page who are about to build your own codes, please also take a look at later tutorial (C++)/(Python) since you may need to modify CMakeLists.txt.

You should already have a catkin workspace and a new catkin package called beginner_tutorials from the previous tutorial, Creating a Package. Go into the catkin workspace if you are not already there and look in the src folder:

$ cd ~/catkin_ws/
$ ls src

You should see that there is a folder called beginner_tutorials which you created with catkin_create_pkg in the previous tutorial. We can now build that package using catkin_make:

$ catkin_make

You should see a lot of output from cmake and them make, which should be similar to this:

Note that catkin_make first displays what paths it is using for each of the 'spaces'. The spaces are described in the REP128 and by documentation about catkin workspaces on the wiki: catkin/workspaces. The important thing to notice is that because of these default values several folders have been created in your catkin workspace. Take a look with ls:

$ ls

The build folder is the default location of the build space and is where cmake and make are called to configure and build your packages. The devel folder is the default location of the devel space, which is where your executables and libraries go before you install your packages.


2019-10-12 12:58