构建一个ROS包

1、创建packages

        前面所有的依赖都安装好了之后,就可以看是构建包了。

        在此之前要记得初始话环境

#source /opt/ros/YOUR_ROS_DISTRO/setup.sh

1.1、using catkin_make

        catkin_make是一个命令行工具,为标准的catkin工作流曾增加了一些便利,catkin_make结合了标准CMake中对cmake和make的调用。

#catkin_make [make_targets]  在你的工作空间中 

这个过程是为每个CMake项目运行的,相比之下,catkin项目可以在工作区中一起构建。

其他一些catkin_make更高级的用法,就要去参考catkin——make手册了,这里不做过多的赘述。

1.2、创建自己的包

        在前面的学习中,已经创建了workspace,没创建的hxd课一去前面在看看。

浏览src文件夹,你应该可以看到

beginner_tutorials/  CMakeLists.txt@
$ catkin_make

你应该可以看不到

Base path: /home/user/catkin_ws
Source space: /home/user/catkin_ws/src
Build space: /home/user/catkin_ws/build
Devel space: /home/user/catkin_ws/devel
Install space: /home/user/catkin_ws/install
####
#### Running command: "cmake /home/user/catkin_ws/src
-DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel
-DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install" in "/home/user/catkin_ws/build"
####
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is Clang 4.0.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CATKIN_DEVEL_PREFIX: /tmp/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.1") 
-- Found PY_em: /usr/lib/python2.7/dist-packages/em.pyc
-- Found gtest: gtests will be built
-- catkin 0.5.51
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ add_subdirectory(beginner_tutorials)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/catkin_ws/build
####
#### Running command: "make -j4" in "/home/user/catkin_ws/build"
####
这些东西

这里需要注意的是,catkin_make首行显示他在每个空间中使用的路径。这些空间在REP128和wiki上关于工作空间的文档都有描述catkin/workespace。

build文件夹是构建空间的默认位置,是调用cmake和make来配置和构建你的软件包的地方,在你安装软件包之前,他是你可执行文件和库的位置。

至此,完成

你可能感兴趣的:(ros学习,自动驾驶,人工智能,机器学习)