Metadata-Version: 2.1
Name: affine_mpc
Version: 0.1.1
Summary: Python bindings for the affine_mpc library
Keywords: affine mpc,mpc,model predictive control
Author-Email: Mathew Haskell <mhaskell9@gmail.com>
License: BSD 3-Clause License
         
         Copyright (c) 2024, Brigham Young University
         
         Redistribution and use in source and binary forms, with or without
         modification, are permitted provided that the following conditions are met:
         
         1. Redistributions of source code must retain the above copyright notice, this
            list of conditions and the following disclaimer.
         
         2. Redistributions in binary form must reproduce the above copyright notice,
            this list of conditions and the following disclaimer in the documentation
            and/or other materials provided with the distribution.
         
         3. Neither the name of the copyright holder nor the names of its
            contributors may be used to endorse or promote products derived from
            this software without specific prior written permission.
         
         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
         DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
         FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
         DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
         CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
         OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
         \author Mathew Haskell
         \advisor Marc Killpack
         
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Requires-Dist: numpy
Provides-Extra: dev
Requires-Dist: pybind11-stubgen; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Provides-Extra: examples
Requires-Dist: matplotlib; extra == "examples"
Requires-Dist: abracatabra[qt-pyside6]; extra == "examples"
Description-Content-Type: text/markdown

# affine_mpc

`affine_mpc` is a library for model predictive control using discrete-time affine models, with C++ and Python interfaces.
It is designed to support real-time control and rapid research prototyping with a focused set of common costs and constraints, along with live parameter updates.

## Statement of Need

Researchers and engineers often need an MPC tool that sits between low-level QP assembly and large general-purpose control frameworks.
`affine_mpc` aims to lower the barrier to entry for developing MPC controllers by reducing the amount of low-level problem assembly needed for common affine MPC workflows.
`affine_mpc` focuses on discrete-time affine MPC problems with optional costs and constraints, efficient repeated solves, and workflows that support both experimentation in Python and integration in C++.

## Highlights

- Condensed and sparse MPC formulations behind a common interface
- Move-blocking, linear interpolation, and B-spline input parameterizations
- Optional input cost, state bounds, input bounds, and slew-rate constraints
- Efficient OSQP-backed updates when the QP sparsity pattern is unchanged
- Binary `.npz` logging via `MPCLogger` for plotting and post-run analysis

## Documentation

The primary documentation lives at <https://byu-rad-lab.github.io/affine_mpc/>.

- [Getting Started](https://byu-rad-lab.github.io/affine_mpc/getting-started/)
- [Python guide](https://byu-rad-lab.github.io/affine_mpc/getting-started/python/)
- [C++ guide](https://byu-rad-lab.github.io/affine_mpc/getting-started/cpp/)
- [Concepts and formulation](https://byu-rad-lab.github.io/affine_mpc/concepts/)
- [Example walkthrough](https://byu-rad-lab.github.io/affine_mpc/examples/)
- [Development guide](https://byu-rad-lab.github.io/affine_mpc/development/)

The Markdown source for the documentation lives in `docs/`.

Core C++ sources live under `src/` and `include/`, Python bindings and package sources live under `python/`, and example workflows live under `examples/`.

## Important Usage Notes

- Fully configure the model, limits, weights, and references before calling `initializeSolver()`
- OSQP sparsity is fixed at initialization; later updates must not introduce new nonzero structure
- If a model coefficient or cost weight may become nonzero later, initialize with that structure already present

## Community Standards

- Contributing guide: `CONTRIBUTING.md`
- Code of conduct: `CODE_OF_CONDUCT.md`
- Citation metadata: `CITATION.cff`

## Citation

If you use `affine_mpc` in research, please cite the project using the metadata in `CITATION.cff`.

## License

This project is licensed under the BSD 3-Clause License.
See `LICENSE` for details.
