Initialize a Config Instance

Include the config instance header.

#include "miru/configs/instance.hpp"

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

auto config_instance = miru::config::ConfigInstance::from_file(
    "local/filesystem/path/to/config/schema.yaml",
    "local/filesystem/path/to/config/instance.yaml"
);

Get a Parameter

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

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

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

The parameter’s path is motion-control.joint-1.position.x, which follows the format <config-type-slug>.<config-instance-parameter-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 wrapper.

#include "miru/query/query.hpp"

...

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

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