输出日志信息
ROS_INFO("this is ROS_INFO")
ROS_INFO("this is ROS_INFO with param %d", val)
ROS_INFO_STREAM("this is ROS_INFO in c++ format with param %d", val)
日志信息的级别
DEBUG (只有Debug时才能有效)
INFO
WARN
ERROR
FATAL
配置调试信息的级别
- 为特定的节点配置
在节点的代码中定义ROSCONSOLE_MIN_SEVERITY宏为下列其一:
ROSCONSOLE_SEVERITY_DEBUG
ROSCONSOLE_SEVERITY_INFO
ROSCONSOLE_SEVERITY_WARN
ROSCONSOLE_SEVERITY_ERROR
ROSCONSOLE_SEVERITY_FATAL
ROSCONSOLE_SEVERITY_NONE
实际测试过程中这种方式没有效果,遗留问题后续补充
- 为整个的包配置
在CMakelists.txt中配置,在编译的过程中确定,但是修改需要重新编译;
在config文件中配置,在运行前修改即可,推荐采用这种方式;
测试 chapter3 example_1
https://github.com/helloworldzlg/learning_ros/tree/master/src/chapter3