optimalimportancefilter.cpp
Go to the documentation of this file.
1 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation; either version 2.1 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // $Id$
18 
20 
21 #define SV StateVar
22 #define MV MeasVar
23 #define MeasModel MeasurementModel
24 #define OptImpFilter OptimalImportanceFilter
25 
26 template <typename SV, typename MV> void
27 OptimalImportanceFilter::ConstructProposal(SystemModel<SV>* const sysmodel,
28  MeasModel<MV,SV>* const measmodel)
29 {
30 
31  // DIRTY IMPLEMENTATION
32  if (_proposal == NULL) // First time, no memory allocated yet
33  {
34  // Allocate necessary memory
35  _proposal = new ConditionalGaussian(sysmodel->SystemPdfGet());
36  }
37  else // Check if we really need to allocate memory
38  if (_proposal->DimensionGet())
39  ;
40 }
41 
42 template <typename SV, typename MV>
43 OptimalImportanceFilter<SV,MV>::OptimalImportanceFilter(MCPdf<SV> * prior,
44  int resampleperiod,
45  double resamplethreshold,
46  int resamplescheme)
47  : ParticleFilter<SV,MV>(prior, NULL, resampleperiod,
48  resamplethreshold,
49  resamplescheme)
50 {};
51 
52 
53 template <typename SV, typename MV>
54 OptimalImportanceFilter<SV,MV>::~OptimalImportanceFilter()
55 {
56  delete _proposal;
57 };
58 
59 template <typename SV, typename MV>
60 OptimalImportanceFilter<SV,MV>::OptimalImportanceFilter(const OptimalImportanceFilter & filter)
61  : ParticleFilter<SV,MV>(filter){}
62 
63 template <typename SV, typename MV> void
64 OptimalImportanceFilter<SV,MV>::Update(SystemModel<SV>* const sysmodel,
65  const SV& u,
66  MeasModel<MV,SV>* const measmodel,
67  const MV& z,
68  const SV& s)
69 {
70  // Change here
71  this->ProposalSet();
72  this->ProposalStepInput(sysmodel,u);
73  this->MeasUpdate(measmodel,z,s);
74 };
75 
76 template <typename SV, typename MV> void
77 OptimalImportanceFilter<SV,MV>::Update(SystemModel<SV>* const sysmodel,
78  MeasModel<MV,SV>* const measmodel,
79  const MV& z,
80  const SV& s)
81 {
82  this->ProposalSet();
83  this->ProposalStep(sysmodel);
84  this->MeasUpdate(measmodel,z,s);
85 };
86 
87 template <typename SV, typename MV> void
88 OptimalImportanceFilter<SV,MV>::Update(SystemModel<SV>* const sysmodel,
89  MeasModel<MV,SV>* const measmodel,
90  const MV& z)
91 {
92  this->ProposalSet();
93  this->ProposalStep(sysmodel);
94  this->MeasUpdate(measmodel,z);
95 };
96 
97 template <typename SV, typename MV> void
98 OptimalImportanceFilter<SV,MV>::Update(SystemModel<SV>* const sysmodel,
99  const SV& u,
100  MeasModel<MV,SV>* const measmodel,
101  const MV& z)
102 {
103  this->ProposalSet();
104  this->ProposalStepInput(sysmodel,u);
105  this->MeasUpdate(measmodel,z);
106 };
107 
109 template <typename SV, typename MV> void
110 OptimalImportanceFilter<SV,MV>::Update(SystemModel<SV>* const sysmodel,
111  const SV& u)
112 {
113  this->ProposalSet();
114  this->ProposalStepInput(sysmodel,u);
115 }
116 
117 template <typename SV, typename MV> void
118 OptimalImportanceFilter<SV,MV>::Update(SystemModel<SV>* const sysmodel)
119 {
120  this->ProposalSet();
121  this->ProposalStep(sysmodel);
122 }
123 
125 template <typename SV, typename MV> void
126 OptimalImportanceFilter<SV,MV>::Update(MeasModel<MV,SV>* const measmodel,
127  const MV& z,
128  const SV& s)
129 {
130  this->MeasUpdate(measmodel,z,s);
131 }
132 
133 template <typename SV, typename MV> void
134 OptimalImportanceFilter<SV,MV>::Update(MeasModel<MV,SV>* const measmodel,
135  const MV& z)
136 {
137  this->MeasUpdate(measmodel,z);
138 }
139 
#define SV
#define MV


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