autogenu-jupyter
An automatic code generator and the continuation/GMRES (C/GMRES) based numerical solvers for nonlinear MPC
|
This project provides the continuation/GMRES method (C/GMRES method) based solvers for nonlinear model predictive control (NMPC) and an automatic code generator for NMPC, called AutoGenU
.
The following C/GMRES based solvers are provided:
MultipleShootingCGMRESSolver
: The multiple shooting based C/GMRES method with condensing of the state and costate directions.SingleShootingCGMRESSolver
: The original C/GMRES method (single shooting).ocp.hpp
, main.cpp
, and CMakeLists.txt
by AutoGenU.ipynb
)AutoGenU.ipynb
)Please confirm that you clone this repository as
Otherwise, please do the following command:
The python modules can be installed via
AutoGenU.ipynb
generates the following source files under your setting state equation, constraints, cost function, and parameters:
ocp.hpp
: A definition of the optimal control problem (OCP).main.cpp
: An executablb of the closed-loop simulation.CMakeLists.txt
: Scripts to build C++ projects.python
directory : Source files of Python interface via pybind11.You can generate these files, run simulations, plot results, and install the Python interfaces through AutoGenU.ipynb
.
Python bindings are installed via .ipynb
files. To use the installed Python bindings, set PYTHONPATH
as
Then you can use python interfaces as
cgmres
C++ libraryAside from the notebook for the code-generation, the C++ cgmres
library, which is a header-only library, can be installed by running
at the project root directory of autogenu-jupyter
.
Then you can build the NMPC code with the generated ocp.hpp
file and without .ipynb
notebook files.
The examples are found in examples/cpp
directory.
autogenu
Python moduleThe pythton module autogenu
can be instatlled by running
at the project root directory of autogenu-jupyter
. Further, if you install have installed header-only cgmres
C++ library as step 4, then you can run .ipynb
files for the code generation in everywhere.
C++ API documentation of cgmres
library is found at https://mayataka.github.io/autogenu-jupyter/.
Python interfaces are almost the same as the C++ API, so please refere to https://mayataka.github.io/autogenu-jupyter/ even for Python interfaces as well as the tips for conversions between C++ and Python.
Demos are presented in cartpole.ipynb
, pendubot.ipynb
, hexacopter.ipynb
, and mobilerobot.ipynb
. You can obtain the following simulation results jusy by runnig these .ipynb
files. The details of the each OCP formulations are described in each .ipynb
files.
MIT
We'd appriciate if you use cite the following conference paper: