# ardupilot/uavlogviewer architecture

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

- Interactive diagram: https://gitdiagram.com/ardupilot/uavlogviewer
- Repository: https://github.com/ardupilot/uavlogviewer

## Overview

##### Project Type and Purpose
- From the README and file tree, we see this is a single‐page, client‐side “UAV Log Viewer” built in JavaScript/Vue.js. It ingests Mavlink telemetry and Dataflash logs, parses them in the browser, and renders charts (via Plotly) and 3D views (via Cesium). There is no custom backend service code—the build/deploy pipeline uses Node/NPM and Docker to serve static assets.

##### File Structure
- Top-level directories:
- build/ & config/ → webpack and environment setup
- src/ → all application code (Vue components, assets, parsing libraries, tools, router)
- static/ → static placeholders
- test/ → unit and E2E tests
- Key patterns:
- A Vue.js component tree (src/components) with subfolders for widgets and Cesium extras
- src/tools & src/mavextra house log‐parsing modules and helpers
- A clear separation of assets (3D models, XML metadata) vs. code
- Standard NPM scripts (dev, build, test) and Dockerfile for containerization

##### Extract Additional Insights from the README
- The system is built and served entirely as static files (webpack-dev-server in dev mode, static HTTP in prod via Docker)
- No external microservices are called—parsing is local.
- Tests exercise both parsing logic (unit) and the UI (E2E with Nightwatch).

a. Main Components
- User Browser (Client)
- Vue.js SPA – UI Layer:
– Router (src/router/index.js)
– Core Views (App.vue, Home.vue, CesiumViewer.vue, PlotSetup.vue, etc.)
– Widgets (AttitudeWidget, MessageViewer, ParamViewer…)
- Data Model & Parsing Layer:
– mavlink.js libraries (src/libs & src/assets/mavlink.js)
– mavextra modules (matrix3, vector3, mavextra.js)
– src/tools parsers (dataflashDataExtractor, mavlinkDataExtractor, parser.worker.js)
- Visualization Engines:
– Plotly integration (Plotly.vue, PlotlyPopup.vue)
– Cesium 3D Viewer (CesiumViewer.vue + cesiumExtra helpers)
- Build & Deployment Pipeline:
– Webpack (build/*.conf.js) & Babel (babel.config.js)
– NPM scripts & Docker image (Dockerfile)
- Testing Frameworks:
– Unit tests (Jest)
– E2E tests (Nightwatch)

b. Relationships & Data Flow
1. User loads page → index.html served by Docker/Nginx or webpack-dev-server
2. Vue Router initializes App.vue → Home.vue
3. User selects/upload log file → parser.worker.js (Web Worker) invokes appropriate parser in src/tools/parsers
4. Parsed data objects (time series, messages) flow into Vue components via events or props
5. PlotSetup.vue / Plotly.vue generate charts using Plotly.js
6. CesiumViewer.vue renders 3D path/telemetry using Cesium and loaded .glb assets
7. SideBarFileManager manages file loading; SideBarMessageMenu displays message streams
8. Build pipeline bundles everything; Docker container serves built assets

c. Architectural Patterns & Principles
- Modular component‐based design (Vue.js single‐file components)
- Separation of concerns: view (Vue components), data parsing (tools/mavextra), visualization engines (Plotly/Cesium)
- Use of Web Workers (parser.worker.js) to offload expensive parsing
- Standard CI/CD via GitHub Actions (nodejs.yml, nodejsdeploy.yml, release.yml)

d. Key Technologies
- Vue.js + Vue Router
- Webpack + Babel
- CesiumJS for 3D
- Plotly.js for charting
- Mavlink parsers (custom JS libraries + Web Worker)
- Docker for containerization
- Jest & Nightwatch for testing

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Browser
    Browser["User Browser"]:::external

    %% UI Layer
    subgraph "UI Components"
        direction TB
        Router["Vue Router"]:::ui
        App["App Shell (App.vue)"]:::ui
        Home["Home View (Home.vue)"]:::ui
        Sidebar["Generic Sidebar"]:::ui
        FileManager["File Manager Sidebar"]:::ui
        FileProgress["File Manager Progress Bar"]:::ui
        MessageMenu["Message Menu Sidebar"]:::ui
        PlotSetup["Plot Setup View"]:::ui
        PlotlyComp["Plotly Chart Component"]:::ui
        PlotlyPopup["Plotly Popup Component"]:::ui
        CesiumView["Cesium 3D Viewer"]:::ui
        Widgets["Widget Components"]:::ui
    end

    %% Data Parsing Layer
    subgraph "Data & Parsing Modules"
        direction TB
        MavlinkAsset["MAVLink JS (asset)"]:::data
        MavlinkLib["MAVLink Parsing Library"]:::data
        MAVExtra["MAVExtra Modules"]:::data
        Tools["Log Parsing Tools"]:::data
        ParserWorker["parser.worker.js\n(Web Worker)"]:::worker
        ParserModules["Parser Modules"]:::data
    end

    %% Visualization Engines
    subgraph "Visualization Engines"
        direction TB
        PlotlyEngine["Plotly Engine"]:::plot
        CesiumEngine["Cesium Engine"]:::cesium
    end

    %% Build & Deploy
    subgraph "Build & Deployment"
        direction TB
        Webpack["Webpack & Babel"]:::build
        NPM["NPM Scripts & Docker"]:::build
    end

    %% Testing
    subgraph "Testing"
        direction TB
        UnitTests["Unit Tests (Jest)"]:::test
        E2ETests["E2E Tests (Nightwatch)"]:::test
    end

    %% Connections
    Browser -->|"loads index.html"| App
    App --> Router
    Router --> Home
    Home --> FileManager
    FileManager --> FileProgress
    FileManager --> MessageMenu
    FileManager -->|"upload log"| ParserWorker
    ParserWorker --> MavlinkAsset
    ParserWorker --> MavlinkLib
    ParserWorker --> Tools
    ParserWorker --> ParserModules
    ParserWorker --> MAVExtra
    ParserWorker -->|"parsed data"| App
    App --> PlotSetup
    App --> CesiumView
    PlotSetup --> PlotlyComp
    PlotlyComp --> PlotlyEngine
    CesiumView --> CesiumEngine
    CesiumEngine --> MAVExtra
    Webpack --> NPM
    NPM -->|"serves static"| Browser
    Webpack -->|"bundles"| App
    UnitTests --> Tools
    UnitTests --> MavlinkLib
    E2ETests --> App

    %% Click Events
    click Router "https://github.com/ardupilot/uavlogviewer/blob/master/src/router/index.js"
    click App "https://github.com/ardupilot/uavlogviewer/blob/master/src/App.vue"
    click Home "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/Home.vue"
    click CesiumView "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/CesiumViewer.vue"
    click MAVExtra "https://github.com/ardupilot/uavlogviewer/tree/master/src/components/cesiumExtra/"
    click PlotSetup "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/PlotSetup.vue"
    click PlotlyComp "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/Plotly.vue"
    click PlotlyPopup "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/PlotlyPopup.vue"
    click FileManager "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/SideBarFileManager.vue"
    click FileProgress "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/SideBarFileManagerProgressBar.vue"
    click MessageMenu "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/SideBarMessageMenu.vue"
    click Sidebar "https://github.com/ardupilot/uavlogviewer/blob/master/src/components/Sidebar.vue"
    click Widgets "https://github.com/ardupilot/uavlogviewer/tree/master/src/components/widgets/"
    click MavlinkAsset "https://github.com/ardupilot/uavlogviewer/blob/master/src/assets/mavlink.js"
    click MavlinkLib "https://github.com/ardupilot/uavlogviewer/blob/master/src/libs/mavlink.js"
    click MAVExtra "https://github.com/ardupilot/uavlogviewer/tree/master/src/mavextra/"
    click Tools "https://github.com/ardupilot/uavlogviewer/tree/master/src/tools/"
    click ParserWorker "https://github.com/ardupilot/uavlogviewer/blob/master/src/tools/parsers/parser.worker.js"
    click ParserModules "https://github.com/ardupilot/uavlogviewer/tree/master/src/tools/parsers/"
    click Webpack "https://github.com/ardupilot/uavlogviewer/blob/master/build/webpack.base.conf.js"
    click NPM "https://github.com/ardupilot/uavlogviewer/blob/master/package.json"
    click UnitTests "https://github.com/ardupilot/uavlogviewer/blob/master/test/unit/specs/mavlinklogs.spec.js"
    click E2ETests "https://github.com/ardupilot/uavlogviewer/blob/master/test/e2e/runner.js"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#3399ff,color:#000
    classDef data fill:#d4edda,stroke:#28a745,color:#000
    classDef worker fill:#f8d7da,stroke:#dc3545,color:#000,stroke-dasharray: 5 5
    classDef plot fill:#e2d5f0,stroke:#6f42c1,color:#000
    classDef cesium fill:#ffe5b4,stroke:#ff8c00,color:#000
    classDef build fill:#e2e2e2,stroke:#666,color:#000
    classDef test fill:#f0f0f0,stroke:#999,color:#000
    classDef external fill:#ffffff,stroke:#000,color:#000,stroke-dasharray: 2 2
```
