Home | Tutorials | Wiki | Issues
Ask Your Question
0

Find link among multiple includes in a plugin

asked 2018-05-16 07:26:26 -0600

Frederik Siepe gravatar image

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 ("big_as_robot"). So I'm looking for a way to make the plugin in "arm_2" say that it's part of "arm_2". Any help appreciated!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-16 11:44:55 -0600

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.

edit flag offensive delete link more

Comments

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

Frederik Siepe gravatar imageFrederik Siepe ( 2018-05-17 03:17:51 -0600 )edit

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.

chapulina gravatar imagechapulina ( 2018-05-17 12:44:18 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-05-16 07:26:26 -0600

Seen: 135 times

Last updated: May 16