# px4/px4-gazebo-models architecture

> Architecture diagram of the GitHub repository px4/px4-gazebo-models, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/px4/px4-gazebo-models
- Repository: https://github.com/px4/px4-gazebo-models

## Overview

##### Main Components

a. Resource Management Layer
- Model Repository (containing all the SDF/mesh files)
- World Repository (containing simulation environments)
- Asset Management System (for model downloads and updates)

b. Simulation Control Layer
- Simulation Controller (simulation-gazebo script)
- Configuration Manager (handling command-line arguments)
- Model Store Manager (handling model downloads and storage)

c. Integration Layer
- PX4 Interface (connection to PX4 autopilot)
- Gazebo Interface (connection to Gazebo simulator)

##### Component Relationships

- How the simulation-gazebo script interfaces with both PX4 and Gazebo
- Model loading pipeline from repository to runtime
- Demonstrate the configuration flow from command-line to simulation setup

##### Specific Design Elements

Use these visual elements:
- Hexagons for external systems (PX4, Gazebo)

**[Configuration Layer]**
- ↓
**[Resource Management Layer]**
- ↓
**[Simulation Control Layer]**
- ↓
**[Integration Layer]**

##### Key Features to Highlight

- Model download and storage mechanism
- World configuration system
- Headless operation capability
- Network partition support
- Interactive mode functionality

##### Additional Notes

- File types (SDF, MESH, CONFIG)
- Connection types (required vs. optional)
- Operation modes (interactive, headless, dryrun)

Remember to include the GitHub workflow integration showing how models are automatically updated and maintained in the Fuel repository.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Configuration Layer"
        Config["Model Configuration System"]
        CLI["Command Line Interface"]
    end

    subgraph "Resource Management Layer"
        ModelRepo[("Model Repository")]:::storage
        WorldRepo[("World Repository")]:::storage
        AssetMgmt["Asset Management System"]
        ModelStore["Model Store Manager"]
        SDFParser["SDF Parser & Validation"]
        ResAssets["Resource Assets"]
    end

    subgraph "Simulation Control Layer"
        SimController["Simulation Controller"]
        TestFrame["Testing Framework"]
        SimTools["Simulation Tools"]
    end

    subgraph "Integration Layer"
        PX4["PX4 Autopilot"]:::external
        Gazebo["Gazebo Simulator"]:::external
        GazeboInterface["Gazebo Interface"]
    end

    %% Connections
    Config --> SimController
    CLI --> SimController
    ModelRepo --> SimController
    WorldRepo --> SimController
    AssetMgmt --> ModelRepo
    AssetMgmt --> WorldRepo
    ModelStore --> ModelRepo
    SDFParser --> ModelRepo
    SDFParser --> WorldRepo
    ResAssets --> ModelRepo
    SimController --> TestFrame
    SimController --> SimTools
    SimController --> GazeboInterface
    GazeboInterface --> Gazebo
    SimController --> PX4

    %% Click Events
    click ModelRepo "https://github.com/PX4/PX4-gazebo-models/tree/main/models"
    click WorldRepo "https://github.com/PX4/PX4-gazebo-models/tree/main/worlds"
    click AssetMgmt "https://github.com/PX4/PX4-gazebo-models/tree/main/.github/workflows"
    click ModelStore "https://github.com/PX4/PX4-gazebo-models/blob/main/fuel_upload.sh"
    click SDFParser "https://github.com/PX4/PX4-gazebo-models/tree/main/sdf_parsing"
    click TestFrame "https://github.com/PX4/PX4-gazebo-models/tree/main/tests"
    click SimTools "https://github.com/PX4/PX4-gazebo-models/tree/main/tools/avl_automation"
    click Config "https://github.com/PX4/PX4-gazebo-models/blob/main/models/x500/model.config"
    click GazeboInterface "https://github.com/PX4/PX4-gazebo-models/blob/main/models/x500/model.sdf"
    click ResAssets "https://github.com/PX4/PX4-gazebo-models/tree/main/models/x500_base/meshes"

    %% Styles
    classDef storage fill:#2ecc71,stroke:#27ae60
    classDef external fill:#95a5a6,stroke:#7f8c8d
    classDef default fill:#3498db,stroke:#2980b9
    
    %% Legend
    subgraph Legend
        L1["Component"]:::default
        L2[("Storage")]:::storage
        L3["External System"]:::external
    end
```
