launch启动多个节点方便调试+《A Dummy Guide to Debugging ROS Systems》


(roslaunch takes in one or more xml configuration files that specity the parameters to set and nodes to launch)
<launch>
  <node name="odom_base" pkg="tf" type="static_transform_publisher" args="6.7756 -9.3089 0 0 0 -0.5139 0.8578 /odom /base_link 1"/>
  <node name="base_imu" pkg="tf" type="static_transform_publisher" args="0 0 0 0 0 0 1 /base_link /imu_link 1"/>
  <node name="base_laser" pkg="tf" type="static_transform_publisher" args="0.23 0 0.452 0 0 0 1 /base_link /laser_link 1"/>

  <node pkg="rosbag" type="play" name="player" args="--clock /home/hjh/rosbag/test_fusion1.bag"/>

  <include file="$(find lidar_localization)/launch/mapping.launch"/>

  <include file="$(find robot_pose_ekf)/robot_pose_ekf.launch" output="screen"/>

  <node name="showpath_node" pkg="showpath" type="showpath_node" />
  <node name="combinedOdom2Odom_node" pkg="showpath" type="combinedOdom2Odom_node" />
</launch>
 launch文件注释:
  写静态的tf时,type="static_transform_publisher"是为固定的。
  得到两个坐标系的命令:$rosrun tf tf_echo turtle1 turtle2
  或者在rviz中查看tf:$rosrun rviz rviz -d 'rospack find turtle_tf'/rviz/turtle_rviz.rviz  $rosrun tf tf_echo /world /turtle

调试ROS代码的一些方法

1,Grab your RQT ("rqt" is a Swiss Army knife)
rqt_grapher: can see which nodes are running , or if two nodes are connected correctly.
topic monitor: it display a list of all currently advertised topics . useful check that the correct information is traveling through you ROS network
2,The TF Tree
$rosrun rqt_tf_tree rqt_tf_tree
或$rosrun tf view_frames
3,Find yourself with RVIZ
4,Dig deeper with GDB and Valgrind
$catkin_make -DCMAKE_BUILD_TYPE=Debug
$gdb devel/lib/[ros_package_name]/[node_name]
$valgrind --leak-check=yes devel/lib/[ros_package_name]/[node_name]
(这里挖坑,两个网址,用的时候再看吧。。。:http://beej.us/guide/bggdb/ 和 https://www.valgrind.org/docs/manual/quick-start.html)


posted @ 2020-08-05 19:25  蒙牛特仑苏  阅读(208)  评论(0编辑  收藏  举报