Constrained Differential Dynamic Programming (CDDP) solver in C++
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 whenCDDP_CPP_BUILD_EXAMPLES=ON - the Python portfolio for plotting, animation, and notebook workflows
The kept C++ examples are:
cddp_pendulum.cppcddp_cartpole.cppcddp_unicycle.cppcddp_quadrotor_point.cppcddp_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:
Cart-pole swing-up:
Unicycle obstacle avoidance:
MPCC racing line tracking:
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
- CMake (Build System)
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:
- autodiff (MIT License)
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:
- CONTRIBUTING.md for setup, validation, and PR expectations
- CODE_OF_CONDUCT.md for community standards
- SECURITY.md for vulnerability reporting guidance
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
Metadata
Release files for pycddp 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycddp-0.5.2.tar.gz | 6.9 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pycddp-0.5.2-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| pycddp-0.5.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pycddp-0.5.2-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| pycddp-0.5.2-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| pycddp-0.5.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| pycddp-0.5.2-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
| pycddp-0.5.2-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| pycddp-0.5.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pycddp-0.5.2-cp311-cp311-macosx_11_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ ARM64 | Details |
| pycddp-0.5.2-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| pycddp-0.5.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pycddp-0.5.2-cp310-cp310-macosx_11_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 11.0+ ARM64 | Details |
Total release size: 34.3 MB
Release files / pycddp-0.5.2.tar.gz
| Download URL | pycddp-0.5.2.tar.gz |
|---|---|
| Size | 6.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
011165bd1684389cd85e78d7dd8190d7b46b53a8d85c850498eb317fa7010408
|
|
BLAKE2b-256 checksum How to use checksums |
f83bec8421c580585eab747dbafaf73cb74d0b0528da7d59a5fe009b4f55896d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp313-cp313-win_amd64.whl
| Download URL | pycddp-0.5.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
107acb430cfadac3b70e7ee193af60dd2acb3243d1cf0950b23a5c567c37d6be
|
|
BLAKE2b-256 checksum How to use checksums |
e4272348178b104f4532c8a2d6c0620315a4789a7e89ed94722820b32290cd94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pycddp-0.5.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2808cff909bc39386d32d4a2b3109a1a7a44d162afc0ab0d6516282cf8ed92c4
|
|
BLAKE2b-256 checksum How to use checksums |
25f43fe9dcd3ce19ebe048703a2613541b4c21ade2f1ed9ed7a6a3f758a364d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pycddp-0.5.2-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3bcdad5971b4f30be9d50ec01e716df4b4accc2e77ea06210d1c7ad8337d1f41
|
|
BLAKE2b-256 checksum How to use checksums |
d7d95e1b33d46781f7c5adfb8c0a34798e84837f545565883a90cbd9a0a1fc1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp312-cp312-win_amd64.whl
| Download URL | pycddp-0.5.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
459e2fc53827d381d28c9726f55b8f467e9452f8cd756b95e5252dba24d0a96f
|
|
BLAKE2b-256 checksum How to use checksums |
1b6a97a8e84a76f9f80535a8e5fdf7a16067259573a4a3126715730e68cee9c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pycddp-0.5.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
56c25f6ad3a4acb09d43efd1faad2ac0508813e4b22221f572163cbc8f31f209
|
|
BLAKE2b-256 checksum How to use checksums |
742b6f1dad6e0ec207204ceb43d08a13e559ac8c8a2e50baa16163eeafbf0b12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pycddp-0.5.2-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f3f0f07cfcc91ccf5c0604f3ef2af1f609f5f3d04e3bdf935b91ab6c1d4f57d7
|
|
BLAKE2b-256 checksum How to use checksums |
23dcfeac3d6dd169b9578e9079b9170f826787698a03ddea2a3aa2f1d67907f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp311-cp311-win_amd64.whl
| Download URL | pycddp-0.5.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c531a102b8801635e54b070d33e705143c10bebba8ccff3c30804856f84db91a
|
|
BLAKE2b-256 checksum How to use checksums |
5374fee4ecd39efc448905bb13938b82e7dae27b8cd67808b26040912c93fb91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pycddp-0.5.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
280b91397c1fe46a0bf3445f95475af024c1c993dac41fa4b6cf15685114d147
|
|
BLAKE2b-256 checksum How to use checksums |
865dd9e11d4163f2dd3cd63fbfd12b3a559b2c6e90880de9c4352814827ba93f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pycddp-0.5.2-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5c390db0d097aeffa926edd94c40f67e6c95b7df4c99136db70f1c735b5f6259
|
|
BLAKE2b-256 checksum How to use checksums |
09fe8a2519cb60817316019fc8e02014bf567ca73331fb9e6f9bc98a674b3d9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp310-cp310-win_amd64.whl
| Download URL | pycddp-0.5.2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
22b701c23c7581862fc3f5f072592d0b8c32887f5fce99985c931fb81228238a
|
|
BLAKE2b-256 checksum How to use checksums |
2e60ae04d78b801e30b03a980a373369c72cea1e02485dd918a87955d66499e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pycddp-0.5.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f8712d5a8a8d31ce92da352251cfabcf299ebdc2df072145bf150ac8436b4543
|
|
BLAKE2b-256 checksum How to use checksums |
ef529f48ca900377560b2343d632ba4ef2d3b661794c789afd5bf759897574dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency logRelease files / pycddp-0.5.2-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pycddp-0.5.2-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e9dba3250e686eb23ea9fbb0e0ac260062806394c1135c6fc20d697f1757c2fc
|
|
BLAKE2b-256 checksum How to use checksums |
b7b28af68c1cae6732aed734a56fa69b9ffdb213b3e9eb59565f3457c481a089
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.
Transparency log