Robotics StackExchange | Archived questions

Find link among multiple includes in a plugin

Hi I have an sdf where I include the same model multiple times:

<?xml version='1.0'?>
<sdf version='1.6'>
  <model name='big_as_robot'>
    <include>
      <name>arm_1</name>
      <uri>model://some_component</uri>
      <pose>0 0 0 0 0 0</pose>
    </include>
    <include>
      <name>arm_2</name>
      <uri>model://some_component</uri>
      <pose>1 0 0 0 0 0</pose>
    </include>
  </model>
</sdf> 

Now each of these includes loads a modelplugin. The plugin then needs to find a certain link inside the include it is part of itself. However, I have no way of knowing what the name of the include is. All I can get is a list of all links in the model, but can't figure out which one belongs to the plugin. And trying to access model->GetName() yields the name of the parent model ("bigasrobot"). So I'm looking for a way to make the plugin in "arm2" say that it's part of "arm_2". Any help appreciated!

Asked by Frederik Siepe on 2018-05-16 07:26:26 UTC

Comments

Answers

The <include> tag breaks the child models into links, so in the end you have one model (big_as_robot) with 2 plugins, and both plugins will return the same for _model->GetName().

One solution would be to move those includes out of a <model> tag.

Asked by chapulina on 2018-05-16 11:44:55 UTC

Comments

Ok thanks for the explanation! But if I do this I can't connect links in between the different models anymore.

Asked by Frederik Siepe on 2018-05-17 03:17:51 UTC

oh I see. I think you can, just you have to put your joint under the <world>. But if you need to connect different models, it might be wroth it rethinking your whole structure, because that's not a common use case.

Asked by chapulina on 2018-05-17 12:44:18 UTC