Autonomy Pipeline for Lightweight Drone Navigation
AEROS is a compact visual autonomy stack designed to process real-time camera input, estimate heading, and execute stable navigation commands within a simulated or lightweight drone environment.
AEROS demonstrates a complete autonomy pipeline featuring:
- Real-time video processing (webcam or simulation feed)
- CNN-based heading estimation trained on synthetic corridor data
- PID control for heading correction
- PyBullet simulation environment
- Web dashboard for telemetry visualization
┌─────────────────────────────────────────────────────────────┐
│ AEROS Architecture │
└─────────────────────────────────────────────────────────────┘
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Camera │────────▶│ Preprocessing│────────▶│ Model │
│ / Sim Feed │ │ Pipeline │ │ (CNN/ONNX) │
└──────────────┘ └──────────────┘ └──────┬───────┘
│
▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ React │◀────────│ FastAPI │◀────────│ PID │
│ Dashboard │ WebSocket│ Server │ │ Controller │
└──────────────┘ └──────────────┘ └──────┬───────┘
│
▼
┌──────────────┐
│ PyBullet │
│ Simulation │
└──────────────┘
-
Preprocessing (
src/preprocessing/)- Image resize, denoising, brightness normalization
- Optimized for real-time performance
-
Model (
src/model/)- Lightweight CNN architecture (MobileNet-style)
- PyTorch training pipeline
- ONNX export support
-
Control (
src/control/)- PID controller for heading correction
- Configurable gains and output limits
-
Simulation (
src/simulation/)- PyBullet-based drone simulation
- Corridor environment
- Camera feed generation
-
API (
api/)- FastAPI REST endpoints
- WebSocket streaming for real-time telemetry
-
Dashboard (
web/)- React-based web interface
- Live camera feed
- Real-time metrics visualization
- Python 3.10+
- Node.js 18+ (for web dashboard)
- CUDA-capable GPU (optional, for training)
# Clone repository
git clone <repository-url>
cd aeros
# Install Python dependencies
make install
# or
pip install -r requirements.txt
# Install web dependencies
cd web && npm install && cd ..make generate-data
# or
python scripts/generate_synthetic_data.py --output-dir data/synthetic --num-samples 10000# Option 1: Use Jupyter notebook
jupyter notebook notebooks/training.ipynb
# Option 2: Run training script (if implemented)
python scripts/train.pymake export-onnx
# or
python scripts/export_onnx.py --checkpoint models/checkpoints/best_model.pth --output models/heading_model.onnxmake run-api
# or
uvicorn api.main:app --host 0.0.0.0 --port 8000 --reloadIn a separate terminal:
make run-web
# or
cd web && npm startThe dashboard will be available at http://localhost:3000
# Build images
make docker-build
# Start services
make docker-up
# Stop services
make docker-downServices will be available at:
- API:
http://localhost:8000 - Dashboard:
http://localhost:3000
-
Start the API server:
make run-api
-
Load a trained model:
curl -X POST "http://localhost:8000/load_model" \ -H "Content-Type: application/json" \ -d '{"model_path": "models/checkpoints/best_model.pth", "use_onnx": false}'
-
Start simulation:
curl -X POST "http://localhost:8000/start_simulation?gui=true" -
Open dashboard at
http://localhost:3000and connect via WebSocket
The system will automatically use your webcam if simulation is not started. Ensure your camera is accessible and run:
make run-apiThen open the dashboard to see the live feed.
GET /- API informationGET /health- Health checkPOST /load_model- Load inference model{ "model_path": "models/checkpoints/best_model.pth", "use_onnx": false }POST /start_simulation?gui=true- Start PyBullet simulationPOST /stop_simulation- Stop simulationWS /ws- WebSocket stream for telemetry and frames
make test
# or
pytest tests/ -v --cov=srcaeros/
├── src/ # Core Python modules
│ ├── preprocessing/ # Image preprocessing
│ ├── model/ # CNN model and training
│ ├── control/ # PID controller
│ ├── simulation/ # PyBullet simulation
│ └── utils/ # Utilities (inference, metrics)
├── api/ # FastAPI backend
│ ├── main.py # Main API server
│ └── websocket.py # WebSocket utilities
├── web/ # React dashboard
│ ├── src/
│ └── public/
├── notebooks/ # Jupyter notebooks
│ └── training.ipynb # Training notebook
├── scripts/ # Utility scripts
│ ├── generate_synthetic_data.py
│ └── export_onnx.py
├── tests/ # Unit tests
├── data/ # Data directory
│ └── synthetic/ # Synthetic dataset
├── models/ # Model checkpoints
│ └── checkpoints/
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose config
├── Makefile # Build automation
├── requirements.txt # Python dependencies
└── README.md # This file
The synthetic dataset consists of:
- Images: PNG files (224x224 RGB)
- Metadata: JSON files with image paths and heading angles
Example metadata entry:
{
"image_path": "train/image_000001.png",
"heading": 0.1234
}- Generate synthetic data (see Quick Start)
- Open
notebooks/training.ipynbin Jupyter - Run all cells to train the model
- Checkpoints are saved to
models/checkpoints/ - Best model is saved as
best_model.pth
- Input: 224x224 RGB images
- Architecture: MobileNet-style depthwise separable convolutions
- Output: Single scalar (heading angle in radians)
- Parameters: ~500K-1M (lightweight for edge deployment)
Edit api/main.py to adjust PID gains:
pid_controller = PIDController(
kp=1.0, # Proportional gain
ki=0.1, # Integral gain
kd=0.5, # Derivative gain
)Edit src/simulation/drone_sim.py to adjust:
- Corridor dimensions
- Camera parameters
- Drone physics
- Inference: ≥ 15 FPS on CPU
- Latency: < 100ms end-to-end
- Model Size: < 10MB (ONNX)
- Accuracy: MAE < 0.1 radians on validation set
- Ensure API server is running on port 8000
- Check CORS settings if accessing from different origin
- Verify firewall settings
- Ensure PyBullet is installed:
pip install pybullet - Check for display/GUI issues (use
gui=falsefor headless) - Verify OpenGL drivers are installed
- Check model path is correct
- Ensure checkpoint file exists
- Verify model architecture matches checkpoint
This is a pre-release version. The following limitations should be considered:
- Simulation Physics: Simplified torque-based control, not full aerodynamics. Real-world behavior may differ.
- Training Data: Model trained on synthetic corridor data only. Performance on real-world images may vary.
- Hardware Access: Webcam access in Docker requires privileged mode and device mapping (
/dev/video0). - Optional Dependencies: PyBullet and ONNX Runtime are optional (system degrades gracefully if not installed).
- Real-world Testing: Not yet tested on physical drones. Use with caution in production environments.
- Model Accuracy: Performance may vary with different lighting conditions, camera angles, and environments.
- PID Tuning: Controller gains are tuned for simulation. May require retuning for real hardware.
- Single Drone: Currently supports single drone simulation. Multi-drone support planned for future releases.
For the latest updates and known issues, see CHANGELOG.md.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For questions or issues, please open an issue on GitHub.
Built with: PyTorch, FastAPI, React, PyBullet
Aeros it is...