Bayesian Filtering Library Generated from SVN r
filter.h
1// $Id$
2// Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
3//
4 /***************************************************************************
5 * This library is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public *
7 * License as published by the Free Software Foundation; *
8 * version 2 of the License. *
9 * *
10 * As a special exception, you may use this file as part of a free *
11 * software library without restriction. Specifically, if other files *
12 * instantiate templates or use macros or inline functions from this *
13 * file, or you compile this file and link it with other files to *
14 * produce an executable, this file does not by itself cause the *
15 * resulting executable to be covered by the GNU General Public *
16 * License. This exception does not however invalidate any other *
17 * reasons why the executable file might be covered by the GNU General *
18 * Public License. *
19 * *
20 * This library is distributed in the hope that it will be useful, *
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
23 * Lesser General Public License for more details. *
24 * *
25 * You should have received a copy of the GNU General Public *
26 * License along with this library; if not, write to the Free Software *
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
28 * Boston, MA 02110-1301 USA *
29 * *
30 ***************************************************************************/
31
32#ifndef __FILTER__
33#define __FILTER__
34
35#include "../model/systemmodel.h"
36#include "../model/measurementmodel.h"
37#include "../pdf/pdf.h"
38
39namespace BFL
40{
41 using namespace std;
42
44
77 template <typename StateVar, typename MeasVar> class Filter
78 {
79 protected:
80
83
85
96
98
101
103
109 virtual bool UpdateInternal(SystemModel<StateVar>* const sysmodel,
110 const StateVar& u,
111 MeasurementModel<MeasVar,StateVar>* const measmodel,
112 const MeasVar& z,
113 const StateVar& s)=0;
114
115 public:
117
121
123
126
128 virtual ~Filter();
129
131 virtual void Reset(Pdf<StateVar> * prior);
132
134
140 virtual bool Update(SystemModel<StateVar>* const sysmodel,
141 const StateVar& u,
142 MeasurementModel<MeasVar,StateVar>* const measmodel,
143 const MeasVar& z,
144 const StateVar& s);
145
147
154 virtual bool Update(SystemModel<StateVar>* const sysmodel,
155 MeasurementModel<MeasVar,StateVar>* const measmodel,
156 const MeasVar& z,
157 const StateVar& s);
159
165 virtual bool Update(SystemModel<StateVar>* const sysmodel,
166 MeasurementModel<MeasVar,StateVar>* const measmodel,
167 const MeasVar& z);
169
175 virtual bool Update(SystemModel<StateVar>* const sysmodel,
176 const StateVar& u,
177 MeasurementModel<MeasVar,StateVar>* const measmodel,
178 const MeasVar& z);
179
181
184 virtual bool Update(SystemModel<StateVar>* const sysmodel,
185 const StateVar& u);
187
189 virtual bool Update(SystemModel<StateVar>* const sysmodel);
190
192
197 virtual bool Update(MeasurementModel<MeasVar,StateVar>* const measmodel,
198 const MeasVar& z,
199 const StateVar& s);
201
205 virtual bool Update(MeasurementModel<MeasVar,StateVar>* const measmodel,
206 const MeasVar& z);
207
209
213
215
218 int TimeStepGet() const;
219 };
220
221 // For template instantiation
222#include "filter.cpp"
223
224} // End namespace BFL
225
226#endif // __FILTER__
Abstract class representing an interface for Bayesian Filters.
Definition: filter.h:78
virtual bool Update(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z)
Full Update (system with inputs, without sensing params)
virtual bool Update(SystemModel< StateVar > *const sysmodel, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Full Update (system without inputs, with sensing params)
Pdf< StateVar > * _post
Pointer to the Posterior Pdf.
Definition: filter.h:95
virtual bool UpdateInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)=0
Actual implementation of Update, varies along filters.
virtual ~Filter()
destructor
virtual bool Update(MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z)
Measurement Update (system without "sensing params")
virtual bool Update(MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Measurement Update (system with "sensing params")
virtual bool Update(SystemModel< StateVar > *const sysmodel, const StateVar &u)
System Update (system with inputs)
virtual Pdf< StateVar > * PostGet()
Get Posterior density.
Pdf< StateVar > * _prior
prior Pdf
Definition: filter.h:82
virtual void Reset(Pdf< StateVar > *prior)
Reset Filter.
Filter(const Filter< StateVar, MeasVar > &filt)
copy constructor
virtual bool Update(SystemModel< StateVar > *const sysmodel)
System Update (system without inputs)
virtual bool Update(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Full Update (system with inputs/sensing params)
virtual bool Update(SystemModel< StateVar > *const sysmodel, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z)
Full Update (system without inputs/sensing params)
Filter(Pdf< StateVar > *prior)
Constructor.
int _timestep
Represents the current timestep of the filter.
Definition: filter.h:100
int TimeStepGet() const
Get current time.
Class PDF: Virtual Base class representing Probability Density Functions.
Definition: pdf.h:51