launch文件一次性可启动多个ROS节点。
实现如下:
- 选定功能包右击 —> 添加launch文件夹
- 选定launch文件夹右击 —> 添加launch文件,如
turtle.launch
- 编辑launch文件内容后保存,如
<launch>
<node pkg="helloworld" type="demo_hello" name="hello" output="screen" />
<node pkg="turtlesim" type="turtlesim_node" name="t1"/>
<node pkg="turtlesim" type="turtle_teleop_key" name="key1" />
</launch>
- node ---> 包含的某个节点
- pkg -----> 功能包
- type ----> 被运行的节点文件
- name --> 为节点命名
- output-> 设置日志的输出目标
- 终端运行launch文件
cd xxx_ws
roslaunch 功能包名 launch文件名