This tutorial assumes you have created an original Gazebo model and you'd like to share it with the community.
This tutorial also assumes that you have an account on Bitbucket, and that you have a client for Mercurial.
Note: You don't need to add your model to the database in order to use it in Gazebo. The database is a common place where you can find models which are useful for the whole community.
Note: Make sure that you have permission to distribute all the files included in the model and they're not copywrited material.
Go to https://bitbucket.org/osrf/gazebo_models and, from the menu on the left hand side of the screen, choose "Fork". The default options are generally fine.
After you have forked the repository, clone it. Assuming that you chose the default name for the repository, you will clone using a command on a terminal similar to the following:
hg clone https://bitbucket.org/yourname/gazebo_models
where yourname is your Bitbucket username.
Create a directory for your model under the gazebo_models directory. For this tutorial, we will assume that this directory is called mymodel, but you should give the directory an informative name about the model.
That directory must include the file model.config and at least one
file. It may include other files as well (meshes, textures, templates, etc.)
Also make sure you add the model directory to the CMakeLists.txt file.
The model.config file provides information necessary to pick the proper SDF file, information on authorship of the model, and a textual description of the model.
A sample model.config looks like this:
<?xml version="1.0"?> <model> <name>Wedge juggler</name> <version>1.0</version> <sdf version="1.5">model.sdf</sdf> <author> <name>Evan Drumwright</name> <email>firstname.lastname@example.org</email> </author> <description> A ball-in-wedge juggler. </description> </model>
This model.config file indicates that the simulator's definition of the model (i.e., visual, inertial, kinematic, and geometric properties, among others), is located in model.sdf, and follows SDF standard 1.5. It is possible to define multiple versions of your model, which may be useful if you intend for your model to be used with different versions of Gazebo. For example, we now change the contents of the file above, to support three different versions of SDF:
<?xml version="1.0"?> <model> <name>Wedge juggler</name> <version>1.0</version> <sdf version="1.5">model.sdf</sdf> <sdf version="1.4">model-1.4.sdf</sdf> <author> <name>Evan Drumwright</name> <email>email@example.com</email> </author> <description> A ball-in-wedge juggler. </description> </model>
You can add all of your files to the repository by typing the following from
the root directory of
hg add mymodel
or, if you have some files that you do not wish to track, you can add files individually:
hg add mymodel/model.config hg add mymodel/model.sdf
Commit and push your changes to your fork on Bitbucket. Give the commit a descriptive message, for example:
hg commit -m "Adding mymodel to the database" hg push
Assuming that your Bitbucket username is yourname and you used the defaults for the fork, you would find the forked repository on:
From that site, pick "Create pull request" from the menu on the left side of the web page.
Make sure that
osrf/gazebo_models is selected to the right of the arrow.
Give your pull request a meaningful title referring to your model.
On the description, describe any relevant information about the model and why you think the community could benefit from it. It's also recommended to add a picture of the model. You can see a good example of a pull request here.
When satisfied with your other options, click "Create pull request".
OSRF will review your pull request and begin integrating your changes into the model database.