This project implements a full Model Predictive Control (MPC) pipeline for 3D quadrotor (UAV) path correction. It simulates position tracking and path correction in Python, then transitions seamlessly to real-world integration with the DJI Tello EDU drone.
- 3D double integrator model (
x, y, zposition and velocity) - Real-time MPC optimization using CasADi and IPOPT
- Visualization of:
- Position tracking vs. reference
- XY top-down trajectory
- Control input accelerations
- Tracking error
- Modular design to connect with real drones
- Swappable reference trajectories (circle, figure-8, custom)
- Vision-based position estimation via OpenCV
- Live MPC → velocity control mapping for DJI Tello EDU
pip install numpy matplotlib casadi opencv-python djitellopy
The MPC solves a finite-horizon optimization problem at each timestep to minimize the difference between the drone’s actual and desired positions while respecting acceleration limits.
The real-time version reads visual feedback (e.g., from a face or AprilTag) to estimate the drone’s relative position and continuously adjusts the drone’s velocity to keep the target centered and at a constant distance.
python -m src.sim.run_mpc