Skip to content

Validator for a group of parametersΒ #301

@ethanmusser

Description

@ethanmusser

Feature request for a method to validate a group of parameters.

Rationale

Sometimes valid values for one parameter might depend on the value assigned to another parameter. It would be useful to be able to validate these together.

For example, see this coupled set of parameters for a stereo camera. The parameters.yaml for this camera might look like the following.

stereo_camera:
  sensor_resolution:
    type: int_array
    description: "Operating resolution for the stereo camera stored as [width, height, disparity]"
    validation:
      fixed_size<>: [3]
      lower_element_bounds<>: [0]

  framerate:
    type: int
    default_value: 10
    description: "The number of image frames per second the camera will send"
    validation:
      bounds<>: [1, 30]

There is no mechanism for enforcing that the framerate be below 15-FPS when operating at full resolution.

Workarounds

Currently this behavior can be implemented with a custom validator on an array, but this requires that all of the values have the same type.

E.g., the above example could be rewritten as follows with a custom validator.

stereo_camera:
  sensor_config:
    type: int_array
    description: "Operating resolution and framerate for the stereo camera stored as [width, height, disparity, framerate]"
    validation:
      fixed_size<>: [4]
      lower_element_bounds<>: [0]
      "custom_validators::validate_stereo_camera_config": null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions