非源码编译集成ROS软件包的配置

在很多的时候,我们需要将编译好的ROS软件给第三方集成打包发布。当然我们可以使用.deb的形式释放。但是多方联合开发的项目就不是很方便。于是我们可以使用ROS catkin_make 来集成发布。
步骤如下:

  1. 在源代码工程中使用 catkin_make install 进行编译,完成后会将所要释放的程序和配置文件拷贝到 install文件夹下。
$ ls install/
env.sh  lib  local_setup.bash  local_setup.sh  local_setup.zsh  setup.bash  setup.sh  _setup_util.py  setup.zsh  share
  1. install下的 lib,share拷贝到需要发布到的工程中 src
/src$ tree -L 2
.
├── CMakeLists.txt -> /opt/ros/melodic/share/catkin/cmake/toplevel.cmake
├── core
│   ├── CMakeLists.txt
│   ├── lib
│   ├── package.xml
│   └── share

如上所述core文件夹下的 libshare就是发布的内容。

  1. 再次通过catkin_make来集成发布就需要在core文件夹下新建 CMakeLists.txtpackage.xml

CMakeLists.txt内容如下:

cmake_minimum_required(VERSION 2.8.3)
project(core)

find_package(catkin REQUIRED)

catkin_package(
#  INCLUDE_DIRS include
#  CATKIN_DEPENDS other_catkin_pkg
#  DEPENDS system_lib
)

###########
## Build ##
###########

include_directories(
# include
# ${catkin_INCLUDE_DIRS}
)


#############
## Install ##
#############

## Mark other files for installation (e.g. launch and bag files, etc.)
 install(DIRECTORY lib/
   DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} USE_SOURCE_PERMISSIONS
   FILES_MATCHING PATTERN "*" 

)
 install(DIRECTORY share/
   DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION} USE_SOURCE_PERMISSIONS

)

package.xml内容如下:

<?xml version="1.0"?>
<package format="2">
  <name>core</name>
  <version>1.0.0</version>
  <description>The core package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <maintainer email="core@todo.todo">core</maintainer>

  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->
  </export>
</package>
  1. 使用catkin_make install 就可以进行程序的发布。
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。