参考:The build system "ament_cmake" and the meta build tool "ament_tools"
2018-06 里面的cmakelists例子有点过时了
原因:
ROS2 设计包含有多个模块(多个package),编译会比较复杂,
确定编译顺序,依赖关联,设置环境变量...
依赖:通用的工具Cmake 和Python setuptools
ament_tools被. Since ros2/ros2#486 ROS 2 uses colcon as the build tool.
to read:colcon - collective construction — colcon documentation
前身: ROS1: Catkin, RO2: Ament
cpp:需要有cmakelists
python: src/目录下的 setup.py
The ament tool will copy the package manifest into the install location. It will also extend the environment variables
PYTHONPATH
andPATH
to include the Python modules and executables provided by the package.通过 ~/.bashrc查看
Depending on where the packages are being installed it might be necessary to setup the environment in order to find all resources. E.g. the location of installed executables should be on the
PATH
, installed Python code should be on thePYTHONPATH
etc.
colcon bulid后,install 目录下有一个 setup.bash, 还有local_setup.bash
source install/setup.bash
The
local_setup.*
files will update environment variables as specified by the package. Even when the package is built without the ament tool these setup files are being generated.更新环境变量,这样,你运行代码时,才能找到对应的包,需要的环境变量。
目前支持: 串行编译,并行编译 在将来会支持
Ament 安装你的package:
涉及到,把文件从/src 拷贝到 安装路径(通常设置 install/下)
还有一种方式: to try:
Optional symlinked install
It is very important to maximize the efficiency of the development cycle of changing code, building, and installing it and then run it to confirm the changes. Commonly the installation steps involve copying some resources from the source space to their final destination in the install location. ament provides an option to use symbolic links instead (if the platform supports that). This enables the developer to change the resources in the source space and skipping the installation step in many situations.
For CMake packages this is achieved by optionally overriding the CMake
install()
function. For Python packages the development mode is used to install the package. The symlinked install is an optional feature and must be enabled explicitly by the developer using the command line option--symlink-install
.
编译错误检测:可以集成:Cppcheck - A tool for static C/C++ code analysis