Skip to content

santoshrajkumar/kq-lmpc-quadrotor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 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:

Rajkumar, S.M., Yang, C., Gu, Y., Cheng, S., Hovakimyan, N. and Goswami, D., 2025. Real-Time Linear MPC for Quadrotors on SE (3): An Analytical Koopman-Based Realization. IEEE Robotics and Automation Letters, 10(12), pp.13018-13025.

[ArXiv] β€’ [Video Demos]

If you use this repository, please cite us πŸ™

@article{rajkumar2025real,
  title={Real-Time Linear MPC for Quadrotors on SE (3): An Analytical Koopman-Based Realization},
  author={Rajkumar, Santosh Mohan and Yang, Chengyu and Gu, Yuliang and Cheng, Sheng and Hovakimyan, Naira and Goswami, Debdipta},
  journal={IEEE Robotics and Automation Letters},
  volume={10},
  number={12},
  pages={13018--13025},
  year={2025},
  publisher={Institute of Electrical and Electronics Engineers Inc.}
}

πŸ”§ 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)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors