-
Notifications
You must be signed in to change notification settings - Fork 30
Generate large terrains for worlds
The most efficient way to generate a large terrain for a world is to utilize Gazebo's heightmap object. For more detailed description of the heightmap tag specifications consult the SDF geometry element reference: http://sdformat.org/spec?elem=geometry&ver=1.4
To create a heightmap you need to provide a gray-scale image as in input. The darker parts of the image will correspond to the regions of lower elevation while the lighter parts will result in greater heights. The image must meet two requirements:
-
It must be a square image
-
The sides must be of size
2^n + 1
(the size of 129 seems to be most commonly used)
Once such image is available, the following geometry tag can be used for collision and visual elements of your terrain, specifying the path to the image, size of the heightmap, and the position of heightmap's center relative to Gazebo's coordinate frame:
<geometry>
<heightmap>
<uri>model://yosemite/materials/textures/yosemite.png</uri>
<size>1000 1000 125</size>
<pos>100 0 -30</pos>
</heightmap>
</geometry>
While you can create your own input images by hand, for smoother and more realistic terrains it might be easier to use the elevation data of real-world scenes. One possible source of real-world elevation data is the US Geological Survey: http://gdex.cr.usgs.gov/gdex/ (though you need to create an account to download the data)
Heightmaps in Gazebo are textured in slices that are bound by specified height limits. Textures are specified in the visual element of your terrain using the SDF format. For n
'texture' objects, n-1
'blend' objects are required to specify the transitions between different textures. Below is an example of applying four textures to a terrain at various heights:
<geometry>
<heightmap>
<texture>
<diffuse>file://media/materials/textures/dirt_diffusespecular.png</diffuse>
<normal>file://media/materials/textures/flat_normal.png</normal>
<size>50</size>
</texture>
<texture>
<diffuse>file://media/materials/textures/terrain_detail.jpg</diffuse>
<normal>file://media/materials/textures/flat_normal.png</normal>
<size>75</size>
</texture>
<texture>
<diffuse>file://yosemite/materials/textures/texture_forest.png</diffuse>
<normal>file://media/materials/textures/flat_normal.png</normal>
<size>100</size>
</texture>
<texture>
<diffuse>file://yosemite/materials/textures/texture_mountains.png</diffuse>
<normal>file://media/materials/textures/flat_normal.png</normal>
<size>50</size>
</texture>
<blend>
<min_height>35</min_height>
<fade_dist>10</fade_dist>
</blend>
<blend>
<min_height>60</min_height>
<fade_dist>10</fade_dist>
</blend>
<blend>
<min_height>90</min_height>
<fade_dist>10</fade_dist>
</blend>
<uri>model://yosemite/materials/textures/yosemite.png</uri>
<size>1000 1000 125</size>
<pos>100 0 -30</pos>
</heightmap>
</geometry>
How to add
- Adding a Camera to BebopS
- Adding a Custom wind field to your world
- Adding an IMU to BebopS
- Adding an 1D Laser
How to create
- Creating ROS Plugins for Gazebo
- Gazebo and Gazebo ROS Installation
- Gazebo Topic Naming Conventions
- ROS Interface Plugin
How to install
How to generate
How to set
How to develop
- Include ordering in cpp and header files
- Interfacing BebopS through MATLAB
- Interfacing BebopS with TravisCI
- Package Versioning
- Software Specifications
- Specifying constants and default values
- Working With Meshes in Gazebo
More information