declare nested parameter
How do I declare nested variables or lists of key value pairs in ROS2 dashing?
E.g for a yaml structure like
tag_lists:
base: 9
object: 14
tag_lists
is the known parameter name which contains a list of mappings from strings ("base", "object") to integers (9, 14).
I used to read these nested structures by:
static const std::string tag_list_prefix = "tag_lists";
auto parameters_and_prefixes = list_parameters({tag_list_prefix}, 10);
for (const std::string &name : parameters_and_prefixes.names) {
const int id = get_parameter(name).get_value<int>();
tracked_tags[id] = name.substr(tag_list_prefix.size()+1, name.size());
}
I.e. the parameter tag_lists
is a namespace with optional sub-parameters that are determined at runtime.
And how would I declare a parameter like:
tag_lists:
base:
id: 9
size: 0.1
object:
id: 14
size: 0.2
that maps from strings ("base", "object") to a list of known parameters ("id", "size")?