Skip to content

chacha-eth/kq-lmpc-quadrotor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚁 🛸 KQ-LMPC: Koopman LMPC for Quadrotors

🚀 KQ-LMPC is the fastest open-source Koopman MPC controller for quadrotors: zero training data, fully explainable, hardware-proven SE(3) control.

⚡ Real-time convex MPC (<10 ms) • ✅ Stability guarantees • 🔧 PX4/ROS2 ready

PyPI Version License Python Paper DOI Stars

kq_lmpc_quadrotor — A **hardware-ready Python package** for **Koopman-based Linear Model Predictive Control (LMPC)**. Built for **real-time flight**, powered by **analytical Koopman lifting** (no neural networks, no learning phase).

✅ First hardware-validated Koopman MPC on SE(3) ✅ Convex QP (<10 ms solve time) via acados ✅ PX4/ROS2/MAVSDK compatible : deploy to drones easily

🔧 acados-powered QP  | 🧭 LPV + LTI Koopman Embedding  | 🚀 PX4 Offboard Ready

🌟 Key Features

Analytical Koopman lifting with generalizable observables
    → No neural networks, no training, no data fitting required

Data-free Koopman-lifted LTI + LPV models
    → Derived directly from SE(3) quadrotor dynamics using Lie algebra structure

Real-time Linear MPC (LMPC)
    → Solved as a single convex QP termed KQ-LMPC
    → < 10 ms solve time on Jetson NX / embedded hardware

Trajectory tracking on SE(3)
    → Provable controllability in lifted Koopman space

Closed-loop robustness guarantees
    → Input-to-state practical stability (I-ISpS)

Hardware-ready integration
    → Works with PX4 Offboard Mode, ROS2, MAVSDK, MAVROS

Drop-in MPC module
    → for both KQ-LMPC, NMPC with acados on Python.

❗ Why It Matters

Real-time control of agile aerial robots is still dominated by slow NMPC or black-box learning-based controllers. One is too computationally heavy, the other is unsafe without guarantees.

KQ-LMPC bridges this gap by enabling convex MPC for nonlinear quadrotor dynamics using Koopman operator theory. This means: ✅ Real-time feasibility (<10 ms solve time)
Explainable, physics-grounded control
Robustness guarantees (I-ISpS)
Ready for PX4/ROS2 deployment

🧠 Paper

This work is based on:

"Real-Time Linear MPC for Quadrotors on SE(3): An Analytical Koopman-based Realization"
IEEE Robotics and Automation Letters (RA-L), 2025 (To appear)
Santosh Rajkumar, Chengyu Yang, Yuliang Gu, Sheng Cheng, Naira Hovakimyan, Debdipta Goswami
[Paper PDF][ArXiv][Video Demos]

If you use this repository, please cite us 🙏

@article{rajkumar2025kqlmpc,
  title={Real-Time Linear MPC for Quadrotors on SE(3): An Analytical Koopman-based Realization},
  author={Rajkumar, Santosh and Yang, Chengyu and Gu, Yuliang and Cheng, Sheng and Hovakimyan, Naira and Goswami, Debdipta},
  journal={IEEE Robotics and Automation Letters},
  year={2025}
}

🔧 Installation

*Virtual environment recommended

Install from PyPI (recommended):

pip install kq-lmpc-quadrotor

Install from source

git clone https://github.com/santoshrajkumar/kq-lmpc-quadrotor.git
cd kq-lmpc-quadrotor
pip install -e .

⚡ Quick Demo

from kq_lmpc_quadrotor import lqr_demo
lqr_demo()

⚠️ Important Dependency Notice

  • This package relies on acados for fast Model Predictive Control (MPC).
  • You must configure acados + Python interface before running MPC examples.
  • Recommended that you install acados and configure, before installing the package if you are going to use MPC.
  • Koopman Lifting and LQR will work without acados installation
  • Quick Setup Checklist
  • Install acados ✅
  • Enable Python interface ✅
  • Export ACADOS_SOURCE_DIR
  • Set library paths:
    • Linux: LD_LIBRARY_PATH
    • macOS: DYLD_LIBRARY_PATH
from kq_lmpc_quadrotor import kqlmpc_demo
kqlmpc_demo()

⤴️ Koopman Lifting

📊 Benchmarking: KQ-LMPC vs NMPC

  • Python 3.10 • Ubuntu 22.04 • AMD Ryzen 3 PRO CPU
  • Metrics: Mean solve time (μₜ), Worst-case solve time (tᵥ), and Tracking RMSE (𝓔ₛ).
  • Prediction horizon Tₕ ∈ {0.8, 1.4, 2.0, 2.8} s across 4 tasks.
  • 4 Benchmark Tasks:
    • Task 1 : Follow a Line and Hover
    • Task 2 : Follow a vertically moving helical path.
    • Task 3 : Follow a lemniscate trajectory
    • Task 4 : Follow a knot trajectory.

Your alt text

Computation time comparison (ms)

Your alt text

Tracking RMSE (m) comparison

🔍 Highlights

  • 2–4× faster mean computation time than NMPC
  • Lower worst-case latency → more reliable for real-time flight
  • Competitive tracking accuracy
  • Scales efficiently with larger prediction horizons

🚀 v2.0 (Coming Soon)
🔧 Complete PX4 Offboard control pipeline for hardware
🔧 Full Gazebo SITL + PX4 integration demos
🔧 Flight-ready example configs

If you find this project useful, please ⭐ star the repo and follow — your support drives development!

About

A complete, hardware-ready Python package for Koopman-based Linear Model Predictive Control (LMPC), delivering real-time trajectory tracking for quadrotors using analytical Koopman lifting (no training data required)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 92.0%
  • MATLAB 8.0%