Skip to main content

A Python implementation of the adaptive Koopman model predictive control algorithm

Project description

adaptive-kmpc-py

This is a Python implementation of the adaptive Koopman model predictive control (KMPC) algorithm, proposed in https://arxiv.org/abs/2503.17902 (currently under review).

An equivalent Julia implementation can be found in the official paper repository.

Adaptive KMPC algorithm

The controller allows approximating nonlinear system dynamics from experimental data as a linear system, which is then embedded in a convex model predictive controller. This eliminates the need for determining a dynamic model via first principles. Additionally, the model is updated online from the closed-loop feedback, which enables control of systems with varying dynamic parameters.

The algorithm is explained in depth in the linked paper, and verified with real-system control experiments on a 1R and 2R robot system. To ensure understanding of the code, variable names are chosen according to the notation used in the paper.

The following process schematic may help in getting a quick overview of the algorithm and the code.

adaptive_KMPC_scheme
  • For initial model build the controller relies on availability of data that partly capture the underlying system dynamics. These data can be obtained by perturbing the system with a sequence of random controls and recording the system response, which is denoted as preceding experiment.
  • Data are then used to fill a circular buffer, operatin under first-in-first-out logic.
  • Subsequently, Extended Dynamic Mode Decomposition is carried out on the buffer data (for more detailed explanation you can consult the paper), leading to a linear model in the discrete time domain.
  • Casting the linear model in a convex quadratic program along with some reference trajectory, constraints, and feedback on the current state allows solving for an optimal control input that is applied to the system.
  • The system response, along with the applied control are fed back into the circular buffer, such that the model adapts to the current operating point.

Installation

You can install the latest version from GitHub:

pip install git+https://github.com/adrianodelr/adaptive-kmpc-py.git

Or via the package manager:

pip install adaptive-kmpc-py

Basic Usage

For understanding basic usage, you can have a look at the Jupyter notebooks:

Both demonstrate simulated tracking control of serial robots.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adaptive_kmpc_py-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adaptive_kmpc_py-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file adaptive_kmpc_py-0.1.0.tar.gz.

File metadata

  • Download URL: adaptive_kmpc_py-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

File hashes

Hashes for adaptive_kmpc_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51649afb86a7acdcb5fafd1f5eeb81d66c4f1dcbe27a97dbd5ff71f10506f80e
MD5 846a4aec83b4c15e7c5c1c258f41bffb
BLAKE2b-256 76e801d267e38d7438e4bbebcc2151ef9352d165aa68a19d4a15a0ffb2ee465d

See more details on using hashes here.

File details

Details for the file adaptive_kmpc_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: adaptive_kmpc_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

File hashes

Hashes for adaptive_kmpc_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 967d34ca774c067a448c1bf1159ee528149c35087793f74789146e9bd0ea0e58
MD5 00f80dec493b082fafdc59258537f1a9
BLAKE2b-256 5b8cc5aadfc919e7807c6ab639c48b4f566f5d07ebfe8eaf58f75e48c93af1da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page