现在假设一个场景,我想编写一个launch文件,使他能够一下子执行四行代码,分别是
roslaunch wpr_simulation wpb_stage_slam.launch
rosrun hector_mapping hector_mapping
rosrun rviz rviz
rosrun rqt_robot_steering rqt_robot_steering
根据launch文件的编写规范
我们可以开始编写launch文件
<launch>
<include file = "$(find wpr_simulation)/launch/wpb_stage_slam.launch"/>
<node pkg = "hector_mapping" type = "hector_mapping" name = "hector_mapping"/>
<node pkg = "rviz" type = "rviz" name = "rviz"/>
<node pkg = "rqt_robot_steering" type = "rqt_robot_steering" name = "rqt_robot_steering"/>
</launch>
编写好后,对工作空间进行编译,之后运行launch文件即可。
关于语法的说明:pkg代表软件包名,type代表具体要运行的节点名称,name代表名字,最好和节点名相同(无硬性要求)