mixtureBootstrapFilter.cpp
Go to the documentation of this file.
00001 // Copyright (C) 2009 Tinne De Laet <first dot last at gmail dot com>
00002 // $Id: mixtureBootstrapFilter.h 2009-02-03 tdelaet $
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU Lesser General Public License as published by
00006 // the Free Software Foundation; either version 2.1 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 //
00018 
00019 #include "mixtureBootstrapFilter.h"
00020 #include "../sample/weightedsample.h"
00021 
00022 #define StateVar SVar
00023 #define MeasVar MVar
00024 
00025 template <typename SVar, typename MVar>
00026 MixtureBootstrapFilter<SVar,MVar>::MixtureBootstrapFilter(Mixture<SVar> * prior,
00027                                             int resampleperiod,
00028                                             double resamplethreshold,
00029                                         int resamplescheme,
00030                         int maintainMixturePeriod)
00031   : MixtureParticleFilter<SVar,MVar>(prior,NULL,resampleperiod,
00032                                      resamplethreshold,
00033                                      resamplescheme,
00034                      maintainMixturePeriod)
00035 {
00036   // for a MixtureBootstrapFilter, the proposal does not depend on the
00037   // measurement
00038   this->_proposal_depends_on_meas = false;
00039 }
00040 
00041 
00042 template <typename SVar, typename MVar>
00043 MixtureBootstrapFilter<SVar,MVar>::MixtureBootstrapFilter(Mixture<SVar> * prior,
00044                                             Mixture<SVar> * post,
00045                                             int resampleperiod,
00046                                             double resamplethreshold,
00047                                         int resamplescheme,
00048                         int maintainMixturePeriod)
00049   : MixtureParticleFilter<SVar,MVar>(prior,post,NULL,resampleperiod,
00050                                      resamplethreshold,
00051                                      resamplescheme,
00052                      maintainMixturePeriod)
00053 {
00054   // for a MixtureBootstrapFilter, the proposal does not depend on the
00055   // measurement
00056   this->_proposal_depends_on_meas = false;
00057 }
00058 
00059 
00060 
00061 
00062 template <typename SVar, typename MVar>
00063 MixtureBootstrapFilter<SVar,MVar>::~MixtureBootstrapFilter(){}
00064 
00065 template <typename SVar, typename MVar> bool
00066 MixtureBootstrapFilter<SVar,MVar>::UpdateInternal(SystemModel<SVar>* const sysmodel,
00067                                            const SVar& u,
00068                                            MeasurementModel<MVar,SVar>* const measmodel,
00069                                            const MVar& z,
00070                                            const SVar& s)
00071 {
00072   bool result = true;
00073 
00074   if (sysmodel != NULL){
00075     this->ProposalSet(sysmodel->SystemPdfGet());
00076     result = this->MixtureParticleFilter<SVar,MVar>::UpdateInternal(sysmodel,u,NULL,z,s) && result;
00077   }
00078   if (measmodel != NULL)
00079     result = this->MixtureParticleFilter<SVar,MVar>::UpdateInternal(NULL,u,measmodel,z,s) && result;
00080 
00081   return result;
00082 }
00083 


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 Thu Feb 11 2016 22:31:56