🚀 Launch & Config Files
In the LIMO Pro + MyCobot + YOLO system, launch files and configuration files are critical for ensuring every node starts in the correct order, with the right parameters, and without conflicts.
This guide explains how to write, structure, and manage them.
📝 Writing Custom Launch Files
We use Python-based ROS2 launch files to control startup.
Example minimal launch file:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='my_package',
executable='my_node',
name='my_node',
output='screen',
parameters=[{'example_param': 'value'}]
)
])
⏱ Startup Sequencing with TimerAction
Our full_system.launch.py uses TimerAction so nodes launch only after dependencies are ready:
from launch.actions import TimerAction
TimerAction(period=2.0, actions=[nav2_node]), # Start Nav2 after 2s
TimerAction(period=3.0, actions=[pose_setter]), # Pose setter after Nav2
TimerAction(period=10.0, actions=[mission_manager]), # Mission Manager last
Why?
- Nav2 must load the map before
pose_setterruns. mission_managermust wait until localization and YOLO detection are ready.
⚙️ Configuration File Formats
We use YAML for parameters like nav2_params.yaml:
amcl:
ros__parameters:
min_particles: 500
max_particles: 2000
update_min_a: 0.2
update_min_d: 0.25
Tips:
- Use
ros__parametersroot key for ROS2. - Keep one YAML per node for clarity.
- Store in
config/inside the package.
🔄 Parameter Management
You can pass parameters in three ways:
- Inline in Launch
- From YAML
- From CLI
Node(
package="my_package",
executable="my_node",
parameters=[{'m5_ip': '192.168.137.75'}]
)
Node(
package="nav2_bringup",
executable="bringup_launch.py",
parameters=["config/nav2_params.yaml"]
)
ros2 run my_package my_node --ros-args -p m5_ip:=192.168.137.75
💡 Launch File Best Practices
Do This
- Use FindPackageShare so your launch files work from any workspace.
- Keep launch files modular — one per subsystem (YOLO, navigation, arm).
- Use
SetLaunchConfigurationfor values reused across nodes. - Log key events so the startup process is traceable.
Avoid
- Hardcoding absolute paths — always resolve relative to the package share.
- Starting all nodes at once — it causes race conditions.
- Embedding too much logic in launch files — keep them orchestration-only.
✅ Checklist Before Committing
- ☐ Launch file runs without errors.
- ☐ Config YAML loads correctly (no tab characters — YAML only allows spaces).
- ☐ Dependencies start in the right order.
- ☐ Works both from
ros2 launchand as part offull_system.launch.py.
📎 Related
Next: Parameter Tuning & Optimization