Skip to content

[Feature]: Add annotation-based YAML parser for CoP and AdvCP configs #151

Description

@Haralishev77

Problem or motivation

CoP and AdvCP YAML configs are currently parsed manually in several places using dict.get(...), local default merging, and ad-hoc validation helpers. This spreads schema knowledge across managers, visualizers, metrics, and attack helpers.

As configs grow, this makes it easier to miss invalid YAML, duplicate parsing logic, or produce unclear errors when a nested key is malformed.

Proposed solution

Add a reusable annotation-based YAML parser that loads YAML mappings into typed Python config objects, likely dataclasses, using Python type annotations as the schema source.

The parser should support:

  • Nested typed config objects.
  • Defaults and optional fields.
  • Basic scalar coercion / validation for int, float, bool, str.
  • Lists, tuples, and mappings where needed.
  • Clear validation errors with full config paths, e.g. coperception.visualization.bbox_colors.pred.

Initial migration targets:

  • coperception.visualization
  • coperception.metrics.metric_configs
  • AdvCP attack config, including mode, attacker ids, density, spoofing/removal parameters, and boxes.

Area

Cooperative perception

Metadata

Metadata

Assignees

No one assigned

    Labels

    AdvCPCoPSomething new in cooperative perception categoryenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions