Open osrf-migration opened 8 years ago
Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).
That might not be the most intuitive behaviour, but that's how the <include>
tag works. It expands the links and plugins of the included model into the parent model, and then the "inclusion" gets lost.
A workaround would be to place the include tags inside model tags. You'll still lose the includes, but when the links are expanded, they're kept inside nested models. I checked here that a simple example keeps the plugins in place. Instead of directly including inside the parent model:
<?xml version='1.0'?>
<sdf version="1.6">
<model name="nested_plugins">
<include>
<name>A</name>
<uri>model://submarine_buoyant</uri>
</include>
<include>
<name>B</name>
<uri>model://submarine_buoyant</uri>
<pose>0 -0.01 0.070 1.57 0 1.57</pose>
</include>
</model>
</sdf>
Wrap the includes in model tags:
<?xml version='1.0'?>
<sdf version="1.6">
<model name="nested_plugins">
<model name="A">
<include>
<name>A</name>
<uri>model://submarine_buoyant</uri>
</include>
</model>
<model name="B">
<include>
<name>B</name>
<uri>model://submarine_buoyant</uri>
<pose>0 -0.01 0.070 1.57 0 1.57</pose>
</include>
</model>
</model>
</sdf>
Yes, it looks like the plugin namespaces for included models are not being properly handled. It sounds related to issue #734, although that looks more like a feature request to override plugin parameters. I would consider the bad namespace handling a bug.
With the nested models approach above, entity names still get scoped, but plugin parameters seem to be kept intact. I don't think there's a way to revert it now. You could try using nested models without the include tags so you have full control of all names.
Original report (archived issue) by Kunal Tyagi (Bitbucket: kunaltyagi).
I created a plugin P in models A and B, with models A and B included in model C. The plugin has some customizable parameters and a
link
tag. Also, on editing the model in Gazebo model editor and saving it back. In the new sdf file,<include><uri>...</uri></include>
. Is this the expected behavior?<name>base</name>
to<name>model_c::base</name>
. Can this be optionally prevented? (conversion of some link specified as parameter to relative address)