ROS学习手记 - 2 Create and Build ROS Package 生成包(C++)

本文档详细介绍了如何在ROS中创建、定制、构建和使用C++包。从建立工作区到编辑CMakeLists.txt和package.xml,再到使用catkin_make构建包,每个步骤都有清晰的说明,并提供了相关链接以供深入学习。
摘要由CSDN通过智能技术生成

For ROS experienced user, You can just skip to the Constuction about ROS Package usage:

For Quick Reference(C++): http://blog.csdn.net/sonictl/article/details/46764855#t5

For Quick Reference(Python): http://blog.csdn.net/sonictl/article/details/46764855#t15

=== 在上一篇的基础上,Create并Customize了Package之后,要Build Package ===

来源:http://wiki.ros.org/ROS/Tutorials/BuildingPackages

  1. 确认source有没有完成 (版本: hydro):

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

   2. Using catkin_make

      使用方法:

   # In a catkin workspace
   $ catkin_make [make_targets] [-DCMAKE_VARIABLES=...]
     这里catkin_make使用了CMake 的workflow来操作,科普一下这个workflow:

    

   3. 如何写ROS的Publisher and Subscriber(C++)

       因为要涉及到对CMakeLists.txt的写法,需要先了解这个文章:http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
       具体关于CMakeLists.txt文件,请看http://wiki.ros.org/catkin/CMakeLists.txt

    4. 关于workspace下的build devel src文件夹

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

    5. Build the package

       catkin_make命令执行情况如下:

exbot@ubuntu:~/catkin_ws$ ls
build  devel  src
exbot@ubuntu:~/catkin_ws$ catkin_make
Base path: /home/exbot/catkin_ws
Source space: /home/exbot/catkin_ws/src
Build space: /home/exbot/catkin_ws/build
Devel space: /home/exbot/catkin_ws/devel
Install space: /home/exbot/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/exbot/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/exbot/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/hydro
-- This workspace overlays: /opt/ros/hydro
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Python version: 2.7
-- Using Debian Python package layout
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/exbot/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- catkin 0.5.86
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 7 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~  - exbotxi_bringup
-- ~~  - exbotxi_description
-- ~~  - exbotxi_example
-- ~~  - exbotxi_nav
-- ~~  - exbotxi_rviz
-- ~~  - exbotxi_teleop
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ++
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值