> For the complete documentation index, see [llms.txt](https://www.learnros2.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.learnros2.com/gazebo/cookbook.md).

# Cookbook

{% hint style="warning" %}
We use Gazebo version Fortress in our local experiment but the linked documentation may involve a different version of Gazebo.
{% endhint %}

## 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:

```xml
<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](http://classic.gazebosim.org/tutorials?tut=components\&cat=get_started), 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](https://gazebosim.org/api/gazebo/4.0/resources.html), 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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.learnros2.com/gazebo/cookbook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
