Class LQRController

Class Documentation

class LQRController

Class used as a Linear Quadratic Regulator controller.

Public Functions

LQRController(const Math::Matrix &a, const Math::Matrix &b, const Math::Matrix &q, const Math::Matrix &r)

Creates a new LQR controller with the given matrices

Parameters
  • a – System matrix A

  • b – System matrix B

  • q – Weighting matrix Q

  • r – Weighting matrix R

Math::Matrix getK()

Returns the computed gain matrix

Math::Vector computeControl(Math::Vector x)

Computes the optimal control

Parameters

x – The current output vector

Returns

The optimal input vector

void setReference(const Math::Vector &_reference)

Setter for the reference or desired state of the system