Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Get the name of a sub-parameter, not the whole structure

I have a YAML file with a structure like the following:

field_a:
   field_a1: {field_b1, field_b2, ..., field_bM}
   field_a2: {field_b1, field_b2, ..., field_bM}
   ...
   field_aN: {field_b1, field_b2, ..., field_bM}

where field_a and field_bj are known a priori for all j, but field_ai are frequently changed by the user (i.e. can't be hard coded).

If I try to retieve the parameters field_ai using the C++ method getParam(...) or the command line rosparam get /field_a, what I get is everything in the tree hierarchy where /field_a is the root.

Is there a way to retrieve only the names of these field_ai and not their values? I could create another list with those names, but it not scale very well...

Thank you for your help!