Cookbook

How are the model files resolved?

For large world, it's impossible to store all the model definition in the .sdf world file. Instead, models are commonly stored in a subdirectory models. For example, in the aws-robomaker-bookstore-world, we have the following project structure

~/workspace/gazebo-projects/aws-robomaker-bookstore-world$ tree -L 1
.
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── docs
├── launch
├── LICENSE
├── maps
├── models
├── my_note.txt
├── package.xml
├── README.md
├── routes
└── worlds

And the models directory looks like the following:

~/workspace/gazebo-projects/aws-robomaker-bookstore-world/models$ tree -L 2 | head -n 15
.
├── aws_robomaker_retail_AirConditionerC_01
│   ├── materials
│   ├── meshes
│   ├── model.config
│   └── model.sdf
├── aws_robomaker_retail_Bicycle_01
│   ├── materials
│   ├── meshes
│   ├── model.config
│   └── model.sdf

These models are reference in the world file. For instance:

<model name="AirConditionerC_01_001">
    <include>
        <uri>model://aws_robomaker_retail_AirConditionerC_01</uri>
    </include>
    <pose frame="">7.458202 1.422453 3.290944 0 -0 -1.564217</pose>
</model>

As we can see, the model path is a relative path. Therefore, when launching the Gazebo, we need to set the model path. Depending on the Gazebo version, there may be many environment variables available. According to the documentation, we have the following variables:

  • GAZEBO_MODEL_PATH: colon-separated set of directories where Gazebo will search for models

  • GAZEBO_RESOURCE_PATH: colon-separated set of directories where Gazebo will search for other resources such as world and media files.

  • GAZEBO_MASTER_URI: URI of the Gazebo master. This specifies the IP and port where the server will be started and tells the clients where to connect to.

  • GAZEBO_PLUGIN_PATH: colon-separated set of directories where Gazebo will search for the plugin shared libraries at runtime.

  • GAZEBO_MODEL_DATABASE_URI: URI of the online model database where Gazebo will download models from.

For Gazebo Fortress, we need to set the variable IGN_GAZEBO_RESOURCE_PATH to the models directory. This variable is documented on this page, Models, Lights, actors section.

Where are the Gazebo plugins installed on Ubuntu?

  • Check the environment variable IGN_GAZEBO_SYSTEM_PLUGIN_PATH

  • Check directory similar to /usr/lib/x86_64-linux-gnu/gazebo-7.0/plugins

Last updated