Reading from yaml file in xacro?
Hi I am trying to read the parameters in a yaml file to my URDF using xacro. I understand that the values will be imported as a dictionary. I am able to retrieve the values when the yaml file has a single layer. For example if the yaml file is as follows:
val1: 0.45
val2: 0.5
then I can use the following commands in my xacro to get the parameters val1 and val2:
<xacro:property name="yaml_file" value="$(find package)/config/paramlist.yaml" />
<xacro:property name="dict" value="${load_yaml(yaml_file)}"/>
<xacro:property name="val1" value="${dict['val1']}" />
<xacro:property name="val2" value="${dict['val2']}" />
However I don't know how I can do the same when the yaml file has multiple 'layers' , for example:
Link1:
val1: 0.45
val2: 0.5
Link2:
val1: 0.23
val2: 0.33
I am new to ROS and to the dictionary format. How do I retrieve val1 and val2 for each Link in xacro? Thank you