Learn Robotics
Module: Build And Share

Configuration and Launch

How to configure robot software with YAML/TOML files, launch multiple nodes at once, and manage environment-specific settings.

10 min read

Configuration and Launch

Your camera driver works perfectly — with a hardcoded resolution of 640×480, frame rate of 30fps, and exposure set to auto. But what if someone wants 1920×1080 at 60fps? Or a different camera model with different parameters?

Hardcoding configuration is brittle. Configuration files and launch systems make robot software adaptable and reusable.

Why Configuration Files?

Configuration files separate what your code does from how it's configured. This means:

  • No recompilation — change camera resolution without rebuilding
  • Environment-specific configs — different settings for sim vs. real robot
  • Reusability — same code, different robots
  • Version control — config changes are tracked like code changes
Camera configuration (YAML)

Your code loads this at runtime:

Loading configuration
Warning

Always validate configuration! Use schema validation libraries (like jsonschema for Python, serde for Rust) to catch typos and invalid values early. A config file with frame_rate: "sixty" (string instead of int) should fail immediately, not crash your robot later.

YAML vs. TOML vs. JSON

Different robotics ecosystems prefer different formats:

FormatSyntaxProsConsUsed In
YAMLIndentation-basedHuman-friendly, conciseWhitespace-sensitive, ambiguous syntaxMany robotics frameworks
TOMLINI-likeClear, explicitMore verboseRust ecosystem
JSONJavaScript-likeStrict, universalNo comments, verboseWeb APIs, URDF alternatives

YAML example:

robot:
  name: "mybot"
  wheels: 4

TOML example:

[robot]
name = "mybot"
wheels = 4

JSON example:

{
  "robot": {
    "name": "mybot",
    "wheels": 4
  }
}

For robotics, YAML is the most common format. TOML is gaining traction in Rust-based systems (it's Cargo's native format).

Launch Systems

Real robots run dozens of nodes at once: camera drivers, sensor processors, planners, controllers, visualizers. Starting each manually is tedious and error-prone.

Launch systems orchestrate multiple nodes with a single command.

Launch file (XML format)

This single file:

  • Starts three nodes
  • Loads the camera config file
  • Remaps topics so detector subscribes to camera
  • Passes parameters to each node

Run it with a single command:

launch my_package camera_system.launch.xml
Tip

Use launch files for reproducibility. Instead of "start these five nodes in this order with these flags," you have a single versioned file. New team members can run your entire system with one command.

Environment-Specific Configurations

You often need different configs for different environments:

Multiple config files

Your launch file selects the right one:

Environment-based launch (Python)

Run with:

launch my_package camera.launch.py env:=sim   # Use sim.yaml
launch my_package camera.launch.py env:=real  # Use real.yaml

What's Next?

You've packaged your code and made it configurable. But how do you know it actually works? How do you prevent bugs from creeping in as you add features? In the next lesson, we'll explore testing robot software — from unit tests to full system simulations.

Got questions? Join the community

Discuss this lesson, get help, and connect with other learners on Discord.

Join Discord

Discussion

Sign in to join the discussion.