How ardupilot/uavlogviewer works
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