43 #include <visp3/core/vpLinearKalmanFilterInstantiation.h>
53 #ifdef ENABLE_VISP_NAMESPACE
57 unsigned int nsignal = 2;
58 unsigned int niter = 200;
59 unsigned int size_state_vector = 2 * nsignal;
60 unsigned int size_measure_vector = 1 * nsignal;
62 vpMeasureType measure_t = Position;
64 std::string filename =
"/tmp/log.dat";
65 std::ofstream flog(filename.c_str());
70 for (
unsigned int signal = 0; signal < nsignal; signal++)
71 sigma_measure = 0.000001;
76 for (
unsigned int signal = 0; signal < nsignal; signal++) {
77 sigma_state[2 * signal] = 0.;
78 sigma_state[2 * signal + 1] = 0.000001;
82 for (
unsigned int signal = 0; signal < nsignal; signal++) {
83 sigma_state[2 * signal] = 0.000001;
84 sigma_state[2 * signal + 1] = 0;
91 for (
unsigned int signal = 0; signal < nsignal; signal++) {
92 measure[signal] = 3 + 2 * signal;
105 kalman.
initFilter(nsignal, sigma_state, sigma_measure, rho, dummy);
110 kalman.
initFilter(nsignal, sigma_state, sigma_measure, dummy, dt);
114 for (
unsigned int iter = 0; iter <= niter; iter++) {
115 std::cout <<
"-------- iter " << iter <<
" ------------" << std::endl;
116 for (
unsigned int signal = 0; signal < nsignal; signal++) {
117 measure[signal] = 3 + 2 * signal + 0.3 * sin(
vpMath::rad(360. / niter * iter));
119 std::cout <<
"measure : " << measure.t() << std::endl;
125 flog << kalman.
Xest.
t() << std::endl;
127 std::cout <<
"Xest: " << kalman.
Xest.
t() << std::endl;
134 std::cout <<
"Catch an exception: " << e << std::endl;
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
This class provides an implementation of some specific linear Kalman filters.
void filter(vpColVector &z)
void setStateModel(vpStateModel model)
void initFilter(unsigned int nsignal, vpColVector &sigma_state, vpColVector &sigma_measure, double rho, double dt)
@ stateConstVel_MeasurePos
@ stateConstVelWithColoredNoise_MeasureVel
static double rad(double deg)