Skip to content

saiaravind19/gazebo_terrain_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gazebo Terrain Generator Ask DeepWiki

A super easy-to-use tool for generate 3D Gazebo terrain using real-world elevation and satellite data.

Project Demo

Features

  • Real-World Terrain Generation: Generate 3D Gazebo worlds using actual elevation data and satellite images of any location on Earth.
  • Configurable Spawn Location: Change the spawn location using interactive UI marker within the region of interest
  • Configurable Output: Flexible output paths via environment variables for different deployment scenarios
  • Customizable Resolution: Adjustable tile resolution.
  • Complete World Generation: Generates the entire model with no hassle out of the box

Supported and Tested Stack

🛠️ Setup Instructions

Create and Activate Virtual Environment (Recommended)

It's recommended to use a virtual environment to avoid dependency conflicts:

python3 -m venv terrain_generator
source terrain_generator/bin/activate

Install Requirements

Make sure your virtual environment is active, then install all required Python packages using:

pip install -r requirements.txt

⚙️ Configuration

Environment Variables

You can customize where Gazebo Models and World are saved using environment variables:

export GAZEBO_MODEL_PATH="~/Desktop/gazebo_models"
export GAZEBO_WORLD_PATH="~/Desktop/gazebo_models/worlds"

Default Location: If no environment variable is set, worlds are saved to:

Models saved in **~/gazebo_terrian_generator/output/gazebo_terrian/**
World files in **~/gazebo_terrian_generator/output/gazebo_terrian/worlds**

File Structure

Generated model follow this structure:

<GAZEBO_MODEL_PATH>/
├── world_name/
│   ├── model.sdf              # Gazebo model definition
│   ├── model.config           # Model configuration
│   ├── world_name.sdf         # Gazebo world file
│   └── textures/
│       ├── world_name_height_map.tif    # Elevation heightmap
│       └── world_name_aerial.png        # Satellite imagery texture
<GAZEBO_WORLD_PATH>/
├──world_name.sdf
├──world_name_1.sdf
├──world_name_2.sdf

🚀 Run Gazebo World Generator

  1. Navigate to gazebo_terrian_generator and start the applciation.

    source terrain_generator/bin/activate
    python server.py
  2. Access the Web Interface: Open your web browser and navigate to http://localhost:8080

  3. Generate Your World:

    • Search for any location on Earth
    • Draw a rectangular region of interest
    • Place launch pad marker at desired spawn location
    • Configure settings (zoom level, map source)
    • Click "Generate Terrain" to create your world
  4. Output Location: Generated worlds are saved to the configured path (see Environment Variables section above)

🏁 Spawning Gazebo Worlds

  1. Export the gazebo model path:

    export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:<path_to_your_gazebo_worlds>
  2. Run Gazebo with your world:

    gz sim your_world_name/your_world_name.sdf

Note: Replace <path_to_your_gazebo_worlds> with the actual path where your worlds are saved.

📋 Sample Worlds Example

Test the installation with provided sample worlds:

  1. Export the sample gazebo model path:

    export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:~/gazebo_terrian_generator/sample_worlds
  2. Launch sample world:

    gz sim prayag/prayag.sdf

🔑 MapBox API Key

A free api key is being used in the repo if it gets limited then please feel free to create your own API key from official MapBox's website and replace it in the configuration file

Important Disclaimer

Downloading map tiles is subject to the terms and conditions of the tile provider. Some providers such as Google Maps have restrictions in place to avoid abuse, therefore before downloading any tiles make sure you understand their TOCs. I recommend not using Google, Bing, and ESRI tiles in any commercial application without their consent.

License

This project uses work of Ali Ashraf.

Reference

Releases

No releases published

Contributors 2

  •  
  •