Skip to main content

SSQP

CI PyPI License: BSD 3-Clause C++17 Python 3.10+

SSQP is a structure-exploiting Sequential Quadratic Programming (SQP) solver for nonlinear optimal control problems. It is designed for trajectory generation and real-time Model Predictive Control (MPC), with native support for manifold-valued states such as floating-base orientations.

SSQP solves problems of the form

$$ \begin{aligned} \min_{x,u}\quad &\sum_{k=0}^{H-1} \ell_k(x_k,u_k) + \ell_H(x_H) \cr \text{subject to}\quad &x_{k+1}=f_k(x_k,u_k), &&0\leq k < H, \cr &c_k(x_k,u_k)\geq 0, &&0\leq k < H, \cr &c_H(x_H)\geq 0. \end{aligned} $$

At every SQP iteration, SSQP linearizes the dynamics and constraints and quadratizes the costs to form a stagewise, banded Quadratic Program (QP). A line search uses the QP solution to update the nonlinear trajectory.

The full documentation is available on the documentation site, including the installation guide, Python quickstart, concepts, examples, and generated Python and C++ API references.

Features

  • Structure-exploiting SQP for finite-horizon optimal control.
  • Euclidean and manifold-valued state components.
  • Custom or predefined dynamics, costs, constraints, and terrain models.
  • Kinematics, ForwardDynamics, InverseDynamics, and ReducedInverseDynamics formulations.
  • ADMM QP solver by default, with optional HPIPM/BLASFEO and PIQP support.
  • Receding-horizon MPC with warm starts and bounded per-step iteration counts.
  • C++17 library and Python bindings through nanobind.
  • Deterministic regression, finite-difference, and sanitizer-enabled tests.

Repository layout

Path Contents
include/, src/ C++ library headers and implementation
python/ ssqpy Python bindings
examples/trajgen/ Offline trajectory-generation examples
examples/mujoco_mpc/ MPC examples using MuJoCo
examples/real_mpc/ MPC examples for real systems
benchmarks/ Solver and formulation benchmarks
examples/visualizer/ Trajectory visualization utilities
examples/models/ Custom model implementations and utilities
examples/assets/ URDF and MJCF model assets
tests/ Unit, regression, gradient, and sanitizer test infrastructure
external/ Repository-vendored dependencies such as JSON and Tracy
cmake/ Dependency and packaging build logic

Installation

Prebuilt wheels are available for Linux x86_64 and Python 3.10 or newer:

pip install ssqp

The package provides the ssqpy module. The wheels require a CPU with AVX2 and FMA (Intel Haswell, AMD Excavator or newer). On older CPUs, importing ssqpy fails with an illegal instruction error, so build from source instead, as described below.

Dependencies

The default source build requires:

  • A C++17 compiler
  • CMake 3.22 or newer
  • Eigen3
  • Boost headers and static Filesystem and Serialization archives, when available. If the headers or either static archive is unavailable, CMake fetches the matching Boost sources and builds PIC static archives automatically.
  • Git and network access for the first build
  • Python 3.10 or newer and NumPy when Python bindings are enabled

Pinocchio and its URDF parser dependencies are fetched and built by CMake. Nanobind is fetched when the Python bindings are enabled. HPIPM and BLASFEO are fetched only when SSQP_WITH_HPIPM=ON. PIQP is fetched only when SSQP_WITH_PIQP=ON, along with BLASFEO if HPIPM is off.

Clone the repository with its submodules:

git clone --recurse-submodules https://github.com/upatras-lar/ssqp.git
cd ssqp

Building

Configure and build from the repository root:

cmake -S . -B build
cmake --build build -j"$(nproc)"

The first build compiles the pinned external dependencies and can take some time. Reusing the same build directory keeps those dependencies incremental; subsequent builds rebuild only targets affected by changed source files.

The default configuration builds the Python bindings and tests. The compiled library is placed under build/lib, the Python module under build/bindings, and the test runner under build/tests.

The Boost components used by Pinocchio are always linked statically. The ssqpy extension still uses the normal platform C and C++ runtime libraries, but it does not depend on shared Boost, Pinocchio, URDF, HPIPM, or BLASFEO libraries. Verify this for a completed build with:

cmake --build build --target verify-static-dependencies

CMake options

Pass options during configuration with -DNAME=VALUE:

Option Default Description
SSQP_WITH_HPIPM ON Build and enable the HPIPM/BLASFEO QP backend
SSQP_WITH_PIQP ON Build and enable the PIQP QP backend
SSQP_PIQP_OPENMP OFF Build PIQP with OpenMP for its parallel multistage solver
SSQP_BUILD_PYTHON ON Build the ssqpy Python module
SSQP_BUILD_TESTS ON Build the unit and regression tests
SSQP_BUILD_EXAMPLES OFF Build the C++ trajectory-generation examples
SSQP_ENABLE_PROFILING OFF Enable Tracy profiling support
SSQP_DISABLE_LOGGING OFF Compile out SSQP logging
SSQP_ENABLE_SANITIZERS OFF Enable AddressSanitizer and UndefinedBehaviorSanitizer
SSQP_BOOST_VERSION 1.86.0 Boost release fetched when no system Boost headers are available
SSQP_MARCH_NATIVE ON Compile SSQP and Pinocchio with -march=native
SSQP_ARCH_FLAG empty Architecture flag used instead when SSQP_MARCH_NATIVE is OFF, e.g. -march=x86-64-v3
SSQP_BLASFEO_AUTO_TARGET ON Let BLASFEO pick its kernels for the build machine
SSQP_BLASFEO_TARGET GENERIC BLASFEO target used when SSQP_BLASFEO_AUTO_TARGET is OFF, e.g. X64_INTEL_HASWELL

For example, to build with the C++ examples:

cmake -S . -B build -DSSQP_BUILD_EXAMPLES=ON
cmake --build build -j"$(nproc)"

By default the build uses -march=native and lets BLASFEO pick its kernels for the build machine, so generated binaries and prebuilt dependency packages are tied to the architecture on which they were built. To build binaries that run on other machines, turn off SSQP_MARCH_NATIVE and SSQP_BLASFEO_AUTO_TARGET, and set SSQP_ARCH_FLAG and SSQP_BLASFEO_TARGET to the oldest CPU family you want to support. The PyPI wheels use the settings in cmake/WheelConfig.cmake.

Prebuilt dependencies

Pinocchio and, when enabled, HPIPM/BLASFEO and PIQP can be supplied as prebuilt packages instead of being compiled from source:

cmake -S . -B build \
  -DSSQP_PREBUILT_PINOCCHIO_DIR=/path/to/prebuilt/pinocchio \
  -DSSQP_PREBUILT_HPIPM_DIR=/path/to/prebuilt/hpipm \
  -DSSQP_PREBUILT_PIQP_DIR=/path/to/prebuilt/piqp
cmake --build build -j"$(nproc)"

On a machine that has already built the dependencies from source, create the packages with:

cmake --build build --target package-pinocchio
cmake --build build --target package-hpipm
cmake --build build --target package-piqp

The resulting packages are written to build/prebuilt/pinocchio, build/prebuilt/hpipm and build/prebuilt/piqp. They must match the target compiler, architecture, and CPU features. The PIQP package only holds BLASFEO when built with SSQP_WITH_HPIPM=OFF, so a package made with HPIPM on only works for builds that also have HPIPM on.

C++ library

Each GitHub release provides prebuilt C++ packages for Linux x86_64 with the same CPU requirements as the wheels: a .deb for Ubuntu 22.04 and 24.04, and a .tar.gz archive for other distributions. On Ubuntu:

sudo apt install ./libssqp-dev_*-ubuntu24.04_amd64.deb

To install your own build instead, install the static library, its headers, and a CMake package into a prefix:

cmake --install build --component cpp --prefix ~/.local

Other CMake projects can then find it and link the ssqp::ssqp target:

find_package(ssqp REQUIRED)
target_link_libraries(my_app PRIVATE ssqp::ssqp)

SSQP can also be added to a project with FetchContent or add_subdirectory, which provide the same ssqp::ssqp target. Tests and Python bindings are then off by default. See the installation guide for details.

Python bindings

Install the built module into the Python environment selected by CMake:

cmake --install build --component python
python -c "import ssqpy; print('ssqpy imported successfully')"

For a build-local setup, use PYTHONPATH instead:

export PYTHONPATH="$PWD/build/bindings:$PYTHONPATH"
python -c "import ssqpy; print('ssqpy imported successfully')"

The examples provide a helper that sets this path:

cd examples
source setup_env.sh
python trajgen/python/di.py

The di.py example defines a double-integrator dynamics model and quadratic tracking cost, constructs an ssqpy.model.Model, and solves it with ssqpy.solvers.ssqp. Custom dynamics subclass ssqpy.model.dynamics.StageDynamics; custom costs subclass ssqpy.model.costs.StageCost.

Solvers and MPC

The default QP backend is SSQP's ADMM implementation. HPIPM can be selected as such, provided the build includes it:

params = ssqpy.solvers.ssqpParams()
params.qp_solver_type = ssqpy.solvers.QPSolverType.HPIPM
solver = ssqpy.solvers.ssqp(model, params)

PIQP is selected the same way, with QPSolverType.PIQP. It does not provide the feedback gains returned by MPC.feedbackGain.

For receding-horizon control, ssqpy.solvers.MPC repeatedly solves the OCP with a small iteration budget, applies the first control, feeds back the current state, and warm-starts the next solve:

mpc = ssqpy.solvers.MPC(model, sqp_iters=5, qp_iters=50)
mpc.reinitialize(initial_state)

while running:
    state = read_state()
    x, u = mpc.step(state)
    apply_control(u.stage(0))

See the MPC concept guide and examples/mujoco_mpc/ for complete control loops.

Examples

The examples README describes the available examples. They cover offline trajectory generation, simulated MPC, real-system MPC, adaptive pendulum models, benchmarks, and trajectory visualization.

The documentation includes walkthroughs for:

  • Pendubot swing-up
  • Panda circle trajectory generation
  • Go2 jumping with contact scheduling
  • Panda circle tracking with MuJoCo MPC

Testing

Build and run the standard test suite:

cmake -S . -B build
cmake --build build --target run_tests -j"$(nproc)"
ctest --test-dir build --output-on-failure -j"$(nproc)"

CTest discovers each test case separately, so a crash or timeout in one case does not prevent the remaining cases from running. To run a subset directly:

build/tests/run_tests --list
build/tests/run_tests --filter Regression_
build/tests/run_tests --filter gammafGradTest --seed 42

Failed test diagnostics are written to tests/logs/<test-name>.txt. See tests/README.md for the correctness coverage, deterministic seeding, finite-difference checks, sanitizer builds, and leak-detection notes.

Authors

SSQP is being developed at the Laboratory of Automation and Robotics (LAR) of the University of Patras by:

Citing

If you use SSQP in your work, please cite it as

@misc{karydakis2026ssqp,
  author       = {Karydakis, Nick and Chatzilygeroudis, Konstantinos},
  title        = {{SSQP: A Structure-Exploiting Sequential Quadratic Programming Solver}},
  year         = {2026},
  howpublished = {\url{https://github.com/upatras-lar/ssqp}},
  note         = {Software}
}

Development status

SSQP is under active development. While most of the source API, Python bindings, build system and documentation are not expected to change drastically, this might still be the case before the release of version 1.0, as we potentially restructure to improve performance.

Metadata

Release files for ssqp 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssqp 0.2
File Size Uploaded Provenance Actions
ssqp-0.2.tar.gz 691.3 kB With provenance Details for ssqp-0.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ssqp 0.2
File Interpreter ABI Platform Actions
ssqp-0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for ssqp-0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
ssqp-0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for ssqp-0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
ssqp-0.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 for ssqp-0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 11.1 MB

Release files / ssqp-0.2.tar.gz

Download URL ssqp-0.2.tar.gz
Size 691.3 kB
Tags Source
SHA-256 checksum
How to use checksums
28e9caf05498dde1c7ca0298dbacf7fd17f8ca7b326914bf75b8acb826034d5e
BLAKE2b-256 checksum
How to use checksums
680e7b3e19c00eda85b519807fe4c420d16343348d4790e62c425b00843090a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 17, 2026.

Transparency log

Release files / ssqp-0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL ssqp-0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.5 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
098c055942e20d50f34c9293b244e261651f4c46867845a0235b728033fd7e4e
BLAKE2b-256 checksum
How to use checksums
bce38f3f0817bbefd7583917fea6636325cd053d95e3d458e1b3869d790dc1b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 17, 2026.

Transparency log

Release files / ssqp-0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL ssqp-0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.5 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
cbb597341c6add0be088e9b9f92172f179a012deefd2ceec53fa765af299c347
BLAKE2b-256 checksum
How to use checksums
624509fe734d0a3e692aef6380e3fcfaab94eaf4bc29ca112bcb01c2b4384ad0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 17, 2026.

Transparency log

Release files / ssqp-0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL ssqp-0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.5 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
70e4d8124d3bf00d842217cd132910e8b18ba4a7161215fdd6b95e82269bee0d
BLAKE2b-256 checksum
How to use checksums
12dacec1c6c4c2ac4b58592c495d05dc8343a3c0b4acf258aa6f75f65982bf75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 17, 2026.

Transparency log

Security for ssqp 0.2

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for ssqp-0.2.tar.gz

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 Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page