13#include <yarp/math/Math.h>
14#include <yarp/math/SVD.h>
18using namespace yarp::sig;
19using namespace yarp::math;
34 P.resize(
n,
n);
P.zero();
35 K.resize(
n,
m);
K.zero();
36 S.resize(
m,
m);
S.zero();
42Kalman::Kalman(
const Matrix &_A,
const Matrix &_H,
const Matrix &_Q,
43 const Matrix &_R) :
A(_A),
H(_H), Q(_Q), R(_R)
46 B.resize(
n,
n);
B.zero();
51Kalman::Kalman(
const Matrix &_A,
const Matrix &_B,
const Matrix &_H,
52 const Matrix &_Q,
const Matrix &_R) :
A(_A), B(_B),
H(_H), Q(_Q), R(_R)
61 if ((_x0.length()==
x.length()) && (_P0.rows()==
P.rows()) && (_P0.cols()==
P.cols()))
115 return filt(Vector(
n,0.0),
z);
129 if ((_A.cols()==
A.cols()) && (_A.rows()==
A.rows()))
143 if ((_B.cols()==
B.cols()) && (_B.rows()==
B.rows()))
156 if ((_H.cols()==
H.cols()) && (_H.rows()==
H.rows()))
170 if ((_Q.cols()==
Q.cols()) && (_Q.rows()==
Q.rows()))
183 if ((_R.cols()==
R.cols()) && (_R.rows()==
R.rows()))
bool set_Q(const yarp::sig::Matrix &_Q)
Returns the process noise covariance matrix.
bool set_R(const yarp::sig::Matrix &_R)
Returns the measurement noise covariance matrix.
bool init(const yarp::sig::Vector &_x0, const yarp::sig::Matrix &_P0)
Set initial state and error covariance.
bool set_A(const yarp::sig::Matrix &_A)
Returns the state transition matrix.
yarp::sig::Vector get_y() const
Returns the estimated output.
bool set_B(const yarp::sig::Matrix &_B)
Returns the input matrix.
const yarp::sig::Vector & predict()
Predicts the next state vector.
const yarp::sig::Vector & correct(const yarp::sig::Vector &z)
Corrects the current estimation of the state vector given the current measurement.
const yarp::sig::Vector & filt(const yarp::sig::Vector &u, const yarp::sig::Vector &z)
Returns the estimated state vector given the current input and the current measurement by performing ...
bool set_H(const yarp::sig::Matrix &_H)
Returns the measurement transition matrix.