How avis-drone-labs/fgcs works
Main Components
• Frontend (GUI):
• Located primarily in the “gcs” directory, it uses Electron, Vite, and React.
• Contains UI components (dashboard, telemetry, maps, graphs, settings, etc.) structured under “gcs/src/components”.
• Has configuration files like “package.json”, “vite.config.ts” and environmental variables (.env) that set the connection parameters (VITE_BACKEND_URL).
• Backend (Radio):
• Found in the “radio” directory, using Flask as the web framework and Pymavlink to handle drone communications.
• Contains a set of controllers and endpoints (under “radio/app/controllers” and “radio/app/endpoints”) for various operations (arm, flight modes, mission, etc.).
• Has utilities and tests for validating functionality.
• SITL Simulator & Docker:
• Although not a direct component in the source code, the README explains how to run a simulator (SITL) via Docker.
• This component simulates UAV behavior and can be shown as an external service with which the backend interacts over TCP (port 5760/5763).
• Supporting elements:
• Build and packaging scripts are present (“building”, “dockerfile”, and pyinstaller commands in the README) which package the backend and frontend deployments.
• Pre-commit hooks, GitHub workflows, and code style tools supporting development workflows can be noted as part of the development environment but may be optionally depicted.
Relationships and Interactions
• The Frontend communicates directly with the Backend using HTTP requests (using the URL specified in .env, e.g., http://127.0.0.1:4237).
• The Backend (Flask) receives these commands and interacts with the drone or simulator using the MAVLink protocol.
• The SITL Simulator (dockerized Ardupilot instance) is an external service that the backend connects to for simulation purposes.
• There are internal dependencies among various UI components (charts, maps, telemetry displays) in the frontend and among controllers/endpoints in the backend.
• The build and packaging process bridges development and deployment, bundling the backend (with PyInstaller) and frontend (with yarn build), and then integrating them into a deployable package.
Architectural Patterns and Design Principles
• Separation of Concerns:
• Frontend and backend are clearly separated, each with its own set of responsibilities.
• Within the frontend, components are organized by feature (dashboard, map, telemetry, etc.), suggesting an MVC-ish or component-based design.
• The backend uses a controller and endpoint pattern to handle different system operations.
• Communication Flow:
• Connection from the Flask backend to the SITL simulator (or actual drone hardware) via network protocols.
• Integration with External Systems:
• Use of Docker for simulation and how that interacts with the backend.
• Use of pre-commit hooks, testing frameworks (pytest for backend, playwright for UI), although they can be depicted as a “Development & Testing” overlay.
Technology and Framework Details
• Optionally, include build/packaging processes (PyInstaller for the backend and yarn build for the frontend) as part of the deployment pipeline.