YAML#
The Python bindings only exposed part of the public functionality described in the YAML cpp reference. In particular, you can load registered components and dump them to YAML.
load(value: str) -> object
Load a behavior modulation from a YAML string.
- Returns:
The loaded behavior or
None
if loading fails.- Return type:
Behavior| None
load(value: str) -> object
Load a modulation modulation from a YAML string.
- Returns:
The loaded modulation or
None
if loading fails.- Return type:
BehaviorModulation| None
load(value: str) -> object
Load a kinematics modulation from a YAML string.
- Returns:
The loaded kinematics or
None
if loading fails.- Return type:
Kinematics| None
Dumps the object to a YAML-string.
- Returns:
The YAML representation
- Return type:
Note
Functions load_<component>()
and methods <Component>.load()
are equivalent, like
for example navground.core.load_behavior()
and navground.core.Behavior.load()
.
Similar is valid for function navground.core.dump()
and methods <Component>.dump()
, such as navground.core.Behavior.dump()
.
Schema#
Moreover, we expose methods that return JSON Schema for all supported types (Class.schema
, Component.register_schema
), and a function that generate the bundle schema used for validation in validate.
Register a custom JSON-schema for a class
Use it as:
>>> class MyClass(Class, name=...): >>> >>> @schema.register >>> def modifier(schema: dict[str, typing.Any]) -> None: >>> ...
- Parameters:
modifier – A modifier
- Returns:
The registered static method
- Return type:
staticmethod
bundle_schema() -> object
Returns the bundle json-schema
- Returns:
json-schema
- Return type:
dict[str, typing.Any]