Skip to content

kishore6778/flightlog-insights

Repository files navigation

Flight Log Analyzer

A professional drone flight data analysis platform with AI-powered insights. Upload your ArduPilot or PX4 flight logs for comprehensive diagnostics, anomaly detection, and actionable recommendations.

Flight Log Analyzer License Python React

Features

Core Functionality

  • Multi-Format Support: Parse ArduPilot Dataflash (.BIN) and PX4 ULog (.ulg) flight logs
  • Comprehensive Telemetry Extraction: Battery voltage/current, vibration (X/Y/Z), GPS, altitude, attitude data
  • Statistical Analysis: Min, max, average, and sample count for all telemetry parameters
  • Anomaly Detection: Z-score based spike detection for vibrations, battery alerts, GPS accuracy warnings
  • AI-Powered Insights: GPT-3.5 integration for expert flight diagnostics and recommendations
  • Export Options: Download analysis results as CSV or JSON

Detected Anomalies

  • Critical battery voltage drops (< 10.5V for 3S LiPo)
  • Low battery warnings (< 11.0V)
  • Vibration spikes using statistical Z-score analysis (> 3σ)
  • GPS HDOP degradation warnings
  • Current draw anomalies and motor performance issues

Technology Stack

Frontend

  • React 18 with TypeScript
  • Tailwind CSS for styling
  • Shadcn/UI component library
  • Lucide React for icons
  • React Query for state management

Backend

  • Flask (Python) REST API
  • OpenAI GPT-3.5 for AI analysis
  • pymavlink for ArduPilot log parsing
  • pyulog for PX4 log parsing

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Python 3.8+
  • OpenAI API key

Frontend Setup

# Install dependencies
npm install

# Start development server
npm run dev

The frontend will be available at http://localhost:8080

Backend Setup

# Navigate to backend directory
cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set environment variable
export OPENAI_API_KEY=your_api_key_here  # On Windows: set OPENAI_API_KEY=your_api_key

# Start server
python app.py

The API will be available at http://localhost:5000

API Endpoints

Method Endpoint Description
POST /api/upload Upload and analyze flight log file
GET /health Server health check
GET /api/debug Debug information and supported formats

Upload Request

curl -X POST http://localhost:5000/api/upload \
  -F "[email protected]"

Response Structure

{
  "status": "SUCCESS",
  "log_type": "ardupilot",
  "stats": {
    "battery_voltage": { "min": 11.2, "max": 12.6, "avg": 11.89, "count": 1247 },
    "vibration_x": { "min": 0.01, "max": 0.08, "avg": 0.03, "count": 892 }
  },
  "anomalies": [
    {
      "type": "warning",
      "category": "Battery Voltage",
      "message": "LOW: Battery voltage at 11.2V",
      "detail": "Consider landing soon to avoid critical discharge.",
      "confidence": "HIGH"
    }
  ],
  "ai_insights": "Overall flight health: FAIR...",
  "timestamp": "2024-01-15T10:30:00Z"
}

Project Structure

flight-log-analyzer/
├── src/
│   ├── components/
│   │   └── flight-analyzer/
│   │       ├── FileUpload.tsx       # Drag & drop file upload
│   │       ├── ProcessingSteps.tsx  # Analysis progress indicator
│   │       ├── StatsGrid.tsx        # Telemetry statistics display
│   │       ├── AnomaliesList.tsx    # Anomaly detection results
│   │       ├── AIInsights.tsx       # GPT analysis display
│   │       ├── DownloadButtons.tsx  # CSV/JSON export
│   │       ├── Header.tsx           # Page header
│   │       └── ResultsSection.tsx   # Full results layout
│   ├── pages/
│   │   └── Index.tsx                # Main application page
│   └── index.css                    # Design system tokens
├── backend/
│   ├── app.py                       # Flask API server
│   └── requirements.txt             # Python dependencies
└── README.md

Configuration

Environment Variables

Variable Description Required
OPENAI_API_KEY OpenAI API key for GPT insights Yes
FLASK_PORT Backend server port (default: 5000) No
FLASK_DEBUG Enable debug mode (default: true) No

Supported Log Formats

Format Extension Detection
ArduPilot Dataflash .bin Magic bytes: 0xA3 0x95
PX4 ULog .ulg Header: ULog

Anomaly Detection Thresholds

Parameter Warning Critical
Battery Voltage (3S) < 11.0V < 10.5V
Vibration Z-score > 2.0 > 3.0
GPS HDOP > 2.5 > 5.0
Current Draw > 60A > 100A

Security Notes

⚠️ Important: Never commit API keys to version control

  • Store OPENAI_API_KEY in environment variables
  • Use .env files for local development (add to .gitignore)
  • Rotate API keys if accidentally exposed

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit changes (git commit -m 'Add new feature')
  4. Push to branch (git push origin feature/new-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • ArduPilot for Dataflash log format documentation
  • PX4 for ULog format specification
  • OpenAI for GPT API
  • pymavlink for MAVLink parsing utilities

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published