Home | Tutorials | Wiki | Issues
Ask Your Question

How do you add re-usable sub-models to a larger model

asked 2015-04-09 20:07:55 -0500

Cerin gravatar image

I'm trying to model a simple quadruped robot, and the legs contain four segments. Since the legs are identical, instead of duplicating the leg SDF inside the main model SDF file, is there some way I can model the leg once in a separate SDF file and "include" it four times in the SDF file for the "complete" robot?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-04-13 00:29:18 -0500

scpeters gravatar image

The <include> tag can be used as a child of world or as a child of model. It currently accepts 4 sub-tags: uri, name, pose, and static (used for specifying models as static). Ideally, there would be more options there, but that's all we have implemented so far.

edit flag offensive delete link more

answered 2015-04-09 20:17:38 -0500

chapulina gravatar image

Yes, there's a way, using the <include> tag as in this tutorial.

edit flag offensive delete link more


Thanks. I was almost about to say this didn't work, because the [docs](http://sdformat.org/spec?ver=1.5) don't mention <include> and therefore I didn't know how to name multiple inclusions of the same file, which is necessary or else Gazebo throws an error. However, [this question](http://answers.gazebosim.org/question/2764/passing-parameters-to-included-sdf/) mentioned how to use the <name> tag to solve this problem.

Cerin gravatar imageCerin ( 2015-04-11 22:28:25 -0500 )edit

Is there documentation for the all the tag that Gazebo uses? http://sdformat.org doesn't seem to cover everything.

Cerin gravatar imageCerin ( 2015-04-11 22:29:23 -0500 )edit

The main documentation is that on http://sdformat.org/spec. We encourage the community to improve the documentation making pull requests to SDFormat's Bitbucket repository, the changes there directly reflect on the website. See for example how this pull request updated the documentation for joint types.

chapulina gravatar imagechapulina ( 2015-04-12 14:53:24 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2015-04-09 20:07:55 -0500

Seen: 11,050 times

Last updated: Apr 13 '15