Bayesian Filtering Library Generated from SVN r
EKparticlefilter.h
1// $ Id: $
2// Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
3// 2008 Tinne De Laet <first dot last at mech dot kuleuven dot be>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation; either version 2.1 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19
20#ifndef __EK_PARTICLE_FILTER__
21#define __EK_PARTICLE_FILTER__
22
23#include "particlefilter.h"
24#include "../pdf/EKF_proposaldensity.h"
25#include "../pdf/mcpdf.h"
26#include <list>
27
28namespace BFL
29{
31
36 : public ParticleFilter<ColumnVector,ColumnVector>
37 {
38 protected:
40 std::vector<SymmetricMatrix> _sampleCov;
41 std::vector<SymmetricMatrix>::iterator _cov_it;
42
43 std::vector<SymmetricMatrix> _tmpCov;
44 std::vector<SymmetricMatrix>::iterator _tmpCovit;
45
46 // helper variables for resampleing to prevent memory allocation on the heap
47 const int _dimension;
48 const int _num_samples;
49 std::vector<WeightedSample<ColumnVector> > _old_samples;
50 std::vector<WeightedSample<ColumnVector> >::iterator _oit;
51 std::vector<WeightedSample<ColumnVector> > _result_samples;
52 std::vector<WeightedSample<ColumnVector> >::iterator _rit;
53 std::vector<double> _unif_samples;
54 std::vector<double> _CumPDF;
55 std::vector<double>::const_iterator _CumPDFit;
56 ColumnVector _x_old;
58
59 virtual bool UpdateInternal(SystemModel<ColumnVector>* const sysmodel,
60 const ColumnVector& u,
62 const ColumnVector& z,
63 const ColumnVector& s);
64
67 virtual bool ProposalStepInternal(SystemModel<ColumnVector> * const sysmodel,
68 const ColumnVector & u,
70 const ColumnVector & z,
71 const ColumnVector & s);
72
74 virtual bool Resample();
75
76 public:
78
88 int resampleperiod = 0,
89 double resamplethreshold = 0,
90 int resamplescheme = DEFAULT_RS);
91
94 };
95
96} // End namespace BFL
97
98#endif // __EK_PARTICLE_FILTER__
Particle filter using EKF for proposal step.
std::vector< SymmetricMatrix > _sampleCov
Sample Covariances for use with EKF Proposal density.
EKParticleFilter(MCPdf< ColumnVector > *prior, int resampleperiod=0, double resamplethreshold=0, int resamplescheme=DEFAULT_RS)
Constructor.
virtual bool ProposalStepInternal(SystemModel< ColumnVector > *const sysmodel, const ColumnVector &u, MeasurementModel< ColumnVector, ColumnVector > *const measmodel, const ColumnVector &z, const ColumnVector &s)
virtual ~EKParticleFilter()
Destructor.
virtual bool Resample()
Resample also redefined for the same reasons...
Monte Carlo Pdf: Sample based implementation of Pdf.
Definition mcpdf.h:50
Virtual Class representing all particle filters.