Ros Catkin命令工具

Ros Catkin命令工具

目前编译ROS的Package有两种方法:

    catkin_make
    catkin build

catkin_make
catkin_make 是一个命令行工具,它简化了catkin的标准工作流程。你可以认为catkin_make是在CMake标准工作流程中依次调用了cmake 和 make。

catkin build
与catkin_make不同,catkin命令行工具不仅仅是围绕cmake和make命令的瘦包装器。 catkin build命令隔离地在工作空间的源空间中构建每个包,以防止构建时串扰。 因此,在其最简单的用法中,catkin构建的行为类似于catkin_make_isolated的并行化版本。

使用方法如下:
# 在catkin工作空间下
$ cd ~/catkin_ws/src
$ catkin_init_workspace

//现在使用catkin_create_pkg命令创建一个名为beginner_tutorials的新软件包  
// # catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

//如果你还没设置环境的话,记得先soucre一下
$ source /opt/ros/<distro>/setup.bash  


//指定编译某些功能包
$ catkin_make -DCATKIN_WHITELIST_PACKAGES="package1;package2"
$ catkin_make install  # (可选)

//指定安装路径
$ catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/<distro> install   

//不依赖的单独编译工作空间中的各个程序包:使用catkin_make_isolated,如果你的两个程序包包含了两个相同名称的节点,而你不使用该命令进行编译的话,则会出现依赖错误。
$ catkin_make_isolated

catkin是一个用于处理catkin元构建系统和catkin工作区的命令行工具。其用法如下:
`catkin VERB -h` for help on each verb listed below:
  
    build    Builds a catkin workspace.
    clean    Deletes various products of the build verb.
    config    Configures a catkin workspace's context.
    create    Creates catkin workspace resources like packages.
    env            Run an arbitrary command in a modified environment. 
    init    Initializes a given folder as a catkin workspace.
    list    Lists catkin packages in the workspace or other arbitray folders.
    locate    Get the paths to various locations in a workspace.
    profile    Manage config profiles for a catkin workspace.
同样可使用catkin build命令编译ROS的package。
原文地址:https://www.cnblogs.com/lovebay/p/14265691.html