Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass parameter to plugin from parent model #205

Open
scpeters-test opened this issue Nov 5, 2018 · 1 comment
Open

Pass parameter to plugin from parent model #205

scpeters-test opened this issue Nov 5, 2018 · 1 comment

Comments

@scpeters-test
Copy link
Collaborator

Original report (archived issue) by Lorenzo Rapetti (Bitbucket: lorrapetti).


When using nested models, I have the necessity of changing the parameters of a plugin directly from the parent model SDF without changing the SDF of the model that is included (e.g. if I want multiple instances of the same model but with different parameters).

A possible solution is having a plugin that search for the configuration not only in the plugin SDF, but also looking a the parent model SDF using GetParent():
e.g.

original model

<model name="myModel">
  <plugin name="myPlugin" filename="myPlugin.so">
    <PluginConfiguration> ... </PluginConfiguration>
  </plugin>
  ...
</model>

overritten model

<model name="overritenModel">
  <configurationOverride plugin_name='myPlugin'> ... </configurationOverride>
  <include>
    <uri>model://myModel</uri>
  </include>
</model>

However, this is not feasible since it is not possible to add a custom SDF to a model.
A custom SDF can be add only in a (thanks to special class defined in plugin.sdf), so at the moment the solution works only using a dummy plugin that doesn't do anything:
overritten model

<model name="overritenModel">
  <plugin name='override_plugin' filename='dummy_plugin.so'>
    <configurationOverride plugin_name='myPlugin'> ... </configurationOverride>
  </plugin>
  <include>
    <uri>model://myModel</uri>
  </include>
</model>

It would be great to have a clean way to pass parameters to a plugin in a nested model. A good way might be having those parameters as element of the , and reading them from the plugin.

(original discussion in gazebo-yarp-plugin at robotology/gazebo-yarp-plugins#392)

@scpeters-test
Copy link
Collaborator Author

Original comment by Lorenzo Rapetti (Bitbucket: lorrapetti).


  • Edited issue description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants