A production-ready Flask server for the Flying LoRa project, providing real-time object detection, localization, drone control, and LoRa communication capabilities.
-
Object Detection
- Real-time object detection using YOLOv5
- Configurable detection parameters
- Detection statistics and performance metrics
- WebSocket streaming of detection results
-
Object Localization
- Multi-sensor triangulation
- Real-time position tracking
- Historical trajectory analysis
- Confidence-based filtering
-
Drone Control
- Real-time telemetry monitoring
- Mission planning and execution
- Position and altitude control
- Safety monitoring and failsafes
-
LoRa Communication
- Reliable message transmission
- Priority-based message handling
- Network status monitoring
- Automatic retransmission
-
System Management
- Configuration management
- Performance monitoring
- Health checks
- Logging and diagnostics
-
API Endpoints
- RESTful API for all core functionalities
- Rate limiting and authentication
- Comprehensive error handling
- Prometheus metrics integration
-
WebSocket Endpoints
- Real-time data streaming
- Subscription-based updates
- Efficient client-server communication
- Automatic reconnection handling
-
Configuration Management
- Environment-based configuration
- Dynamic configuration updates
- Secure secrets management
- YAML-based configuration files
-
Service Layer
- Detection Service
- Localization Service
- Drone Service
- LoRa Service
POST /api/detection/start - Start object detection
POST /api/detection/stop - Stop object detection
GET /api/detection/status - Get detection status
GET /api/detection/latest - Get latest detections
POST /api/localization/compute - Trigger localization
GET /api/localization/objects - Get localized objects
GET /api/localization/history - Get historical data
POST /api/drone/command - Send control command
GET /api/drone/telemetry - Get current telemetry
GET /api/drone/position - Get current position
POST /api/lora/send - Send LoRa message
GET /api/lora/receive - Get received messages
GET /api/lora/status - Get LoRa status
GET /api/system/metrics - Get system metrics
GET /api/system/health - Health check
POST /api/system/config - Update configuration
/ws/detections - Real-time detection stream
/ws/telemetry - Real-time telemetry stream
/ws/visualization - Real-time visualization data
-
Clone the repository:
git clone https://github.com/yourusername/flying-lora.git cd flying-lora -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # Linux/Mac # or .\venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env with your configuration -
Initialize the database:
flask db upgrade
- Base configuration:
config/base_config.yml - Environment-specific:
config/development_config.ymlorconfig/production_config.yml - Environment variables: See
.env.examplefor required variables
flask run --debuggunicorn -k eventlet -w 4 -b 0.0.0.0:5000 app:app# Run all tests
pytest
# Run with coverage
pytest --cov=app tests/
# Run performance tests
pytest tests/performance/- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
MIT License - see LICENSE file for details
For support, please open an issue on GitHub or contact the maintainers.