Coder Social home page Coder Social logo

gp-mpc's Introduction

MPC with Gaussian Process

A framework for using Gaussian Process together with Model Predictive Control for optimal control.

The framework has been implemented with the principles of being flexible enough to experiment with different GP methods, optimization of GP models. and using different MPC schemes and constraints. Examples provided are obstacle avoidance using an estimated GP model of the vehicle model in (Gao et al., 2011), and level control using a tank system model from (Raff et al., 2006).

The GP methods has been implemented using (Hewig et al., 2017) and (Deisenroth, 2011) as references while the MPC algorithm is a nonlinear stochastic MPC implementation based on (Rawlings et al., 2017), with probabilistic constraints given by (Hewig et al., 2017) . As a backbone in this framework lay CasADi, (Andersson et al., 2018), as a symbolic framework for large scale optimization.

For simulation this framework support the solvers provided by CasADi and Sundails, (Hindmarsh et al., 2005) for both ODEs (CVODES), and DEAs (IDEAS). In addition this framework has implemented a simple Runga-Kutta 4 (RK4) method in CasADi for faster computation of the optimal control problem.

As a model in the MPC algorithm it is possible to use an exact integrator from Sundails (CVODES, IDAS), RK4, GP, a hybrid model consisting of a GP estimating the dynamics and RK4 to integrate the kinematic equation based on the dynamic GP model, or a hybrid where the GP model estimates the noise and modeling error, similar to (Hewig et al., 2017).

This work was developed as a part of the master thesis Cautious MPC-based control with Machine Learning (Langåker, 2018).

Requirements

  • Python > 3.5
  • CasADi (tested with version 3.4)

alt text

gp-mpc's People

Contributors

helgeanl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gp-mpc's Issues

hybrid option (car_example)

Hi Helge-Andre, Thank you very much for sharing your framework, it's very inspiring.
I am particular to try your hybrid GP (GP model for dynamic equations, and RK4 for kinematic equations). I noticed in your code , you said "Missing kinematic states" (mpc_class.py line289) in the step of Hybrid output covariance matrix.
Will this affect the results?

Question about thesis

I have some questions about your thesis, but I couldn't find your email. Would you mind sending it to me?

[Bug] car_example.py raises LAPACK error

System


Windows 10
Python 3.7.0
SciPy 1.4.1

Problem


When I run python car_example.py, I get the traceback below. I understand that the issue may raise from different SciPy version. Any Idea how to solve it? An addition of the requirements.txt for stating which version of Scipy to use this with would be good, if a solution is not available. According to LAPACK documentation, the third argument is for precision so I first thought it was a SciPy bug but the function works as intended when used separately.

Traceback

** On entry to DGEBAL parameter number  3 had an illegal value
Traceback (most recent call last):
  File "car_example.py", line 223, in <module>
    methods = ['TA', 'ME'], num_cols=1, xnames=xnames)
  File "./..\gp_mpc\gp_class.py", line 775, in predict_compare
    K, S, E = lqr(A, B, Q, R)
  File "./..\gp_mpc\mpc_class.py", line 972, in lqr
    P = np.array(scipy.linalg.solve_discrete_are(A, B, Q, R))
  File "C:\Users\Admin\Anaconda3\envs\pirl\lib\site-packages\scipy\linalg\_solvers.py", line 675, in solve_discrete_are
    _, (sca, _) = matrix_balance(M, separate=1, permute=0)
  File "C:\Users\Admin\Anaconda3\envs\pirl\lib\site-packages\scipy\linalg\basic.py", line 1588, in matrix_balance
    ''.format(-info))
ValueError: xGEBAL exited with the internal error "illegal value in argument number 3.". See LAPACK documentation for the xGEBAL error codes.

problem with predict_compare function

Hi, thanks for sharing the code. I have a question for the function predict_compare in file gp_class.py. In the following figure, when I use if feedback:, the code goes wrong(At t = 0.00759683, mxstep steps taken before reaching tout.). How to solve this problem? Thank you very much!
image

question about training data

Hi, I read the code carefully. I am a little confused about training data. I check the training data. It seems that the X, Y generated by generate_training_data function doesn't have too much difference(see the following figure: X[:30, :3]- Y[:30, :3], the data is got from car_example.py file). Why do you generate the training data like that? If I replace it with (X, X+ random noise), doesn't it make any difference ? Thank you very much!

image

Typo in car model

For the car_example in main(and its equivalent in develop), the dynamics for second state in the dxdt are missing a delta in the last term
Code:
2*Cr*(x[1] - lf*x[2]) / (x[0] + eps))

Thesis:
image

f_hybrid option

Hi Helge-Andre,

Thank you very much for sharing your framework, it's very inspiring.

I am particular to try your hybrid implementation where GP estimating modeling errors. I noticed in your code , you said f_hybrid option is not finished implemented. I was wondering what do you mean here? Can I still use your framework to reproduce Hewing2017? Thanks.

Regards,
Jie

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.