LQRController
A Linear Quadratic Regulator (LQR) for controlling a system modeled by state-space equations.
LQR is a form of optimal control that finds the best control input to apply to a system by minimizing a quadratic cost function. The cost function balances two competing goals:
State Error: How far the system is from its desired target state (penalized by the
Q
matrix).Control Effort: How much energy or effort is used to control the system (penalized by the
R
matrix).
The controller computes the optimal control input u
using a simple state-feedback law: u = -Kx
, where x
is the system's state error and K
is the optimal gain matrix.
This should be used by holonomic robots only.
Thank you to Tyler Veness and WPILib!
See also
Constructors
Functions
Computes the velocity and acceleration command. The frame Target
is the reference robot, and the frame Actual
is the measured, physical robot.
Calculates the optimal control input (accelerations) to correct for the given state error.
Calculates the optimal control input to correct for the given state error.