mixtureBootstrapFilter.cpp
Go to the documentation of this file.
1 // Copyright (C) 2009 Tinne De Laet <first dot last at gmail dot com>
2 // $Id: mixtureBootstrapFilter.h 2009-02-03 tdelaet $
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 "mixtureBootstrapFilter.h"
20 #include "../sample/weightedsample.h"
21 
22 #define StateVar SVar
23 #define MeasVar MVar
24 
25 template <typename SVar, typename MVar>
26 MixtureBootstrapFilter<SVar,MVar>::MixtureBootstrapFilter(Mixture<SVar> * prior,
27  int resampleperiod,
28  double resamplethreshold,
29  int resamplescheme,
30  int maintainMixturePeriod)
31  : MixtureParticleFilter<SVar,MVar>(prior,NULL,resampleperiod,
32  resamplethreshold,
33  resamplescheme,
34  maintainMixturePeriod)
35 {
36  // for a MixtureBootstrapFilter, the proposal does not depend on the
37  // measurement
38  this->_proposal_depends_on_meas = false;
39 }
40 
41 
42 template <typename SVar, typename MVar>
44  Mixture<SVar> * post,
45  int resampleperiod,
46  double resamplethreshold,
47  int resamplescheme,
48  int maintainMixturePeriod)
49  : MixtureParticleFilter<SVar,MVar>(prior,post,NULL,resampleperiod,
50  resamplethreshold,
51  resamplescheme,
52  maintainMixturePeriod)
53 {
54  // for a MixtureBootstrapFilter, the proposal does not depend on the
55  // measurement
56  this->_proposal_depends_on_meas = false;
57 }
58 
59 
60 
61 
62 template <typename SVar, typename MVar>
64 
65 template <typename SVar, typename MVar> bool
67  const SVar& u,
68  MeasurementModel<MVar,SVar>* const measmodel,
69  const MVar& z,
70  const SVar& s)
71 {
72  bool result = true;
73 
74  if (sysmodel != NULL){
75  this->ProposalSet(sysmodel->SystemPdfGet());
76  result = this->MixtureParticleFilter<SVar,MVar>::UpdateInternal(sysmodel,u,NULL,z,s) && result;
77  }
78  if (measmodel != NULL)
79  result = this->MixtureParticleFilter<SVar,MVar>::UpdateInternal(NULL,u,measmodel,z,s) && result;
80 
81  return result;
82 }
83 
MixtureBootstrapFilter(Mixture< StateVar > *prior, int resampleperiod=0, double resamplethreshold=0, int resamplescheme=DEFAULT_RS, int maintainMixturePeriod=1)
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 Update, varies along filters.
virtual ~MixtureBootstrapFilter()
Destructor.
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 updateinternal.


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 Feb 28 2022 21:56:33