Skip to content

SJK2150/agri

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Agriculture Drone Ground Control Station

A comprehensive web-based ground control station for agricultural drone operations, featuring real-time telemetry, mission planning, AI-powered anomaly detection, and field management.

๐Ÿš€ DEPLOYED & LIVE!

๐ŸŒ Backend API: https://agri-7.onrender.com
๐Ÿ“– API Documentation: https://agri-7.onrender.com/docs
โœ… Health Check: https://agri-7.onrender.com/health

Quick Start for Team Members

No backend setup needed! The backend is already deployed and running.

  1. Clone the repository:

    git clone https://github.com/Advaithftw/agri.git
    cd agri
  2. Setup frontend only:

    cd frontend
    npm install
    npm start
  3. Access the app:

Full Local Development Setup (Optional)

If you want to run everything locally:

Backend Setup

  1. Navigate to backend directory:

    cd backend
  2. Create virtual environment:

    python -m venv venv
    # Windows
    venv\Scripts\activate
    # Linux/Mac
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure database:

    # Copy environment template
    cp .env.example .env
    # Edit .env and set your DATABASE_URL (see docs/supabase-setup.md for details)
  5. Initialize database:

    python -c "from database import create_tables; create_tables()"
  6. Start the server:

    python main.py

Local backend will be available at http://localhost:8000

Frontend Setup

  1. Navigate to frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. For local backend, create .env.local:

    REACT_APP_API_BASE_URL=http://localhost:8000
  4. Start development server:

    npm start

Frontend will be available at http://localhost:3000

Simulator Setup

  1. Navigate to simulator directory:

    cd simulator
  2. Install dependencies:

    pip install asyncio websockets numpy
  3. Start simulator:

    python simulator.py

๐Ÿ“‹ Features

โœ… Core Features

  • User Authentication - JWT-based secure login/registration
  • Field Management - Create, edit, and visualize agricultural fields
  • Mission Planning - Design drone missions with waypoints and actions
  • Real-time Telemetry - Live drone status, GPS, battery, and sensor data
  • AI Anomaly Detection - Machine learning-powered alert system
  • Data Export - Export telemetry and mission data (CSV, JSON)
  • Interactive Maps - Leaflet-based field and mission visualization
  • WebSocket Communication - Real-time updates and alerts

๐Ÿ”ง Technical Features

  • FastAPI Backend - Modern, fast web API with automatic documentation
  • React Frontend - Responsive TypeScript interface with Material-UI
  • SQLAlchemy ORM - Robust database management with SQLite
  • Realistic Simulator - Physics-based drone flight simulation
  • Comprehensive Testing - Unit, integration, and E2E test suites
  • Documentation - Complete API docs and deployment guides

Architecture

โ”œโ”€โ”€ backend/          # FastAPI REST API + WebSocket server
โ”œโ”€โ”€ frontend/         # React web application
โ”œโ”€โ”€ simulator/        # Drone flight simulator service  
โ””โ”€โ”€ docs/            # Architecture and API documentation

Tech Stack

  • Backend: FastAPI, SQLAlchemy, PostgreSQL (Supabase), WebSockets, JWT Authentication
  • Frontend: React, Leaflet maps, Material-UI, WebSocket client
  • Simulator: Python asyncio service with realistic flight physics
  • AI/ML: scikit-learn (Isolation Forest), numpy, pandas
  • Database: PostgreSQL via Supabase (cloud-hosted, multi-user support)

Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 16+
  • npm or yarn

Backend Setup

cd backend
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac  
source venv/bin/activate

pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000

Frontend Setup

cd frontend
npm install
npm start

Simulator Setup

cd simulator
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate

pip install -r requirements.txt
python simulator.py

Access the Application

Database Setup

This application uses Supabase (PostgreSQL) for cloud-hosted, multi-user database support.

For detailed setup instructions, see: docs/supabase-setup.md

Quick setup:

  1. Create a free Supabase project at supabase.com
  2. Copy your connection string to backend/.env
  3. Run database initialization: python -c "from database import create_tables; create_tables()"

API Endpoints

Authentication

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • GET /auth/me - Get current user profile

Field Management

  • GET /fields - List user fields
  • POST /fields - Create new field
  • GET /fields/{id} - Get field details
  • PUT /fields/{id} - Update field
  • DELETE /fields/{id} - Delete field

Mission Management

  • GET /missions - List user missions
  • POST /missions - Create new mission
  • GET /missions/{id} - Get mission details
  • PUT /missions/{id} - Update mission
  • DELETE /missions/{id} - Delete mission
  • POST /missions/{id}/start - Start mission execution
  • POST /missions/{id}/pause - Pause mission
  • POST /missions/{id}/resume - Resume mission
  • POST /missions/{id}/abort - Abort mission

Telemetry & Logs

  • GET /telemetry/{mission_id} - Get mission telemetry history
  • GET /logs - List flight logs with filters
  • GET /logs/{id}/export - Export log as CSV/JSON

AI Analytics

  • GET /ai/anomalies/{mission_id} - Get anomaly detection results
  • POST /ai/predict-battery - Battery drain prediction

WebSocket

  • wss://agri-7.onrender.com/ws/telemetry/{mission_id} - Real-time telemetry stream (deployed)
  • ws://localhost:8000/ws/telemetry/{mission_id} - Real-time telemetry stream (local)

Database Schema

See docs/database-schema.md for detailed table structures.

Development

Running Tests

# Backend tests
cd backend
pytest

# Frontend tests  
cd frontend
npm test

Code Formatting

# Backend
cd backend
black . && isort .

# Frontend
cd frontend  
npm run format

Deployment

See docs/deployment.md for production deployment instructions.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Inspired by QGroundControl (QGCS) for UI/UX patterns
  • Uses open-source mapping libraries and ML models
  • Built for agricultural technology advancement

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 50.4%
  • TypeScript 47.6%
  • CSS 1.1%
  • Other 0.9%
โšก