generate_parameter_library icon indicating copy to clipboard operation
generate_parameter_library copied to clipboard

Validator for a group of parameters

Open ethanmusser opened this issue 1 month ago • 0 comments

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

ethanmusser avatar Dec 19 '25 20:12 ethanmusser