Gazebo | Ignition | Community
Ask Your Question

Find link among multiple includes in a plugin

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

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'>
      <pose>0 0 0 0 0 0</pose>
      <pose>1 0 0 0 0 0</pose>

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

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

chapulina gravatar image

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


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 -0500 )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 -0500 )edit

Question Tools

1 follower


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

Seen: 296 times

Last updated: May 16 '18