/autompc

Automatic Tuning for Data-driven Model Predictive Control

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Welcome to AutoMPC, a library for automating system identification and model predictive control. AutoMPC can

  • Build SystemID models and Controllers
  • Evaluate and compare models and controllers
  • Tune controllers without requiring interactive access to the system
  • Provides a variety of controllers and optimizers

To see AutoMPC in action, check out this example Open In Colab.

NOTE: we are doing a lot of development on the 0.2-dev Github branch and it is mostly stable. We plan to release it soon, and it has major API changes so please switch over as soon as you can!

Why AutoMPC?

System ID and Model Predictive Control are powerful tools for building robot controllers, but getting them up and running can take a lot of engineering work. Achieving good performance typically requires careful selection of a number of hyperparameters, including the MPC horizon, the terms of the objective function, and the parameters of the System ID algorithm. AutoMPC automates the selection of these hyperparameters and provides a toolbox of algorithms to choose from.

How does AutoMPC work?

AutoMPC tunes hyperparameters for the System ID, Control Optimizer, and objective function using a dataset collected offline. In other words, AutoMPC does not need to interact with the robot during tuning. This is accomplished by initially training a surrogate dynamics model. During tuning, the surrogate dynamics are then used to simulate candidate controllers in order to evaluate closed-loop performance.

For more details, see our paper

How to use AutoMPC?

Check out our main example Open In Colab to see an overview of the AutoMPC workflow.

If you are interested, check out our detailed examples for more information on how to use the different parts of AutoMPC.

What algorithms does AutoMPC support?

For System ID, AutoMPC supports

For control optimization, AutoMPC supports

AutoMPC is also extensible, so you can use our tuning process with your own System ID and control methods. We'd also welcome contributions of new algorithms to the package.

Installation

  1. Clone the repository
  2. Install PyTorch
  3. (Optional) For certain benchmarks to work, install OpenAI gym and Mujoco
  4. (Optional) To use DirectTranscriptionController, install IPOPT solver and cyipopt binding. See instructions
  5. Run pip install -r requirements.txt
  6. Run pip install -e .

Documentation

Python API Reference.

The documentation can also be built offline. This requires Sphinx to be installed, which can be done by running

pip install sphinx

To build or re-build the documentation, run the following command from the docs/ subdirectory.

make html

The documentation will be produced in docs/html.