gazebosim / gazebosim/sdformat
Pass parameter to plugin from parent model
- Dominant language
- C++
- Stars
- 216
- Forks
- 125
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 14
Description
**Original report ([archived issue](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/issues/205)) by Lorenzo Rapetti (Bitbucket: [lorrapetti](https://bitbucket.org/%7B163ad6dd-2725-4cbb-9d5f-7078d8891005%7D/)).**
----------------------------------------
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()](http://osrf-distributions.s3.amazonaws.com/sdformat/api/3.0/classsdf_1_1Element.html#a38fd0c101a51816d5ef5a9e179ae4525):
e.g.
**original model**
```xml
...
...
```
**overritten model**
```xml
...
model://myModel
```
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](https://github.com/osrf/sdformat/blob/a76ccb633a52bcf87b169f7dcbaeac3c4623d681/sdf/1.6/plugin.sdf#L10)), so at the moment the solution works only using a dummy plugin that doesn't do anything:
**overritten model**
```xml
...
model://myModel
```
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 https://github.com/robotology/gazebo-yarp-plugins/issues/392)
Contributor guide
Assessment
This issue has not been assessed yet.