Nicholas Pfaff
Nicholas Pfaff

Reputation: 711

Specify background color in Scenario/ Camera Config yaml

I would like to use a scenario yaml file for defining my cameras. However, I'm getting RuntimeError: The fields ['_tag'] were unknown to the schema when trying to parse the CameraConfig portion of my scenario file.

I'm trying to achieve it with the following:

@dc.dataclass
class Scenario:
    cameras: typing.Mapping[str, CameraConfig] = dc.field(default_factory=dict)

scenario = yaml_load_typed(
        schema=Scenario, filename=..., defaults=Scenario()
    )

My yaml file looks something like this:

cameras:
  camera0:
    name: camera0
    background: !Rgba { rgba: [0, 0, 0, 1] }

The issue seems to be with the !Rgba not being recognized. However, this seems to be the correct class based on the CameraConfig class.

Note: The Drake Blender Example makes playing with this easy.

What am I doing wrong here?

Upvotes: 0

Views: 31

Answers (1)

Sean Curtis
Sean Curtis

Reputation: 1923

It requires a very special/bespoke spelling.

cameras:
  camera0:
    name: camera0
    background:
      rgba: [0, 0, 0, 1]

Upvotes: 1

Related Questions