bootstrapfilter.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 
19 #include "bootstrapfilter.h"
20 #include "../sample/weightedsample.h"
21 
22 #define StateVar SVar
23 #define MeasVar MVar
24 
25 template <typename SVar, typename MVar>
26 BootstrapFilter<SVar,MVar>::BootstrapFilter(MCPdf<SVar> * prior,
27  int resampleperiod,
28  double resamplethreshold,
29  int resamplescheme)
30  : ParticleFilter<SVar,MVar>(prior,NULL,resampleperiod,
31  resamplethreshold,
32  resamplescheme)
33 {
34  // for a bootstrapfilter, the proposal does not depend on the
35  // measurement
36  this->_proposal_depends_on_meas = false;
37 }
38 
39 
40 template <typename SVar, typename MVar>
42  MCPdf<SVar> * post,
43  int resampleperiod,
44  double resamplethreshold,
45  int resamplescheme)
46  : ParticleFilter<SVar,MVar>(prior,post,NULL,resampleperiod,
47  resamplethreshold,
48  resamplescheme)
49 {
50  // for a bootstrapfilter, the proposal does not depend on the
51  // measurement
52  this->_proposal_depends_on_meas = false;
53 }
54 
55 
56 
57 
58 template <typename SVar, typename MVar>
60 
61 template <typename SVar, typename MVar> bool
63  const SVar& u,
64  MeasurementModel<MVar,SVar>* const measmodel,
65  const MVar& z,
66  const SVar& s)
67 {
68  bool result = true;
69 
70  if (sysmodel != NULL){
71  this->ProposalSet(sysmodel->SystemPdfGet());
72  result = this->ParticleFilter<SVar,MVar>::UpdateInternal(sysmodel,u,NULL,z,s) && result;
73  }
74  if (measmodel != NULL)
75  result = this->ParticleFilter<SVar,MVar>::UpdateInternal(NULL,u,measmodel,z,s) && result;
76 
77  return result;
78 }
79 
virtual ~BootstrapFilter()
Destructor.
BootstrapFilter(MCPdf< StateVar > *prior, int resampleperiod=0, double resamplethreshold=0, int resamplescheme=DEFAULT_RS)
Constructor.
virtual bool UpdateInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Actual implementation of updateinternal.
ConditionalPdf< T, T > * SystemPdfGet()
Get the SystemPDF.
Definition: systemmodel.cpp:91
virtual bool UpdateInternal(SystemModel< StateVar > *const sysmodel, const StateVar &u, MeasurementModel< MeasVar, StateVar > *const measmodel, const MeasVar &z, const StateVar &s)
Actual implementation of Update, varies along filters.


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:58