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


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 Fri Aug 28 2015 10:10:21