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{h}(\mathbf{x}_N)=0,;\mathbf{g}_N(\mathbf{x}_N)\leq 0 $$

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

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

For interior-point solves, IPDDP supports path inequalities, terminal equalities, terminal inequalities, and mixed path/terminal constrained problems with warm-started multiplier and slack state. In the C++ API, terminal constraints are attached with CDDP::addTerminalConstraint(...) and should use the built-in TerminalEqualityConstraint or TerminalInequalityConstraint classes.

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.

The portfolio currently emphasizes animated path-constrained examples. The terminal-constraint cases added to IPDDP are covered by the regression suite rather than by a dedicated gallery animation.

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.2.tar.gz (6.9 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.2-cp313-cp313-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.13Windows x86-64

pycddp-0.5.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

pycddp-0.5.2-cp313-cp313-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pycddp-0.5.2-cp312-cp312-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.12Windows x86-64

pycddp-0.5.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

pycddp-0.5.2-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pycddp-0.5.2-cp311-cp311-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.11Windows x86-64

pycddp-0.5.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

pycddp-0.5.2-cp311-cp311-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pycddp-0.5.2-cp310-cp310-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.10Windows x86-64

pycddp-0.5.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

pycddp-0.5.2-cp310-cp310-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pycddp-0.5.2.tar.gz
Algorithm Hash digest
SHA256 011165bd1684389cd85e78d7dd8190d7b46b53a8d85c850498eb317fa7010408
MD5 10c823d93e06464153c57e61368772e6
BLAKE2b-256 f83bec8421c580585eab747dbafaf73cb74d0b0528da7d59a5fe009b4f55896d

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for pycddp-0.5.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 107acb430cfadac3b70e7ee193af60dd2acb3243d1cf0950b23a5c567c37d6be
MD5 8e9a7a5c1ceabc6555aacf43180dd8fc
BLAKE2b-256 e4272348178b104f4532c8a2d6c0620315a4789a7e89ed94722820b32290cd94

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2808cff909bc39386d32d4a2b3109a1a7a44d162afc0ab0d6516282cf8ed92c4
MD5 0b046db2174b444faf067971d29c4af9
BLAKE2b-256 25f43fe9dcd3ce19ebe048703a2613541b4c21ade2f1ed9ed7a6a3f758a364d7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3bcdad5971b4f30be9d50ec01e716df4b4accc2e77ea06210d1c7ad8337d1f41
MD5 b19c58423fafc81a7ab85801a67f6b08
BLAKE2b-256 d7d95e1b33d46781f7c5adfb8c0a34798e84837f545565883a90cbd9a0a1fc1a

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for pycddp-0.5.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 459e2fc53827d381d28c9726f55b8f467e9452f8cd756b95e5252dba24d0a96f
MD5 6712dc69e6407bf3acf9221da4884897
BLAKE2b-256 1b6a97a8e84a76f9f80535a8e5fdf7a16067259573a4a3126715730e68cee9c5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56c25f6ad3a4acb09d43efd1faad2ac0508813e4b22221f572163cbc8f31f209
MD5 12b2e2d8453332d44a2738d5bde8f759
BLAKE2b-256 742b6f1dad6e0ec207204ceb43d08a13e559ac8c8a2e50baa16163eeafbf0b12

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3f0f07cfcc91ccf5c0604f3ef2af1f609f5f3d04e3bdf935b91ab6c1d4f57d7
MD5 3f8de28a339498bee274daa84a271e39
BLAKE2b-256 23dcfeac3d6dd169b9578e9079b9170f826787698a03ddea2a3aa2f1d67907f6

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for pycddp-0.5.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c531a102b8801635e54b070d33e705143c10bebba8ccff3c30804856f84db91a
MD5 4f3404f8c18dc6130e70577d64b50718
BLAKE2b-256 5374fee4ecd39efc448905bb13938b82e7dae27b8cd67808b26040912c93fb91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 280b91397c1fe46a0bf3445f95475af024c1c993dac41fa4b6cf15685114d147
MD5 6704c3a2c186c925a3256afa6a10859f
BLAKE2b-256 865dd9e11d4163f2dd3cd63fbfd12b3a559b2c6e90880de9c4352814827ba93f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c390db0d097aeffa926edd94c40f67e6c95b7df4c99136db70f1c735b5f6259
MD5 7d68af34a478ad24a23b8d4e095ea220
BLAKE2b-256 09fe8a2519cb60817316019fc8e02014bf567ca73331fb9e6f9bc98a674b3d9f

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for pycddp-0.5.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 22b701c23c7581862fc3f5f072592d0b8c32887f5fce99985c931fb81228238a
MD5 e11ac89ec707cb235ce155aa6151644f
BLAKE2b-256 2e60ae04d78b801e30b03a980a373369c72cea1e02485dd918a87955d66499e2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f8712d5a8a8d31ce92da352251cfabcf299ebdc2df072145bf150ac8436b4543
MD5 dd6943b3c99d3336c2271bbda435c538
BLAKE2b-256 ef529f48ca900377560b2343d632ba4ef2d3b661794c789afd5bf759897574dc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pycddp-0.5.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9dba3250e686eb23ea9fbb0e0ac260062806394c1135c6fc20d697f1757c2fc
MD5 af4366da34f27ab3783ba6e8ba205ad3
BLAKE2b-256 b7b28af68c1cae6732aed734a56fa69b9ffdb213b3e9eb59565f3457c481a089

See more details on using hashes here.

Provenance

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