This is a modular drone control system that combines visual odometry, real-time visualization, and keyboard input for drone navigation.
├── __init__.py # Package initialization
├── main.py # Main coordination logic
├── config.py # Configuration constants
├── input_handler.py # Pygame keyboard input handling
├── gui_display.py # Real-time visualization (matplotlib + OpenCV)
├── drone_controller.py # MAVSDK drone control
├── visual_odometry_processor.py # Computer vision and VO processing
├── utils.py # Utility functions (CSV I/O, etc.)
└── VO_test copy.py # Original monolithic file (for reference)
- Centralized configuration constants
- Easy to modify settings without touching core logic
- Includes AirSim IP, speeds, file paths, timing settings
- Pygame-based keyboard input handling
- Runs in separate thread
- Maps keyboard inputs to velocity commands
- Handles landing command ('L' key)
- Real-time visualization using matplotlib and OpenCV
- Displays drone camera feed with feature points
- Shows live path plot
- Runs in separate thread
- MAVSDK-based drone control
- Handles connection, arming, takeoff, landing
- Executes velocity commands from input handler
- Async function for non-blocking operation
- Processes AirSim camera feed
- Performs visual odometry calculations
- Annotates frames with feature points
- Tracks estimated path
- Async function for real-time processing
- Helper functions for data I/O
- CSV saving and loading for path data
- Reusable utility functions
- Coordinates all components
- Manages shared state (queues, events, data)
- Orchestrates threads and async tasks
- Handles cleanup and error handling
From the parent directory, run the system with:
python run_modular_system.pyOr run directly from within the package:
cd drone_vo_system
python -m drone_vo_system.mainOr from the original file:
python "VO_test copy.py"- W/S: Forward/Backward
- A/D: Left/Right
- UP/DOWN: Up/Down
- Q/E: Rotate left/right
- L: Land and quit
- Q (in GUI window): Quit
- airsim
- cv2 (OpenCV)
- numpy
- matplotlib
- pygame
- mavsdk
- asyncio
- threading
- queue
- csv