24 jevois::Component(instance), itsKF(2, 1, 0), itsProcessNoise(2, 1, CV_32F),
25 itsMeasurement(1, 1, CV_32F), itsLatest(1, 1, CV_32F), itsFresh(false)
27 cv::setIdentity(
itsKF.measurementMatrix);
37 itsKF.statePost.at<
float>(0) = 0.0F;
38 itsKF.statePost.at<
float>(1) = 0.0F;
47 if (newval)
itsKF.transitionMatrix = (cv::Mat_<float>(2, 2) << 1,1, 0,1);
48 else itsKF.transitionMatrix = (cv::Mat_<float>(2, 2) << 1,0, 0,1);
54 itsKF.processNoiseCov = (cv::Mat_<float>(2, 2) << newval * newval, 0, 0, newval * newval );
60 cv::setIdentity(
itsKF.measurementNoiseCov, cv::Scalar::all(newval * newval));
66 cv::setIdentity(
itsKF.errorCovPost, cv::Scalar::all(newval * newval));
98 if (eps) x = std::round(x / eps) * eps;
#define JEVOIS_UNUSED_PARAM(x)
Kalman1D(std::string const &instance)
Constructor.
float get(float const eps=0.01F)
Function to call each time you want to get the Kalman-filtered coordinates.
virtual ~Kalman1D()
Destructor.
void onParamChange(kalman1d::usevel const ¶m, bool const &newval) override
void set(float x)
Function to call each time you have a new measurement.