Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Docs

on:
push:
branches: [master]
paths:
- "docs/**"
- "mkdocs.yml"
- ".github/workflows/pages.yml"
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
run: python -m pip install uv

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Build site
run: uvx --from mkdocs --with mkdocs-material mkdocs build --strict

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site

deploy:
name: Deploy docs
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
91 changes: 91 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Publish PyPI

on:
push:
tags:
- "v*"

permissions:
contents: read

jobs:
build-sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build frontend
run: python -m pip install build

- name: Build source distribution
run: python -m build --sdist

- name: Upload source distribution
uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz

build-wheels:
name: Build wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-*
CIBW_SKIP: *-musllinux_* *-win32
CIBW_ARCHS_LINUX: auto64
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS_MACOS: auto64

- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: dist-wheels-${{ matrix.os }}
path: wheelhouse/*.whl

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build-sdist, build-wheels]
permissions:
id-token: write
contents: read
environment:
name: pypi
url: https://pypi.org/p/pycddp

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true

- name: Publish distributions
uses: pypa/gh-action-pypi-publish@release/v1
70 changes: 70 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Wheel CI

on:
pull_request:
push:
branches: [master]
workflow_dispatch:

permissions:
contents: read

jobs:
build-sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build frontend
run: python -m pip install build

- name: Build source distribution
run: python -m build --sdist

- name: Upload source distribution
uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz

build-wheels:
name: Build wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-*
CIBW_SKIP: *-musllinux_* *-win32
CIBW_ARCHS_LINUX: auto64
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS_MACOS: auto64

- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: dist-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ solver_snopt.out
# Python / uv
.venv/
uv.lock
site/
*.egg-info/
__pycache__/
*.so
Expand Down
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.15)
# Set policy to support older CMake code
cmake_policy(SET CMP0048 NEW)
# Allow policy version minimum flag to be passed to sub-projects
set(CMAKE_POLICY_VERSION_MINIMUM "3.5" CACHE STRING "Minimum CMake version for policy compatibility")
set(CMAKE_POLICY_VERSION_MINIMUM "3.15" CACHE STRING "Minimum CMake version for policy compatibility")

project(
cddp
Expand All @@ -26,6 +26,7 @@ project(
)

include(GNUInstallDirs)
include(FetchContent)

set(CMAKE_CXX_STANDARD 17) # Enforce C++17 as the minimum standard
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Enforce C++17 as the minimum standard
Expand Down Expand Up @@ -92,9 +93,6 @@ if (CDDP_CPP_CASADI)
endif()
endif()

# Enable FetchContent for downloading dependencies
include(FetchContent)

# autodiff
set(AUTODIFF_BUILD_TESTS OFF CACHE BOOL "Don't build autodiff tests")
set(AUTODIFF_BUILD_EXAMPLES OFF CACHE BOOL "Don't build autodiff examples")
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ source .venv/bin/activate
pytest -q python/tests
```

### Docs preview

```bash
uvx --from mkdocs --with mkdocs-material mkdocs serve
```

## Pull requests

Before opening a pull request:
Expand All @@ -50,6 +56,9 @@ Before opening a pull request:
4. Update documentation when user-facing behavior, examples, or public APIs change.
5. Write a clear commit message and PR description.

Tagged releases publish Python artifacts to PyPI via GitHub Actions. The
project site deploys from `master` to GitHub Pages.

PRs that include a minimal reproduction, exact validation commands, and a concise explanation of the design tradeoffs are much easier to review.

## Issues
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,18 @@ sudo apt-get install libeigen3-dev # For Ubuntu
brew install eigen # For macOS
```

### Building
### Python package
Tagged releases publish the Python bindings to PyPI:

```bash
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
```bash
git clone https://github.com/astomodynamics/cddp-cpp
cd cddp-cpp
Expand All @@ -105,6 +116,13 @@ 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](https://github.com/astomodynamics/cddp_mpc). You do not need to install this library to use the package. MPC package will automatically install this library as a dependency.

Expand Down
32 changes: 32 additions & 0 deletions docs/cpp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# C++ build

The repository remains a first-class C++ library even when distributed through
PyPI for Python users.

## Core build

```bash
cmake -S . -B build
cmake --build build -j4
ctest --test-dir build --output-on-failure
```

## Python bindings from CMake

```bash
cmake -S . -B build-python -DCDDP_CPP_BUILD_PYTHON=ON -DCDDP_CPP_BUILD_TESTS=OFF -DCDDP_CPP_BUILD_EXAMPLES=OFF
cmake --build build-python -j4
```

## Installed C++ assets

The install rules export:

- `libcddp` and CMake package metadata
- public headers under `include/cddp-cpp/`
- the Python extension when `CDDP_CPP_BUILD_PYTHON=ON`

That lets the repository serve both as:

- a source build for C++ consumers
- the native backend for the `pycddp` wheel
34 changes: 34 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# CDDP

`cddp-cpp` is a constrained differential dynamic programming solver library with:

- a C++17 core library for trajectory optimization and MPC
- `pycddp` Python bindings built with `pybind11`
- a small animation-oriented Python portfolio for demos and regression checks

Use the navigation to get started with installation, local development, and
the release workflow for PyPI and GitHub Pages.

## Project scope

- C++ library: reusable solver and dynamical-system implementations
- Python package: importable bindings distributed as `pycddp`
- Docs site: Markdown content from `docs/`, published to GitHub Pages

## Quick start

Install the Python package from PyPI:

```bash
pip install pycddp
```

Or build from source:

```bash
git clone https://github.com/astomodynamics/cddp-cpp
cd cddp-cpp
cmake -S . -B build
cmake --build build -j4
ctest --test-dir build --output-on-failure
```
Loading
Loading