1#ifndef BITSIM_CONTROL_LINEAR_MPC_H
2#define BITSIM_CONTROL_LINEAR_MPC_H
70 void set_model(
const std::vector<Matrix> &A,
const std::vector<Matrix> &B,
71 const std::vector<Vector> &c = {});
82 void set_input_bounds(
const Vector &lower,
const Vector &upper);
100 void set_reference(
const Vector &x_ref,
const Vector &u_ref);
106 void set_reference(
const std::vector<Vector> &x_ref,
const std::vector<Vector> &u_ref);
133 void check_vector_(
const Vector &v,
uint_t size,
const char *what)
const;
134 void build_structure_();
135 void build_qp_(
const Vector &x0);
142 std::vector<Matrix> A_;
143 std::vector<Matrix> B_;
144 std::vector<Vector> c_;
145 bool time_invariant_{
true};
146 bool has_model_{
false};
151 bool has_weights_{
false};
152 bool user_terminal_{
false};
158 real_t state_penalty_{0.0};
160 std::vector<Vector> x_ref_;
161 std::vector<Vector> u_ref_;
163 std::vector<index_t> state_rows_;
164 bool structure_dirty_{
true};
165 bool qp_dirty_{
true};
167 std::vector<Vector> x_plan_;
168 std::vector<Vector> u_plan_;
#define BITSIM_EXPORT
Marks a class or a function that bitsim's library exports from a source file compiled with hidden vis...
Definition bitsim_export.h:16
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
uint_t n_states() const noexcept
Definition linear_mpc.h:128
maths::optimization::QPStatus QPStatus
Definition linear_mpc.h:49
uint_t iterations() const noexcept
Definition linear_mpc.h:126
uint_t n_inputs() const noexcept
Definition linear_mpc.h:129
QPStatus status() const noexcept
Definition linear_mpc.h:125
LinearMPC(uint_t n_states, uint_t n_inputs, uint_t horizon, const QPSettings &settings=QPSettings())
Definition linear_mpc.cpp:17
maths::optimization::QPSettings QPSettings
Definition linear_mpc.h:48
const std::vector< Vector > & predicted_states() const noexcept
Definition linear_mpc.h:118
const std::vector< Vector > & predicted_inputs() const noexcept
Definition linear_mpc.h:123
const Matrix & terminal_weight() const noexcept
Definition linear_mpc.h:130
uint_t horizon() const noexcept
Definition linear_mpc.h:127
void set_model(const Matrix &A, const Matrix &B)
A time-invariant model, , in discrete time; see discretise().
Definition linear_mpc.cpp:41
A solver of the convex quadratic program.
Definition qp_solver.h:82
Linear quadratic regulators: the Riccati equations, the discretisation of a linear model,...
Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot,...
Definition control_module.h:18
RealMat Matrix
The matrices of the linear models and the controllers.
Definition lqr.h:20
RealColVec Vector
The vectors of the linear models and the controllers: states, inputs.
Definition lqr.h:23
QPStatus
How a solve ended.
Definition qp_solver.h:49
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20
The settings of QPSolver.
Definition qp_solver.h:23