Open srmainwaring opened 3 years ago
This PR adds support for SDF plugins that contain repeated elements (#139)
Repeated elements are specified by assigning a list to a tag in a dictionary of plugin arguments. For example running the code:
from pcg_gazebo.parsers.sdf import create_sdf_element from pcg_gazebo.parsers.sdf import Plugin plugin_args = dict( control=list([ dict( attributes=dict( channel="0" ), value=dict( jointName='steer_joint', useForce=1 ) ), dict( attributes=dict( channel="2" ), value=dict( jointName='motor_joint', useForce=1 ) ) ]) ) plugin = create_sdf_element('plugin') plugin.name = 'plugin' plugin.filename = 'libPlugin.so' plugin.value = plugin_args print(plugin)
ouputs
<plugin name="plugin" filename="libPlugin.so"> <control channel="0"> <jointName>steer_joint</jointName> <useForce>1</useForce> </control> <control channel="2"> <jointName>motor_joint</jointName> <useForce>1</useForce> </control> </plugin>
Lists of numbers and strings continue to work as before:
plugin_args = dict( xyz=[1.0, 2.0, 3.0], rpy=[0.1, 0.2, 0.3], ) plugin = create_sdf_element('plugin') plugin.name = 'plugin' plugin.filename = 'libPlugin.so' plugin.from_dict(plugin_args) print(plugin)
<plugin name="plugin" filename="libPlugin.so"> <xyz>1.0 2.0 3.0</xyz> <rpy>0.1 0.2 0.3</rpy> </plugin>
This PR adds support for SDF plugins that contain repeated elements (#139)
Repeated elements are specified by assigning a list to a tag in a dictionary of plugin arguments. For example running the code:
ouputs
Lists of numbers and strings continue to work as before: