단일 노드를 하나씩 실행하기엔 불편하다.
이럴 때, .launch 파일을 통해 한번에 여러 노드를 실행하도록 만들 수 있다.
또는, 각 노드별로 필요한 parameter를 넣어줄 수도 있다.
launch 폴더를 만들고, 그 안에 start_node.launch 파일을 만든다.
아래와 같이 작성한다.
<launch> <node name="talker_node" pkg="beginner_tutorials type="talker.py"/> <node name="listener_node" pkg="beginner_tutorials type="listener.py"/> </launch>
변경 사항을 source 한 후
$ cd ~/catkin_ws ~/catkin_ws$ source devel/setup.bash
launch 파일 실행
~/catkin_ws$ roslaunch beginner_tutorials start_node.launch
rqt_graph를 통해 노드 간 통신을 시각화할 수 있다.
$ rqt_graph
