YAML

YAML (YAML Ain’t Markup Language) is a human-readable data serialization language. In the Clover2, it is used to describe ArUco marker maps, camera configs, and system parameters.

Basic Syntax Rules

  • Key-value pairs: key: value (a space must always follow the colon)

  • Comments: # — everything following the # on a line is ignored

      name: test          # this is an inline comment
      # this is a standalone comment line
    

YAML does not support block comments (/* */). You can place a comment at the end of a line or on a standalone line.

  • Indentation: Use spaces for indentation (2 or 4). Do not use tabs.

  • Strings: You cany write strings without quotes. If a value contains special characters or could be interpreted as another YAML data type, use double " " or single ' ' quotes.

  • Numbers: Write integers and decimal numbers without quotes: 42, 3.14, -1.5, 1e-3

  • Booleans: true / false, yes / no, on / off

  • Null values: ~, null, or an empty field

  • Lists (block style): Each list item starts with - (dash + space):

    markers:
      - id: 0
      - id: 1
    
  • Lists (inline style): You can write list items in square brackets separated by commas:

    markers: [{id: 0, size: 0.3}, {id: 1, size: 0.3}]
    # or
    markers: [0, 1, 2, 3]
    
  • List of dictionaries (explicit block style):

    markers:
      - {id: 0, size: 0.3, x: 1.0, y: 2.0}
      - {id: 1, size: 0.3, x: 3.0, y: 4.0}
    

Here markers contains two dictionaries. Each dictionary describes one marker and contains its id, size, x, and y.

  • Multiline keyless arrays:

    ids:
      - 10
      - 20
      - 30
    
  • Dictionaries (nested): Indentation defines nesting levels:

    pose:
      x: 1.0
      y: 2.0
    
  • Dictionaries (inline style): Several key-value pairs can be written in curly braces separated by commas:

    pose: {x: 1.0, y: 2.0, z: 0.5}
    

Note

Indentation must be consistent. If the first level uses 2 spaces, all subsequent levels must use 2 spaces. Indentation determines the structure of the YAML file. Incorrect indentation can cause a parsing error.