How to access an element attribute value in C++ plugin?
I have this kind of structure inside my world plugin:
<sdf version='1.6'>
<world name='default>
<plugin name="MyPlugin" filename="libMyPlugin.so">
<my_box name="box1">
<pose>0 0 2 0 0 0</pose>
<geometry>
<box>
<size>5 5 4</size>
</box>
</geometry>
</my_box>
<my_box name="box2">
<pose>10 5 2 0 0 0</pose>
<geometry>
<box>
<size>5 5 4</size>
</box>
</geometry>
</my_box>
</plugin>
</world>
</sdf>
In my world plugin I want to access both <my_box> elements and extract the positions and sizes.
I can get the first <my_box> element by
auto my_box_sdf = _sdf->GetElement("my_box");
I can check if it has a attribute 'name' by
my_box_sdf.GetAttributeSet("name");
But I don't know how to get the value of this attribute. I tried all the functions from here that seemed as if they could return the value, but nothing worked. How do I access the attribute value?
How do I get the other <my_box> element?