Skip to content

vantrn/uav_mpc_path_correction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UAV Model Predictive Control (MPC) — Path Correction

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.


🚀 Features

  • 3D double integrator model (x, y, z position 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

🛠️ Dependencies

pip install numpy matplotlib casadi opencv-python djitellopy


🧠 How It Works

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.


🧪 Run Simulation

python -m src.sim.run_mpc

About

Model Predictive Control for UAVs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages