This tutorial describes the process of creating a world with both static and dynamic objects.
<static>true</static>
element in SDF), are objects which only have collision geometry. All objects which are not meant to move should be marked as static, which is a performance enhancement.<static>
element or setting Make sure Gazebo is installed.
Create a working directory for this tutorial:
$ mkdir ~/build_world_tutorial; cd ~/build_world_tutorial
Start up gazebo, and you should see a world with just a ground plane.
$ gazebo
Gazebo provides two mechanisms for adding objects to Gazebo.
Insert
tab in the upper left corner.Boxes, spheres, and cylinders may be added to the world by clicking on the appropriate icon above the render window. Each shape is of unit size:
Select the box icon, and then move your mouse onto the render window. You will see a box that moves with your mouse. Left click when you are happy with the position of the box.
Repeat the same procedure for the sphere and cylinder. You should end with a world similar to this:
Gazebo's model database is a repository of all types of models including robots, tables, and building.
Select the Insert
tab in the upper left hand corner to access the model database.
The list of models are divided into sections according to there current location. Each section is labeled with a path or URI. Selecting an object located on a remote server will cause the model to be downloaded and stored in
~/.gazebo/models
.
Try adding various models to the world. Be patient when downloading models, as some may be large.
You should end up with something similar to the following, depending on the models you decided to add:
The pose of each model may be altered through the translate and rotate tools:
The translate tools allows you to move the object along the x, y, and z axes. Select this tool now and then move an object by left-pressing and dragging the object.
By default the object will translate around on the x, y plane. You may control which axis the object moves along by pressing and holding the x, y, or z key while dragging the object.
Try moving the objects around now into a different configuration.
The rotate tool allows you to orient a model around the x, y, and z axes. Select this tool now and then rotate an object by left-pressing and dragging the rings around the object.
By default the object will rotate around the z axis (yaw). You may control which axis the object rotates around by pressing and holding the x, y, or z key while dragging the object.
Try rotating the objects into a different configuration.
Model may also be deleted by selecting them and the hitting the Delete
key, or by right-clicking on a model and selecting Delete
.
Try deleting a few models.
Once you are happy with a world it can be save through the File
menu.
Select the File
menu now, and choose Save As
.
A pop-up will appear asking you to enter a new filename. Enter my_world.sdf
and click okay.
A saved world may be loaded on the command line:
gazebo my_world.sdf
The filename must be in the current working directory, or you must specify the complete path.