Skip to main content

Python bindings for CDDP trajectory optimization

Project description

Constrained Differential Dynamic Programming (CDDP) solver in C++

CDDP IN CPP

This repository contains a C++ implementation of constrained differential dynamic programming (CDDP) and related solvers for trajectory optimization and model predictive control.

Overview

This is an optimal control solver library using constrained differential dynamic programming (CDDP) written in C++. This library is particularly useful for mobile robot trajectory optimization and model predictive control (MPC).

The CDDP library solves problems in the form:

$$ \min_{\mathbf{U}} J(\mathbf{x}_0, \mathbf{U}) = \phi(\mathbf{x}_N) + \sum \ell(\mathbf{x}_k,\mathbf{u}_k) $$

$$ \mathrm{s.t.~} \mathbf{x}_{k+1} = \mathbf{f}(\mathbf{x}_k,\mathbf{u}_k) $$

$$ \quad \mathbf{g}(\mathbf{x}_k,\mathbf{u})_k\leq 0 $$

$$ \quad {\mathbf{x}}_{0} = \mathbf{x}{(t_0)} $$

$$ \quad k = 0,1,\cdots N-1 $$

Examples

The maintained example surface is now split:

  • a small C++ reference set in examples/, built when CDDP_CPP_BUILD_EXAMPLES=ON
  • the Python portfolio for plotting, animation, and notebook workflows

The kept C++ examples are:

  • cddp_pendulum.cpp
  • cddp_cartpole.cpp
  • cddp_unicycle.cpp
  • cddp_quadrotor_point.cpp
  • cddp_manipulator.cpp

The wider historical C++ example inventory has been removed to keep the example surface focused. The kept C++ examples are intentionally minimal and do not depend on visualization libraries.

Python Portfolio

The Python bindings now ship with a small animation-focused portfolio built on top of the same solver models used by the C++ examples:

source .venv/bin/activate
python examples/python_portfolio.py --demo all

This generates GIFs under docs/assets/python_portfolio/ for:

  • pendulum swing-up
  • cart-pole swing-up
  • unicycle obstacle avoidance
  • full-lap MPCC racing line tracking

See docs/python_portfolio.md for the gallery and regeneration command.

Pendulum swing-up: Python pendulum swing-up portfolio demo

Cart-pole swing-up: Python cart-pole swing-up portfolio demo

Unicycle obstacle avoidance: Python unicycle obstacle avoidance portfolio demo

MPCC racing line tracking: Python MPCC racing line portfolio demo

The MPCC portfolio example is a lightweight kinematic contouring-control demo. Its vendored track data in examples/data/ is derived from the alexliniger/MPCC project.

Installation

Dependencies

sudo apt-get install cmake # For Ubuntu
brew install cmake # For macOS
  • Eigen (Linear Algebra Library in CPP)
sudo apt-get install libeigen3-dev # For Ubuntu
brew install eigen # For macOS

Python package

Tagged releases publish the Python bindings to PyPI:

pip install pycddp

Prebuilt wheels are intended for CPython 3.10-3.13 on Linux, macOS, and Windows. If a wheel is not available for your platform yet, install from source using the steps below.

Building from source

git clone https://github.com/astomodynamics/cddp-cpp
cd cddp-cpp
mkdir build && cd build
cmake ..
make -j4
make test

Documentation

The project site is published through GitHub Pages at:

https://astomodynamics.github.io/cddp-cpp/

The Pages workflow builds the Markdown docs from docs/ using MkDocs.

ROS

If you want to use this library for ROS2 MPC node, please refer CDDP MPC Package. You do not need to install this library to use the package. MPC package will automatically install this library as a dependency.

References

  • Y. Tassa, N. Mansard and E. Todorov, "Control-limited differential dynamic programming," 2014 IEEE International Conference on Robotics and Automation (ICRA), 2014, pp. 1168-1175, doi: <10.1109/ICRA.2014.6907001>.
  • Pavlov, A., Shames, I., and Manzie, C., “Interior Point Differential Dynamic Programming,” IEEE Transactions on Control Systems Technology, Vol. 29, No. 6, 2021, pp. 2720–2727.
  • Liniger, A., Domahidi, A., and Morari, M., “Optimization-based autonomous racing of 1:43 scale RC cars,” Optimal Control Applications and Methods, 2015. doi: <10.1002/oca.2123>.

Third Party Libraries

This library uses the following open-source libraries as core dependencies:

This library also uses the following open-source libraries for optional features:

Citing

If you use this work in an academic context, please cite this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Collaboration

Contributions are welcome.

Start with:

Use GitHub issues for bug reports and feature requests, and open pull requests against master.

TODO

  • improve python binding ergonomics
  • improve parallelization
  • add simulation examples and Python visualizations
    • Quadruped robot
    • Manipulator
    • Humanoid

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

pycddp-0.5.1.tar.gz (4.0 MB view details)

Uploaded Source

Built Distributions

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

pycddp-0.5.1-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pycddp-0.5.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pycddp-0.5.1-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pycddp-0.5.1-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pycddp-0.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pycddp-0.5.1-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pycddp-0.5.1-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pycddp-0.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pycddp-0.5.1-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pycddp-0.5.1-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pycddp-0.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pycddp-0.5.1-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pycddp-0.5.1.tar.gz.

File metadata

  • Download URL: pycddp-0.5.1.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycddp-0.5.1.tar.gz
Algorithm Hash digest
SHA256 6ec78d18706b712d0f50038a2150efda022a10b670e4dc1ce31b597572ed04c2
MD5 37ea5ff34672defde4679289b5d331a8
BLAKE2b-256 b0480bd0e10b62327478d3a353bb88259c3b068125dc75dde3da44117dc1d54d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1.tar.gz:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.5.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycddp-0.5.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 07f8a5c76bff69c338a190908b2faaccd1fbc704a6d1d92bf80c26223a11df21
MD5 d0b2f0ede09ac56540bba3a3a33fdbf5
BLAKE2b-256 4e97550b97c3cc06beae4ccdd55e7f95503b060e411ccb2a3a7a29d894109e9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 71053398e8753248ab7262617f477a87eac221ea5ae09af153c6f502c4af48d4
MD5 ec8c804e70d8613728a13b09dbf60be8
BLAKE2b-256 bbf6af0cb44c5d9bc735a01f6375e6ee9c0b8cd7e866cf5b490215e305017229

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77ec1d619da5fcd7e4d764fb93b7cbedf72e4651fef9ae48b0d2eb3eb4d31955
MD5 46fa47aa09e709a9b8e7e0964be47ca2
BLAKE2b-256 dd99e3913a314e21b1962a84e9cb78afc9668c26dc77f3d9150e9e408dec61b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.5.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycddp-0.5.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 03987d9c911673b2066313b7da73774d7cff354e557512d14084f267f417bb8c
MD5 f72353f193105972e1b9579a307b9ade
BLAKE2b-256 93ccfa93a19c5cf574fb0b4c46e6b553a0dcf52ab782336886f564dab889c8a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db534fa86fa2e65fba4435532e3590384b9094c3f587c69ce9147afeb25747bb
MD5 2513896ad67774e97b62a3e09df11bd0
BLAKE2b-256 c171033399dc29df23181ba3768bd33f628a13ad757df1ce5cdfdade67fcdbd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c063cd6b23d38836dd4650a7e7cd445caebf8132b772bdd33611d807bd7df7a7
MD5 d8c657c41c86e6fc1d5b0b1948bce853
BLAKE2b-256 0b0fa3cd3e3599d5b63b63579affaa08287680253feebbcb4818b36447e92091

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.5.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycddp-0.5.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ab545a519893b96020d65a3d23c4e227556067312dfedcaab62dd535f539aa04
MD5 56124aecc286dbef4c4e9b62cbd7cb10
BLAKE2b-256 461c506dce3d26711ed87bcfff7f1b883319cf40ae10c8b93684a06c68861f7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d6e887d7d8961e435bed2f6aa8480240b614ccb61a7b4fd87dc74064b088f24b
MD5 336f861a0bd0eb8f502750eb9eff1139
BLAKE2b-256 9d6fd5da492b19da2af660c1261976a67417d3e55faad8c843fed9c5da363a77

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bea204f08da04839b7e4c2dd29b95ff8644117917a4db314129b6929e1ce2a77
MD5 feeb51bdd2f671ab6172790dfcaf673b
BLAKE2b-256 a0138b85991d5f0d24a96ea59f7d39100eb9c3fb27d414609e4f574a290519ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.5.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycddp-0.5.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 85d2d73ec574439b17665e61f3c59b7c522aa57715efa828331136917ac47822
MD5 d5f869d2836657a9611bc51a47ca67c5
BLAKE2b-256 0a717fafad82ec1a3dbe8197b5c2f10f5e3b35f01410f076e39e151da8b7c884

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15e80c4817497317bd7dcf122fc815e5d341556130e46d7745e584ed80aef66c
MD5 de6d4a141ceb7fddeb2701e812af40ec
BLAKE2b-256 8609db539ac8780e101e6aa32dcd3e22e19320f7eb6be6a69b4d4a00d927699e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycddp-0.5.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.5.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9994434166219d7275dfc837c2e4e888b3358632cfe80334a5c5f23d17d5e83b
MD5 e90d13dc373d23e99d531959a9ae8a10
BLAKE2b-256 ff6e59edd2648c40712840b1afe1e3aa4f9c2f8f97692d9761fdf460c2f717d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.5.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on astomodynamics/cddp-cpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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