Model predictive control in Python based on quadratic programming
APACHE-2.0 License
This release fixes inequality vector data types for the wheeled inverted pendulum system, and adds some type checks to make sure generated problems use floating-point arrays.
logging.warn
Published by stephane-caron about 1 year ago
This is a major release according to semantic versioning because the name of the project changed to qpmpc. In passing, the "cart pole" system was a misnomer and has been renamed to "wheeled inverted pendulum".
Published by stephane-caron over 1 year ago
This release makes a major API update to switch from cold-start to hot-start when solving of MPC QP problems. It meanwhile adds two examples (with live plots) taken from real-robot use cases:
python examples/lipm_walking_controller.py
python examples/cart_pole.py
The problem class, now called MPCProblem
, allows for initial/goal state and target trajectory updates. A new MPCQP
class is introduced for QP vector updates (cost vectors depend on the initial state and targets, while on LTI problems QP matrices don't depend on these changing quantities, a source of optimization for faster solve times).
The new API also introduces two new submodules:
TkAgg
matplotlib backend)CartPole
shipped with this release is used in a closed-loop MPC balancer on Upkie.ruff
ProblemDefinitionError
first_input
getteris_empty
propertyltv_mpc.live_plots
submoduleltv_mpc.systems
submoduleProblem
is fully defined in constructorMPCProblem
build_qp
into a new MPCQP
classProblem
to MPCProblem
Solution
to Plan
stacked_inputs
to just inputs
in plansstacked_states
to just states
in planssolve_mpc
is now mandatoryqpsolvers
internallyPublished by stephane-caron about 2 years ago
This version adds a solver
keyword argument to solve_mpc
to select the backend QP solver.
It follows from the API update in qpsolvers v2.0 where the default solver was deprecated and the solver
argument became mandatory.
mpc_interface
alternative in the READMEsolve_qp
now takes a mandatory solver
keyword argumentsolver
keyword argumentPublished by stephane-caron over 2 years ago
This minor version adds a sparse keyword argument, for use with sparse QP solvers like OSQP.
sparse
keyword argument to use with sparse QP solversProblem
, Solution
and solve_mpc
module-widePublished by stephane-caron over 2 years ago
Here comes the first working version of this module, following an initial import from pymanoid and refactoring to a functional API.
This module defines a one-stop shop solve_mpc(problem: Problem) -> Solution
function. The Problem
type defines the linear model predictive control problem (system, constraints, initial state and cost function to optimize) while the Solution
holds the resulting state and input trajectories.
mpc.py
.