How bluerobotics/cockpit works
Project Type & Purpose
• This is a cross-platform, Electron-based ground control station for remote vehicles.
• It is a frontend-only application that connects to external backends (e.g., BlueOS, MAVLink routers, mavlink2rest, mavlink-camera-manager) to control and monitor various types of vehicles.
• The README and file structure indicate that it supports simulation (via docker-compose profiles) for different vehicle types – ArduSub, ArduCopter, ArduRover, and ArduPlane.
Main Components
A. Frontend / Application Layer:
• UI Components: Represent the Vue components from “src/components” and “src/views”. There’s clear separation into generic UI elements, specialized widgets (including mini-widgets, mission planning, and custom widget elements) that form the cockpit interface.
• Plugins and Composables: Show modules like “src/plugins” (using Vuetify, Webfontloader) and composables (e.g., drag, interactionDialog, settingsSyncer) that help manage application logic.
• State Management & Routing: Include “src/stores” (for various domains like vehicle, mission, etc.) and the routing configuration (“src/router”) that binds everything together.
• Styles: Note that “src/styles” is used for user interface styling.
• Public Assets: Illustrated in “public” (with images, manifests, etc.) for UI assets.
B. Electron / Native Application Layer:
• Electron Main & Preload: Highlight “src/electron/main.ts” and “src/electron/preload.ts” as the entry points when running as an Electron application.
• Electron Services: Include services for auto-updating, configuration (config-store), networking, and local storage found under “src/electron/services”.
C. Domain & Communication Libraries:
• Libraries in “src/libs” represent core functionalities including:
• Communication (e.g., MAVLink integration under “src/libs/communication/mavlink”).
• Connection management: “src/libs/connection” for managing websockets and external connections.
• Vehicle protocols and support for different vehicle types under “src/libs/vehicle”.
• External API & Telemetry: “src/libs/external-api” and “src/libs/external-telemetry”.
• Widgets, joystick handling, and signal processing are also supported by dedicated libs (e.g., “src/libs/joystick”, “src/libs/signal”).
D. External Systems & Backend Providers:
• BlueOS: acting as the complete backend when available.
• MAVLink routers (e.g., mavp2p or MAVLink Router).
• mavlink2rest: providing API access over websockets (noted as running on port 6040).
• Optionally, mavlink-camera-manager for video streaming (via WebRTC).
• Simulation Environment: Represent a simulation module (using docker-compose with profiles defined in sim.yml) that emulates different vehicle behaviors.
Relationships & Data Flow
• That the Electron layer (when used) encapsulates the UI and communicates with local services (auto-update, configuration, etc.).
• Communication between the Frontend’s network/connection libraries and the external backend services via WebSockets and HTTP calls.
Architectural Patterns / Design Principles
• Separation of Concerns: Divide UI rendering (Vue components), state management (stores across domains), and backend communication (libs for connection and protocol handling).
• Modularization: Components (widgets, dialogs, joysticks) and libraries are organized in domain-specific directories, signifying a modular design.
• Extensibility: The project supports custom widgets and config panels, showcasing points for enhancing or injecting new features.
• Integration via WebSockets & REST: Highlight that real-time data flows between the app and external systems using specific protocols (WebSockets for mavlink2rest and WebRTC for camera streaming).
Final Assembly
– The Frontend/UI layer (Vue components, composables, plugins, stores, router)
– The Electron integration layer (when applicable)
– The Domain & Communication libraries (providing abstraction for interactions with vehicles)
• Overlay the external systems: BlueOS, MAVLink routers, mavlink2rest and camera manager.
• For development and simulation: Represent the simulation environment (docker-compose defined in sim.yml) as a parallel external component that feeds data to the application.
• Clear labels for components.