filter.cpp
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation; either version 2.1 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
19 #include "filter.h"
20 
21 #define StateVar SVar
22 #define MeasVar MVar
23 
24 // Constructor
25 template<typename SVar, typename MVar>
26 Filter<SVar,MVar>::Filter(Pdf<SVar>* prior)
27  : _prior(prior),
28  _timestep(0)
29 {}
30 
31 template<typename SVar, typename MVar>
33 
36 template<typename SVar, typename MVar>
38 {}
39 
40 template<typename SVar, typename MVar> void
42 {
43  _prior = prior;
44  _post = prior;
45  // cout << "Filter::Reset() Post = " << _post->ExpectedValueGet() << endl;
46 }
47 
48 template<typename SVar, typename MVar> int
50 {
51  return _timestep;
52 }
53 
54 template<typename SVar, typename MVar> bool
56  const SVar& u,
57  MeasurementModel<MVar,SVar>* const measmodel,
58  const MVar& z,
59  const SVar& s)
60 {
61  return this->UpdateInternal(sysmodel,u,measmodel,z,s);
62 }
63 
64 template<typename SVar, typename MVar> bool
66  MeasurementModel<MVar,SVar>* const measmodel,
67  const MVar& z,
68  const SVar& s)
69 {
70  SVar u;
71  return this->UpdateInternal(sysmodel,u,measmodel,z,s);
72 }
73 
74 template<typename SVar, typename MVar> bool
76  MeasurementModel<MVar,SVar>* const measmodel,
77  const MVar& z)
78 {
79  SVar s; SVar u;
80  return this->UpdateInternal(sysmodel,u,measmodel,z,s);
81 }
82 
83 template<typename SVar, typename MVar> bool
85  const SVar& u,
86  MeasurementModel<MVar,SVar>* const measmodel,
87  const MVar& z)
88 {
89  SVar s;
90  return this->UpdateInternal(sysmodel,u,measmodel,z,s);
91 }
92 
93 template<typename SVar, typename MVar> bool
95  const SVar& u)
96 {
97  SVar s; MVar z;
98  return this->UpdateInternal(sysmodel,u,NULL,z,s);
99 }
100 
101 template<typename SVar, typename MVar> bool
103 {
104  SVar s; MVar z; SVar u;
105  return this->UpdateInternal(sysmodel,u,NULL,z,s);
106 }
107 
108 template<typename SVar, typename MVar> bool
110  const MVar& z,
111  const SVar& s)
112 {
113  SVar u;
114  return this->UpdateInternal(NULL,u,measmodel,z,s);
115 }
116 
117 template<typename SVar, typename MVar> bool
119  const MVar& z)
120 {
121  SVar u; SVar s;
122  return this->UpdateInternal(NULL,u,measmodel,z,s);
123 }
124 
125 template<typename SVar, typename MVar> Pdf<SVar> *
127 {
128  return _post;
129 }
Abstract class representing an interface for Bayesian Filters.
Definition: filter.h:77
Class PDF: Virtual Base class representing Probability Density Functions.
Definition: pdf.h:53
Filter(Pdf< StateVar > *prior)
Constructor.
Definition: filter.h:27
virtual void Reset(Pdf< StateVar > *prior)
Reset Filter.
Definition: filter.cpp:41
Pdf< MatrixWrapper::ColumnVector > * _post
Pointer to the Posterior Pdf.
Definition: filter.h:95
virtual Pdf< StateVar > * PostGet()
Get Posterior density.
Definition: filter.cpp:126
virtual bool UpdateInternal(SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, const MatrixWrapper::ColumnVector &u, MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &s)
Actual implementation of Update, varies along filters.
int _timestep
Represents the current timestep of the filter.
Definition: filter.h:100
virtual ~Filter()
destructor
Definition: filter.cpp:32
int TimeStepGet() const
Get current time.
Definition: filter.cpp:49
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)
Definition: filter.h:56
Pdf< MatrixWrapper::ColumnVector > * _prior
prior Pdf
Definition: filter.h:82


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Mon Jun 10 2019 12:47:59