// Copyright (C) 2009 Tinne De Laet <first dot last at gmail dot com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// $Id: mixtureParticleFilter.cpp 2009-02-02 tdelaet $
#include "mixtureParticleFilter.h"
#include "../pdf/mixture.h"
#define SV StateVar
#define MV MeasVar
#define MeasModel MeasurementModel
#define STATE_AND_MEAS_VAR_DIFFERENT
template <typename SV, typename MV>
MixtureParticleFilter<SV,MV>::MixtureParticleFilter(Mixture<SV> * prior,
ConditionalPdf<SV,SV> * proposal,
int resampleperiod,
double resamplethreshold,
int resamplescheme,
int maintainMixturePeriod)
: Filter<SV,MV>(prior)
, _proposal(proposal)
, _sample(WeightedSample<SV>(prior->DimensionGet()))
, _resampleScheme(resamplescheme)
, _created_post(true)
, _newMixtureWeights(prior->NumComponentsGet())
, _sumWeights(prior->NumComponentsGet())
, _old_samplesVec(prior->NumComponentsGet())
, _new_samplesVec(prior->NumComponentsGet())
, _new_samples_unweightedVec(prior->NumComponentsGet())
, _maintainMixturePeriod(maintainMixturePeriod)
{
/* Initialize Post, at time = 0, post = prior
To be more clean, this should be done in the filter base class,
but this is impossible because of the pure virtuals...
*/
// Post is equal to prior at timetep 1
this->_post = prior->Clone();
// Initialise vector of lists of samples
for(int i = 0 ; i< dynamic_cast<Mixture<SV> *>(this->_post)->NumComponentsGet(); i++)
{
_old_samplesVec[i] = (dynamic_cast<MCPdf<SV> *>(prior->ComponentGet(i))->ListOfSamplesGet());
}
_new_samplesVec = _old_samplesVec;
// You have to choose for dynamic resampling by specifying a threshold != 0 OR give me a fixed resample period != 0
assert(!(resampleperiod == 0 && resamplethreshold == 0));
assert(!(resampleperiod != 0 && resamplethreshold != 0));
// dynamic resampling
if (resampleperiod == 0)
_dynamicResampling = true;
// fixed period resampling
else
_dynamicResampling = false;
_resamplePeriod = resampleperiod;
_resampleThreshold = resamplethreshold;
}
template <typename SV, typename MV>
MixtureParticleFilter<SV,MV>::MixtureParticleFilter(Mixture<SV> * prior,
Mixture<SV> * post,
ConditionalPdf<SV,SV> * proposal,
int resampleperiod,
double resamplethreshold,
int resamplescheme,
int maintainMixturePeriod)
: Filter<SV,MV>(prior)
, _proposal(proposal)
, _resampleScheme(resamplescheme)
, _created_post(false)
, _newMixtureWeights(prior->NumComponentsGet())
, _sumWeights(prior->NumComponentsGet())
, _old_samplesVec(prior->NumComponentsGet())
, _new_samplesVec(prior->NumComponentsGet())
, _new_samples_unweightedVec(prior->NumComponentsGet())
, _maintainMixturePeriod(maintainMixturePeriod)
{
this->_post = post;
// Post is equal to prior at timestep 1
/* Note: Dirty cast should be avoided by not demanding an MCPdf as
prior and just sample from the prior instead :-(
*/
bool ret = (dynamic_cast<MCPdf<SV> *>(this->_post))->ListOfSamplesSet(prior->ListOfSamplesGet());
assert(ret);
for(int i =0 ; i < prior->NumComponentsGet() ; i++)
{
bool ret = (dynamic_cast<MCPdf<SV> *>(this->_post->ComponentGet(i)))->ListOfSamplesSet(prior->ComponentGet(i)->ListOfSamplesGet());
}
// Initialise vector of lists of samples
for(int i =0 ; i < prior->NumComponentsGet() ; i++)
{
_old_samplesVec[i] = (prior->ComponentGet(i)->ListOfSamplesGet());
}
_new_samplesVec = _old_samplesVec;
// You have to choose for dynamic resampling by specifying a threshold != 0 OR give me a fixed resample period != 0
assert(!(resampleperiod == 0 && resamplethreshold == 0));
assert(!(resampleperiod != 0 && resamplethreshold != 0));
// dynamic resampling
if (resampleperiod == 0)
_dynamicResampling = true;
// fixed period resampling
else
_dynamicResampling = false;
_resamplePeriod = resampleperiod;
_resampleThreshold = resamplethreshold;
}
template <typename SV, typename MV>
MixtureParticleFilter<SV,MV>::~MixtureParticleFilter()
{
if (_created_post)
delete this->_post;
}
template <typename SV, typename MV>
MixtureParticleFilter<SV,MV>::MixtureParticleFilter(const MixtureParticleFilter<SV,MV> & filter)
: Filter<SV,MV>(filter)
, _created_post(true)
{
// Clone the Mixture posterior of filter
this->_post = filter.PostGet().Clone();
this->_newMixtureWeights.resize(this->_post->NumComponentsGet());
this->_sumWeights.resize(this->_post->NumComponentsGet());
}
template <typename SV, typename MV> void
MixtureParticleFilter<SV,MV>::Reset(Mixture<SV> * prior)
{
this->_prior = prior;
delete this->_post;
this->_post = prior->Clone();
this->_newMixtureWeights.resize(dynamic_cast<Mixture<SV> *>(this->_post)->NumComponentsGet());
this->_sumWeights.resize(dynamic_cast<Mixture<SV> *>(this->_post)->NumComponentsGet());
}
template <typename SV, typename MV> void
MixtureParticleFilter<SV,MV>::ProposalSet(ConditionalPdf<SV,SV> * const cpdf)
{
_proposal = cpdf;
}
template <typename SV, typename MV> ConditionalPdf<SV,SV> *
MixtureParticleFilter<SV,MV>::ProposalGet()
{
return _proposal;
}
// Proposal step can be executed for each component in the mixture seperately
template <typename SV, typename MV> bool
MixtureParticleFilter<SV,MV>::ProposalStepInternal(SystemModel<SV> * const sysmodel,
const SV & u,
MeasurementModel<MV,SV> * const measmodel,
const MV & z,
const SV & s)
{
bool result = true;
for(int i = 0 ; i< dynamic_cast<Mixture<SV> *>(this->_post)->NumComponentsGet(); i++)
{
result = result && this->ProposalStepInternalOne(i,sysmodel,u,measmodel,z,s);
}
return result;
}
// Proposal step for one component
template <typename SV, typename MV> bool
MixtureParticleFilter<SV,MV>::ProposalStepInternalOne(int component, SystemModel<SV> * const sysmodel,
const SV & u,
MeasurementModel<MV,SV> * const measmodel,
const MV & z,
const SV & s)
{
// Get all samples from the current post through proposal density
_old_samplesVec[component]= (dynamic_cast<MCPdf<SV> *>(dynamic_cast<Mixture<SV> *>(this->_post)->ComponentGet(component)))->ListOfSamplesGet();
_ns_it = _new_samplesVec[component].begin();
for ( _os_it=_old_samplesVec[component].begin(); _os_it != _old_samplesVec[component].end() ; _os_it++)
{
const SV& x_old = _os_it->ValueGet();
_proposal->ConditionalArgumentSet(0,x_old);
if (!sysmodel->SystemWithoutInputs())
{
_proposal->ConditionalArgumentSet(1,u);
if (this->_proposal_depends_on_meas)
{
#ifndef STATE_AND_MEAS_VAR_DIFFERENT
_proposal->ConditionalArgumentSet(2,z);
if (!measmodel->SystemWithoutSensorParams())
_proposal->ConditionalArgumentSet(3,s);
#endif
}
}
else // System without inputs
{
if (this->_proposal_depends_on_meas)
{
#ifndef STATE_AND_MEAS_VAR_DIFFERENT
_proposal->ConditionalArgumentSet(1,z);
if (!measmodel->SystemWithoutSensorParams())
_proposal->ConditionalArgumentSet(2,s);
#endif
}
}
// Bug, make sampling method a parameter!
_proposal
没有合适的资源?快使用搜索试试~ 我知道了~
No package 'orocos-bfl' found
共77个文件
h:53个
cpp:14个
pc:2个
需积分: 5 36 下载量 15 浏览量
2019-01-29
09:44:49
上传
评论 2
收藏 375KB ZIP 举报
温馨提示
在使用新的ros导航包的时候,会提示-- Checking for module 'orocos-bfl' -- No package 'orocos-bfl' found CMake Error at /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:367 (message): A required package was not found Call Stack (most recent call first): /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:532 (_pkg_check_modules_internal) navigation/robot_pose_ekf/CMakeLists.txt:6 (pkg_check_modules) 这个错误,源码的下载地址没找到,所以直接使用了编译好的。 这个压缩文件里面有4个文件夹,依次放入 opt/ros/Kinetic/目录的文件夹下,即可解决错误。
资源推荐
资源详情
资源评论
收起资源包目录
ros缺少bfl.zip (77个子文件)
ros缺少bfl
lib
liborocos-bfl.so 344KB
pkgconfig
orocos-bfl.pc 249B
bfl.pc 249B
share
bfl
package.xml 2KB
bin
bfl
test_nonlinear_kalman 39KB
test_linear_kalman 39KB
test_discrete_filter 47KB
test_kalman_smoother 51KB
test_nonlinear_particle 83KB
test_compare_filters 83KB
include
bfl
smoother
backwardfilter.h 5KB
particlesmoother.cpp 5KB
rauchtungstriebel.h 3KB
particlesmoother.h 4KB
backwardfilter.cpp 2KB
pdf
discretepdf.h 4KB
conditionalgaussian.h 3KB
filterproposaldensity.h 3KB
conditionalgaussian_additivenoise.h 3KB
mixture.h 21KB
mcpdf.h 18KB
analyticconditionalgaussian_additivenoise.h 4KB
mixture.cpp 4KB
pdf.h 8KB
EKF_proposaldensity.h 2KB
discreteconditionalpdf.h 4KB
analyticconditionalgaussian.h 2KB
gaussian.h 3KB
conditionalpdf.h 7KB
linearanalyticconditionalgaussian.h 4KB
mcpdf.cpp 5KB
uniform.h 3KB
filter
particlefilter.cpp 12KB
innovationCheck.h 2KB
filter.h 9KB
extendedkalmanfilter.h 4KB
mixtureParticleFilter.h 15KB
asirfilter.h 5KB
filter.cpp 4KB
asirfilter.cpp 5KB
EKparticlefilter.h 4KB
particlefilter.h 12KB
bootstrapfilter.h 5KB
kalmanfilter.h 6KB
mixtureBootstrapFilter.h 5KB
bootstrapfilter.cpp 3KB
mixtureParticleFilter.cpp 18KB
histogramfilter.h 3KB
SRiteratedextendedkalmanfilter.h 6KB
iteratedextendedkalmanfilter.h 4KB
mixtureBootstrapFilter.cpp 3KB
histogramfilter.cpp 4KB
model
systemmodel.cpp 4KB
discretesystemmodel.h 2KB
analyticsystemmodel_gaussianuncertainty.h 3KB
linearanalyticsystemmodel_gaussianuncertainty.h 3KB
linearanalyticmeasurementmodel_gaussianuncertainty_implicit.h 6KB
linearanalyticmeasurementmodel_gaussianuncertainty.h 3KB
systemmodel.h 6KB
analyticmeasurementmodel_gaussianuncertainty.h 3KB
measurementmodel.h 6KB
measurementmodel.cpp 5KB
bfl_err.h 1KB
sample
weightedsample.h 5KB
sample.cpp 2KB
sample.h 5KB
wrappers
matrix
vector_BOOST.h 5KB
matrix_wrapper.h 8KB
matrix_BOOST.h 6KB
matrix_LTI.h 6KB
vector_NEWMAT.h 5KB
vector_wrapper.h 6KB
matrix_NEWMAT.h 5KB
vector_LTI.h 5KB
config.h 269B
rng
rng.h 1KB
bfl_constants.h 3KB
共 77 条
- 1
资源评论
诗
- 粉丝: 1
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功