ROS Tutorial 1 基本概念

ROS Environment Variables

1. 环境变量的作用

定位Packages(ROS_ROOT 和 ROS_PACKAGE_PATH)

影响节点运行:ROS_MASTER_URI告诉节点master在哪里,ROS_IP and ROS_HOSTNAME影响节点的网络地址,ROS_NAMESPACE可以改变namespace

修改build system(程序建立系统):决定了在哪里找到库,它们是怎么build的,哪一个已经被built了(ROS_BINDEPS_PATH, ROS_BOOST_ROOT, ROS_PARALLEL_JOBS, and ROS_LANG_DISABLE)

2.Build System

A build system is responsible for generating 'targets' from raw source code that can be used by an end user. These targets may be in the form of libraries, executable programs, generated scripts, exported interfaces (e.g. C++ header files) or anything else that is not static code. In ROS terminology, source code is organized into 'packages' where each package typically consists of one or more targets when built.

Build System 负责让用户可以使用的由原始源代码生成“目标”。这些目标可以是库、可执行程序、生成脚本、导出接口(例如C++头文件)或任何非静态代码的任何形式。在ROS术语中,源代码被组织成“包”,其中每个包通常在构建时由一个或多个目标组成。

此外,几乎所有的集成开发环境(IDE),如Qt Creator、微软VisualStudio和Eclipse都为它们各自支持的语言添加了自己的构建系统配置工具。通常,这些IDE中的构建系统只是基于控制台的构建系统(如GNU Make, GNU Autotools, CMake, and Apache Ant )的前端。

为了build目标,build system 需要很多build 信息 (诸如工具链组件(例如C++编译器)的位置、源代码位置、代码依赖、外部依赖项、这些依赖项位于哪里、应该build哪些目标、被build到哪里、以及在哪里应该安装)。这些信息通常表示在构建系统读取的一些配置文件中。在IDE,通常将此信息存储为工作空间/项目元信息(例如VisualC++项目文件)的一部分。Build system利用这些信息在以适当的命令处理源代码以生成目标

3. GNU

GNU is an operating system that is free software—that is, it respects users' freedom. The GNU operating system consists of GNU packages (programs specifically released by the GNU Project) as well as free software released by third parties. The development of GNU made it possible to use a computer without software that would trample your freedom.

GNU是一个自由软件的操作系统。也就是说,它尊重用户的自由。GNU操作系统由GNU软件包(由GNU项目特别发布的程序)和第三方发布的自由软件组成。GNU的发展使得不用依靠限制自由的软件就可以使用计算机成为可能。

4. Cmake

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.

扫描二维码关注公众号,回复: 2555355 查看本文章

CMake 是一个开源的、跨平台,旨在构建、测试和打包软件的工具系列. (编译工具系统 Build system)

优点:用于使用简单的平台和编译器独立的配置文件来控制软件编译过程,并生成本机编译文件和工作区,可以在您选择的编译器环境中使用。

5. Catkin

Catkin is the official build system of ROS and the successor to the original ROS build system, rosbuild. catkin combines CMake macros and Python scripts to provide some functionality on top of CMake's normal workflow. catkin was designed to be more conventional than rosbuild, allowing for better distribution of packages, better cross-compiling support, and better portability. catkin's workflow is very similar to CMake's but adds support for automatic 'find package' infrastructure and building multiple, dependent projects at the same time

为甚需要Catkin?

ROS是一个非常松散的、互相有关联的包的大集合。这意味着许多依赖于彼此的独立软件包,利用各种编程语言、工具和代码组织约定。因此,某个包中的目标的构建过程可能与构建另一个目标的方式完全不同。Catkin专门尝试以一致的和常规的方式改进大量相关包的开发。换句话说,过去的Rosbuild和现在的Catkin旨在通过使用工具和约定来简化编译过程,从而更容易构建和运行ROS代码。没有ROS,高效地共享基于ROS的代码将更加困难。

6. Catkin Packages

  • Packages: Packages are the software organization unit of ROS code. Each package can contain libraries, executables, scripts, or other artifacts. ROS应用程序代码的最小载体。

  • Manifests (package.xml): A manifest is a description of a package. It serves to define dependencies between packages and to capture meta information about the package like version, maintainer, license, etc...

7.Catkin Workspaces

Catkin packages can be built as a standalone project, in the same way that normal cmake projects can be built, but catkin also provides the concept of workspaces, where you can build multiple, interdependent packages together all at once. A catkin workspace is a folder where you modify, build, and install catkin packages

Catkin可以提供一个workspaces的概念,以编译多个互相依赖的包。workspace就是一个文件夹,你可以编译、安装、修改其中的packages。

A catkin workspace can contain up to four different spaces which each serve a different role in the software development process.

workspaces包含四个部分。

http://wiki.ros.org/catkin/workspaces

6.1 Source Space

The source space contains the source code of catkin package. Each folder within the source space contains one or more catkin packages. This space should remain unchanged by configuring, building, or installing. The root of the source space contains a symbolic link to catkin's boiler-plate 'toplevel' CMakeLists.txt file. This file is invoked by CMake during the configuration of the catkin projects in the workspace.

6.2 Build Space

Build space is where cmake and make are called(调用) to configure and build your packages.CMake and catkin keep their cache information and other intermediate files here. The build space is where CMake is invoked to build the catkin packages in the source space.

6.3 Development (Devel) Space

Devel space is where your executables and libraries go before you install your packages.The development space (or devel space) is where built targets are placed prior to being installed. The way targets are organized in the devel space is the same as their layout when they are installed.

6.4 Install Space

Once targets are built, they can be installed into the install space by invoking the install target, usually with make install.

猜你喜欢

转载自blog.csdn.net/linyijiong/article/details/81388679