catkin-tools


http://catkin-tools.readthedocs.io/en/latest/cheat_sheet.html

一.Initializing Workspaces初始化工作空間

初始化具有默認布局的工作區(src/build/devel)在當前目錄中:

        catkin init
        catkin init --workspace .
        catkin config --init
        mkdir src && catkin build

在不同目錄中具有默認布局:

        catkin init --workspace /tmp/path/to/my_catkin_ws

顯式擴展另一個工作區:

        catkin config --init --extend /opt/ros/indigo

初始化具有源空間other_src的工作空間:

        catkin config --init --source-space other_src

or a workspace with build, devel, and install space ending with the suffix _alternate:

        catkin config --init --space-suffix _alternate

二.Configuring Workspaces配置工作空間

查看當前配置:

        catkin config

設置和復位CMake選項:

        catkin config --cmake-args -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB
        catkin config --no-cmake-args

將安裝切換到指定的安裝空間:

        catkin config --install

三.Building Packages編譯包

[1]Build all the packages:

        catkin build

...one at a time, with additional debug output[一次一個,額外的調試輸出]:

        catkin build -p 1

...迫使CMake重新配置每一個:

        catkin build --force-cmake

[2]Build a specific package and its dependencies:

        catkin build my_package

... or ignore its dependencies:

        catkin build my_package --no-deps

[3]Build packages包含當前的工作目錄:

        catkin build --this

... but don’t rebuild its dependencies:

        catkin build --this --no-deps

[4]Build packages有額外的CMake參數:

        catkin build --cmake-args -DCMAKE_BUILD_TYPE=Debug

... and save them to be used for the next build:

        catkin build --save-config --cmake-args -DCMAKE_BUILD_TYPE=Debug

Build all packages 在給定目錄中:

        catkin build $(catkin list -u /path/to/folder)

... or in the current folder:

        catkin build $(catkin list -u .)

四.Cleaning Build Products

清理 the build, devel, and install spaces (if they exist):

        catkin clean

... or just the build space:

        catkin clean --build

... or just clean a single package:

        catkin clean PKGNAME

... or just delete the build directories(生成目錄) for packages which have been disabled or removed:

        catkin clean --orphans

五.Create Packages

快速創建workspace中的catkin packages:

Creates catkin workspace resources like packages:

        catkin create pkg

六.Environment Utility

 It can be used to both print the current environment variables and run a command in a modified (修改的)environment.It is primarily used in the build stage command reproduction.

Run an arbitrary command in a modified environment:

catkin env [-h] [-i] [-s]
           [NAME=VALUE [NAME=VALUE ...]] [COMMAND] [ARG [ARG ...]]

七.List Package Info

 It is used to find and list information about catkin packages. By default(默認情況下), it will list the packages in the workspace containing the current working directory. It can also be used to list the packages in any other arbitrary directory.

Lists catkin packages in the workspace or other arbitray folders:
catkin list [-h] [--workspace WORKSPACE] [--profile PROFILE]
            [--deps | --rdeps] [--depends-on [PKG [PKG ...]]]
            [--rdepends-on [PKG [PKG ...]]] [--this] [--quiet]
            [--unformatted]

八.Locate Directories定位路徑

 It can be used to locate important locations in the workspace such as the active source, build, devel, and install spaces, and package directories in the workspace.

Get the paths to various locations in a workspace:
catkin locate [-h] [--workspace WORKSPACE] [--profile PROFILE] [-e]
              [-r] [-q] [-s | -b | -d | -i] [--shell-verbs]
              [--examples]
              [PACKAGE]

九.Manage Profiles

創建所有應用程序服務器運行時環境。該命令創建概要文件,即定義 Deployment Manager、定制概要文件或獨立應用程序服務器的運行時環境的文件集合。

It has several sub-commands for profile management.有多個子命令用於配置文件管理

Manage config profiles for a catkin workspace:

catkin profile [-h] [--workspace WORKSPACE]
                      {list,set,add,rename,remove} ...

sub-command help:
    list                List the available profiles.
    set                 Set the active profile by name.
    add                 Add a new profile by name.
    rename              Rename a given profile.
    remove              Remove a profile by name.

十.Controlling Color Display控制彩色顯示

Disable colors when building in a shell that doesn’t support it (like IDEs):

        catkin --no-color build

... or enable it for shells that don’t know they support it:

        catkin --force-color build

十一.Profile Cookbook

Create “Debug” and “Release” profiles and then build them in independent build and devel spaces:

catkin config --profile debug -x _debug --cmake-args -DCMAKE_BUILD_TYPE=Debug
catkin config --profile release -x _release --cmake-args -DCMAKE_BUILD_TYPE=Release
catkin build --profile debug
catkin build --profile release
快速從頭開始建立一個包Quickly build a package from scratch to make sure all of its dependencies are satisfied, then clean it:
catkin config --profile my_pkg -x _my_pkg_test
catkin build --profile my_pkg my_pkg
catkin clean --profile my_pkg --all

十二.Manipulating Workspace Chaining操縱空間鏈接

Change from implicit to explicit chaining[從隱性到顯性鏈接:]:

catkin clean
catkin config --extend /opt/ros/indigo

Change from explicit to implicit chaining:

catkin clean
catkin config --no-extend

十三.Building With Other Job Servers

Build with distcc:

CC="distcc gcc" CXX="distcc g++" catkin build -p$(distcc -j) -j$(distcc -j) --no-jobserver

 

 

 總結:

catkin init – Initialize a Workspace初始化

 

catkin config – Configure a Workspace配置

 

catkin build – Build Packages編譯

catkin clean – Clean Build Products

catkin create – Create Packages

catkin env – Environment Utility

catkin list – List Package Info

catkin locate – Locate Directories

catkin profile – Manage Profiles

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM