Coder Social home page Coder Social logo

smidmatej / mpc_quad Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 3.0 86.64 MB

Model Predictive Controller for a quadcopter model using Acados nlp optimization

Python 6.44% Jupyter Notebook 78.75% C 14.06% Makefile 0.31% Cython 0.20% MATLAB 0.23%
acados casadi drone mpc mpc-control quadcopter

mpc_quad's Introduction

MPC control of quadcopter using Gaussian processes

Implementation of MPC controller for a quadrocopter model using python. This repository implements the framework as described in [1]

Using a python simulation, we tracked a trajectory using an MPC controller. The simulated quadcopter was subject to a quadratic air resistence term which the MPC prediction model does not have access to. This caused a difference between the predicted velocities and the actual velocities of the quadcopter.

$$\hat{a}{error} = \frac{v{true}-v_{\text{pred}}}{\Delta t}$$

Using a Gaussian process regression, we can fit the acceleration error in axis x to a velocity in x (and for y and z too). Regression allows us access to the mean function $m(v_x)$ and its variance $\text{var}(v_x)$. We use m(v_x) to predict drag acceleration experienced by the quadcopter.

$$\hat{a}_{\text{drag}_x} = m(v_x)$$

posterior_distribution_fit

Since the MPC controller uses Acados for its predictions, to augment the prediction model with the Gaussian process, we implement a casadi version of Gaussian process regression. This also allows us to compute a symbolic derivative of the GP predictions w.r.t velocity. posterior_distribution_fit

The Gaussian process allows us its predictions to make better predictions with the MPC controller, especially at higher velocities, where air resistance becomes more of a factor.

$$\ddot{\textbf{x}} = f(\textbf{x}) + \hat{ \textbf{a} }_{\text{drag}}$$

Using a MPC controller augmented with the Gaussian process, we are able to reach significantly higher speeds quadcopter_flight

References

[1] G. Torrente, E. Kaufmann, P. Föhn and D. Scaramuzza, "Data-Driven MPC for Quadrotors," in IEEE Robotics and Automation Letters, vol. 6, no. 2, pp. 3769-3776, April 2021, doi: 10.1109/LRA.2021.3061307.

mpc_quad's People

Contributors

smidmatej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.