1、在编译中打开debug模式, ROS代码
catkin_make -DCMAKE_BUILD_TYPE=Debug
2、以gdb方式运行程序
rosrun --prefix 'gdb -ex run --args' package_name node_name