![]() |
Controlpp
|
Calculates the recursive least square for online parameter estimation. More...
#include <controlpp/Estimators.hpp>
Public Member Functions | |
| ReccursiveLeastSquares (const Eigen::Vector< T, NParams > ¶m_hint=Eigen::Vector< T, NParams >().setOnes(), const Eigen::Matrix< T, NParams, NParams > &cov_hint=(Eigen::Matrix< T, NParams, NParams >::Identity() *T(1000)), T memory=0.99, T cov_regularisation=1e-9) | |
| Creates a recursive least square object with start parameters/covariance and a memory factor. | |
| void | set_cov (const Eigen::Matrix< T, NParams, NParams > &cov) |
| void | set_param (const Eigen::Vector< T, NParams > ¶m) |
| void | set_memory (const T &memory) |
| void | set_gain_clamp (const T &gain_clamp) |
| const T & | gain_clamp () const |
| void | input (const T &y, const Eigen::Vector< T, NParams > &s) |
| Adds a new input output pair that updates the estimate. | |
| const Eigen::Vector< T, NParams > & | estimate () const |
| returns the current best estimate | |
| const Eigen::Matrix< T, NParams, NParams > & | cov () const |
| returns the current covariance | |
| const Eigen::Vector< T, NParams > & | gain () const |
| Returns the gain used for the updata. | |
Calculates the recursive least square for online parameter estimation.
Solves the following system for \(\vec{p}\) online one interation after another
\[ y_k = \vec{s}_k^T \vec{p}_k \]
With the
Uses the recursive least squares algorithm:
\[ k_j = \frac{P_{j-1} s_j}{q + s_{j}^{T} P_{j-1} s_j} \]
\[ P_j = \left( P_{j-1} - k_{j} s_{j}^{T} P_{j-1}\right) \frac{1}{q} \]
\[ p_j = p_{j-1} + k_{j} \left( y_j - s_{j}^{T} p_{j-1}\right) \]
|
inline |
Creates a recursive least square object with start parameters/covariance and a memory factor.
| param_hint | The start value of the parameter vector. If there is no prior knowledge of the values, 0 is often a good choice. |
| cov_hint | The start value of the covariance matrix. The covariance matrix is a measure of the uncertainty of the parameter vector. As a starting point use the square of the standard deviation of the noise if known. If there is no prior knowledge of the uncertainties setting it to a diagonal matrix with elements much greater than 1 is often a good choice |
| memory | The value memory that determines how much the past determines the new estimate. It has to be within the open-closed range: \((0, 1]\). Remembers more of the past with higher memory and forgets more with lower memory
|
| cov_regularisation | A value that will be added to the diagonal of the covariance matrix before each update to prevent the covariance to be become too small, ill formed and unregular. This is mainly to increase numerical stability. |
|
inline |
returns the current covariance
acts as a measure of the uncertainty of the estimate (higher values signal higher uncertainty)
|
inline |
returns the current best estimate
|
inline |
Returns the gain used for the updata.
The gain can be seen as a measurement of uncertainty
|
inline |
|
inline |
Adds a new input output pair that updates the estimate.
| y | The new system measurements/outputs |
| s | The known system inputs |
|
inline |
|
inline |
|
inline |
|
inline |