bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
lqr.cpp File Reference
#include "bitsim/control/lqr.h"
#include <unsupported/Eigen/MatrixFunctions>
#include <cmath>
#include <stdexcept>
#include <string>
Include dependency graph for lqr.cpp:

Namespaces

namespace  bitsim
namespace  bitsim::control
 Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot, linear quadratic regulators and model predictive control.

Functions

DiscreteLinearModel bitsim::control::discretise (const Matrix &A, const Matrix &B, real_t dt)
 Discretise \(\dot x = A x + B u\) for a step dt, with the input held over the step (zero-order hold): \(A_d = e^{A \Delta t}\) and \(B_d = \int_0^{\Delta t} e^{A s} ds \, B\), both from the exponential of one block matrix. Exact for a linear model.
Matrix bitsim::control::solve_dare (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R)
 Solve the discrete algebraic Riccati equation.
Matrix bitsim::control::solve_care (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R)
 Solve the continuous algebraic Riccati equation.
LQRSolution bitsim::control::dlqr (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R)
 The LQR of \(x_{k+1} = A x_k + B u_k\): \(K = (R + B^T P B)^{-1} B^T P A\) with P from solve_dare().
LQRSolution bitsim::control::lqr (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R)
 The LQR of \(\dot x = A x + B u\): \(K = R^{-1} B^T P\) with P from solve_care().