The problem launch files solve
By Lesson 5 you were juggling terminals: one for the publisher, one for the listener, one for the service, one for rqt_graph. A real robot might have twenty nodes. Opening twenty terminals is absurd — and you'd have to remember every parameter for every node.
A launch file describes a whole system — which nodes to start, with which parameters — so you can bring it all up with a single command.
Write a launch file
Launch files in ROS 2 are usually written in Python and live in a launch/ folder inside your package. Create ~/ros2_ws/src/my_robot/launch/system.launch.py:
~/ros2_ws/src/my_robot/launch/system.launch.py
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
# start the publisher from Lesson 4
Node(
package='my_robot',
executable='status_publisher',
name='status_publisher',
),
# start the listener from Lesson 4
Node(
package='my_robot',
executable='status_listener',
name='status_listener',
),
# start the config node with a custom parameter
Node(
package='my_robot',
executable='speed_config',
name='speed_config',
parameters=[{'max_speed': 2.5}],
),
])
Tell the build system to install the launch folder. In setup.py, add it to data_files:
~/ros2_ws/src/my_robot/setup.py (excerpt)
import os
from glob import glob
# ...
data_files=[
('share/ament_index/resource_index/packages',
['resource/my_robot']),
('share/my_robot', ['package.xml']),
# install every launch file
(os.path.join('share', 'my_robot', 'launch'),
glob('launch/*.launch.py')),
],
Launch the whole system with one command
cd ~/ros2_ws
colcon build
source install/setup.bash
ros2 launch my_robot system.launch.py
All three nodes start together in one terminal. Open another and run ros2 node list — you'll see all three alive. That's the entire workflow of a professional ROS 2 developer, in miniature.
Put the whole course together into one small system:
- Write a
sensornode that publishes a fake temperature (a random number 20–40) to a/temperaturetopic once per second. - Write a
monitornode that subscribes to/temperatureand logsOVERHEAT!whenever the value crosses athresholdparameter (default 35). - Write a launch file that starts both, setting the threshold to 30.
- Use
rqt_graphto confirm/sensor → /temperature → /monitor.
Every piece uses only what you learned in Lessons 2–6. When it runs, you've built a complete little robot subsystem from scratch.
Where to go next
You now have the foundation the rest of robotics is built on. Here's the natural path forward, roughly in order:
- Actions — the third communication style, for long-running, cancelable goals with progress feedback (e.g. "navigate to a point"). You met the concept in Lesson 1.
- Custom interfaces — define your own message and service types with
.msgand.srvfiles. - TF2 — track how every part of a robot (wheels, arm, camera) is positioned relative to the others over time.
- URDF & RViz — describe a robot's body in XML and visualize it in 3D.
- Simulation with Gazebo — run a full physics-simulated robot with no hardware.
- Nav2 — the ROS 2 navigation stack that drives mobile robots around a map. This is where the pieces you learned combine into real autonomy.
The official ROS 2 documentation and tutorials at docs.ros.org are excellent and free. The ROS community forums (discourse.ros.org) and Robotics Stack Exchange are where practitioners help each other. Voyager Lab publishes more free robotics lessons on our channels — check the Free Resources page.
You did it
You started not knowing what ROS 2 was. Now you can install it, run and inspect nodes, write publishers and subscribers, offer and call services, configure nodes with parameters, and launch a whole system at once. That is a genuine, employable foundation in modern robotics software — and you got there for free.