bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
lqr.h File Reference

Linear quadratic regulators: the Riccati equations, the discretisation of a linear model, and the state feedback about an operating point. More...

#include "bitsim/bitsim_types.h"
#include <Eigen/Dense>
Include dependency graph for lqr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bitsim::control::DiscreteLinearModel
 A linear model in discrete time, \(x_{k+1} = A x_k + B u_k\). More...
struct  bitsim::control::LQRSolution
 The gain of a linear quadratic regulator and the cost matrix it comes from: the input \(u = -K x\) minimises the cost \(\sum x^T Q x + u^T R u\), or its integral in continuous time, and the cost from x on is \(x^T P x\). More...
class  bitsim::control::LQRController
 A linear state feedback about an operating point, \(u = u_{ref} - K (x - x_{ref})\), with optional bounds on each input. More...

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.

Typedefs

using bitsim::control::Matrix = RealMat
 The matrices of the linear models and the controllers.
using bitsim::control::Vector = RealColVec
 The vectors of the linear models and the controllers: states, inputs.

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().

Detailed Description

Linear quadratic regulators: the Riccati equations, the discretisation of a linear model, and the state feedback about an operating point.