Initialize a Config

Include the config header.

#include "miru/config/config.hpp"

Retrieve the concrete config from a file on the local filesystem.

auto config = miru::config::Config::from_file(
    "local/filesystem/path/to/config/schema.yaml",
    "local/filesystem/path/to/concrete/config.yaml"
);

Get a Parameter

To retrieve a parameter within a config, simply specify the parameter’s path.

A parameter’s path is a dot-separated list of keys starting with the config slug. Say we have the following config schema and concrete config.

...
joint-1:
  ...
  position:
    x: 1.0
    ...

The parameter’s path is motion-control.joint-1.position.x, which follows the format <config-slug>.<concrete-config-path>.

The default method for retrieving a parameter is the get_param function. However, if you’re coming from ROS2, you may prefer the get_parameter function from the ROS2 config wrapper.

#include "miru/query/query.hpp"

...

auto param = miru::config::query::get_param(
    // the config instantiated as shown above
    config,
    // "<config-slug>.<concrete-config-path>"
    "motion-control.joint-1.position.x"
);

// instantiate the parameter's value with it's appropriate type
float x = param.get<float>();