需要特别说明:ROS版本必须与Ubuntu系统版本匹配
实验环境:
ROS Fuerte
Ubuntu 12.04
ROS软件框架附带了大量功能强大的工具,包括调试工具、数据可视化工具、系统监测组件。ROS提供了一系列通用绘图工具,其中有针对标量值的时序绘图工具、支持双目立体视觉的图像展示工具、rviz等3D可视化工具(能够呈现点云、激光扫描等3D数据)。
1 调试ROS节点
(1)使用GDB调试器调试ROS节点
在ROS系统中允许使用GDB调试器对常规的C/C++程序进行调试。这里我们展示如何在GDB中运行 chapter3_tutorials 功能包中的example1节点。
创建 chapter3_tutorials功能包,并新建编译example1节点,example1.cpp中的代码如下:
#include "ros/ros.h"
int main( int argc, char **argv )
{
ros::init( argc, argv, "example1" );
ros::NodeHandle n;
const double val = 3.14;
ROS_DEBUG( "This is a simple DEBUG message!" );
ROS_DEBUG( "This is a DEBUG message with an argument: %f", val );
ROS_DEBUG_STREAM(
"This is DEBUG stream message with an argument: " << val
);
ros::spinOnce();
return EXIT_SUCCESS;
}
进入功能包路径:
$ roscd davebobo_tutorials/
然后,在GDB里面运行以下命令:
$ gdb bin/example1