代码中包名:test-packagle-name,文件名:test-file-name
cmake_minimum_required(VERSION 2.8.3) # CMake最低版本要求,低于2.8.3构建过程会被终止。
project(test-package-name)#定义工程名称
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
#找到catkin编译的宏命令和库文件,如果像find_package(catkin REQUIRED COMPONENTS xyz)一样的清单被使用的话,也能找到其他catkin编译的功能包
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)
## System dependencies are found with CMake's conventions
#系统依赖项也能随着CMake的规定被找到
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
#如果功能包里有一个setup.py,取消这些注释。这个宏可以确保模块和全局脚本声明在其中得到安装,参考http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and actions ##
################################################
#声明 ROS 的 messages, services 和 actions
#ervice 是同步的通信机制,a 和 b 间通过 sevice 机制通信,假设 a 是客户端访问 b 服务器端,a 远程调用 b 上的某个函数,
#a 程序得等 b 服务器响应后才能作其他的事情(运行其他程序),如果 b 服务器长期无响应,那么 a 啥也别做了,一直等下去吧,无法取消。
#显然效率低下,原因在于 service 时同步通信机制。ros 提供了另外一种通信机制 action,可以在远程调用服务器上某程序后,转而执行其他的程序,
#周期性的获得服务器上的信息,或者取消发送到服务器上的某远程调用,机制灵活,异步通信。
## To declare and build messages, services or actions from within this package, follow these steps:
##想要在功能包中声明和建立习messages, services和actions,就遵循以下步骤:
## * Let MSG_DEP_SET be the set of packages whose message types you use in your messages/services/actions (e.g. std_msgs, actionlib_msgs, .