ROS2 Robust YAML Launch Parameter Validator

Medium Configuration 0% pass rate

Practice the ROS2 Robust YAML Launch Parameter Validator coding problem in Configuration. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.

Problem Statement

Validate ROS2 launch configuration files before starting the robot. Misconfiguration is one of the most common causes of robot hardware damage — catching errors at config load time prevents crashes at runtime.

Requirements

Implement the function validate_launch_yaml(yaml_text, schema):

  • Input: yaml_text (str) — raw YAML content; schema (dict) — validation rules
  • Output: list of error strings — empty [] if valid, non-empty if invalid

Schema format

schema = {
    'launch': {'type': 'list', 'required': True},
    'version': {'type': 'float', 'required': False},
}

Validation rules your function must enforce

  1. Parse the YAML safely (handle malformed YAML)
  2. For each key in schema where required=True: fail if the key is missing
  3. For each key that exists: fail if the value's type doesn't match type in schema
  4. Return a descriptive error string for each violation

Example

validate_launch_yaml("launch: [1, 2]\nversion: 0.1", schema)
# Returns: []  ← valid

validate_launch_yaml("version: 0.1", schema)
# Returns: ["Missing required key: 'launch'"]  ← launch is missing

validate_launch_yaml("launch: \"not a list\"", schema)
# Returns: ["'launch' should be type list, got str"]  ← wrong type

⚠️ Common Pitfalls

  • Using yaml.load() without Loader=yaml.SafeLoader — always use yaml.safe_load()
  • Returning None instead of an empty list for valid YAML
  • Not handling yaml.YAMLError for malformed input

📚 Helpful Resources

Frequently asked questions

What is the ROS2 Robust YAML Launch Parameter Validator practice problem?

It is a hands-on Configuration challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.

How do I practice ROS2 Robust YAML Launch Parameter Validator online?

Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.

What skills does ROS2 Robust YAML Launch Parameter Validator test?

This Medium problem focuses on Configuration skills used in robotics interviews and production systems.