Skip to main content

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 applied controls and the measured system response 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

Usage

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

Both demonstrate simulated tracking control of serial robots.

Metadata

Release files for adaptive-kmpc-py 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adaptive-kmpc-py 0.1.1
File Size Uploaded Provenance Actions
adaptive_kmpc_py-0.1.1.tar.gz 5.0 kB Without provenance Details for adaptive_kmpc_py-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adaptive-kmpc-py 0.1.1
File Interpreter ABI Platform Actions
adaptive_kmpc_py-0.1.1-py3-none-any.whl Python 3 none any Details for adaptive_kmpc_py-0.1.1-py3-none-any.whl

Total release size: 11.0 kB

Release files / adaptive_kmpc_py-0.1.1.tar.gz

Download URL adaptive_kmpc_py-0.1.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
33a8f113b9a648930693ebc054b332de106e32495e36d83edf34fc72c7f717b6
BLAKE2b-256 checksum
How to use checksums
fde61734a30d5ee5fddc2ab635371bee0123f1689d835c3526fe6dedf98ba51d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

Release files / adaptive_kmpc_py-0.1.1-py3-none-any.whl

Download URL adaptive_kmpc_py-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e784c11695c8ae6949828b295b1ce002204aaa1e51e9d855be26fd96d04a1f0f
BLAKE2b-256 checksum
How to use checksums
c205c4440c38f5a99e2d9a0428423895339261a57d937a71b2c1c8c57c7abe50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

Security for adaptive-kmpc-py 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page