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.1.0.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.1.0-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pycddp-0.1.0-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.1.0-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

pycddp-0.1.0-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.1.0-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pycddp-0.1.0-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.1.0-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

pycddp-0.1.0-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.1.0-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.1.0.tar.gz.

File metadata

  • Download URL: pycddp-0.1.0.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.1.0.tar.gz
Algorithm Hash digest
SHA256 21f9844d9578838f83be64f86d470c335f713546ba0132c8882269251add0559
MD5 02116fb729fb74503888780d2d59e7c9
BLAKE2b-256 c7136c8321c9bf08f2e3b86efd7bcf7f7fa4fe70aba4ab7e572135f675e0ebc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0.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.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.1.0-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.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1b97b98f00290694263300144a19740365c5d9009d76411d469f251dbba22d30
MD5 04d7292225fa745bfa384cf101345fd2
BLAKE2b-256 148ca07798e6a774c53fc11cb18f6cd386533cbb2c59a6f077d1fb046f9620b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ab86231fca4b903ba99bc622602e7aca2c12f9bf8ea9805e8e24dd4fe3cb0916
MD5 49fd2a149d4d37eee72c3246de311332
BLAKE2b-256 623d75c934bd5c02b541e70755b95bc21317909cc69f4e1904acbe2e4786fb1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad66802a9882ba715741cffd71f2c3636ecf98eb93a025d2b46212803d57899d
MD5 3033a4bce1f470e8763b989da4e04a19
BLAKE2b-256 91d998fa652d7bec09baeda7094032a07d85706569084321545f5827636f20dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.1.0-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.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3034695cd60d79e30bb3946f048b604ec31c356a0e07d4c23ae9076147e09f9e
MD5 b6ade1609c03bbf9f847aca6bc874f7e
BLAKE2b-256 c5fb822bcc942e144854946067da7814f59f8f92bd0801812984619a6b4cb43a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 615cd42c69d1541fa8a0a9b5883b65dd3ac1f11a94fdcf0e3e57d723f0e132ca
MD5 2ed92eed68e3630e6fdd296f8972b69a
BLAKE2b-256 44962e9bec8c7421afdbeaf3bf4d41ad64cfbd4d7f48b1b712740d23bb7ec542

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e610fc02dba40859e61daa7f797524bf5865da9bc8a6dd8e6fd81e485e7620a1
MD5 f686ea0d17632f1a3791adea78df02c1
BLAKE2b-256 c382524f71597e2e2778c889e9cb6e6b594cdb5f13c63ba78bfd27e9af4c254d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.1.0-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.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e39a160d51e60821cbcbd9c8c366b71465411347438994e192744050d492a7b8
MD5 24b211a8e97e12460c9f5ddf051622a3
BLAKE2b-256 c9d51ac5337b8fd6f2195176f4edbdc62287a94256a97dd6a515e279bc39539a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 277bd2ea4c0c02770ff3e9db97849c18ae5a2c04d2bd421d35e70036d308457f
MD5 e6d88a283da4f32cac506bdd6b682c4d
BLAKE2b-256 423468be3f8f3987847f46702e3850c1110d881010969d651bde6f0336213485

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e3d2cc40c5ac74d3cd33f370583f126b9b2d71a6f546b9275401a10a8afbcca1
MD5 c0f535e04e055eac66c26ad7211fc0ea
BLAKE2b-256 7c70cb5e23753da497d3f6501d347ca3c83facc4d67aad11865c8a609605a45e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pycddp-0.1.0-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.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 41a20e623fc615260adfcbf6022c54741f3379358c518e24b360e508ed3a9d48
MD5 4eb360e01da25709a71220abca335f77
BLAKE2b-256 40650d6e80d5491026a196cfca9d4d760d5ab3f0fe27bffda87665f0b16b1869

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 805127f639f4b184b8a964b89ebd5c21fdb1bcf19bbf99df358da08828e50867
MD5 fa6f572d241255f3f5f3137645026916
BLAKE2b-256 a925e4915a5c72e0b2574abcf35f23b720dfa8a4fd23b6ae2574a5719ff39f2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycddp-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f03a8bcdd8efb0d1e57a31c2667b33eb96eb3dec53534b9a31a23cbbadb4880e
MD5 d143b0ebab275bbd5a1b7ffb7b05dcb7
BLAKE2b-256 030431867dc838ccba199dcc77d3c0962f09d4442490191d9dd03c025eb9fd50

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycddp-0.1.0-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