亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fastslam.cpp

?? bias kalman濾波的C類庫
?? CPP
字號:
/* * Bayes++ the Bayesian Filtering Library * Copyright (c) 2004 Michael Stevens * See accompanying Bayes++.htm for terms and conditions of use. * * $Header: /cvsroot/bayesclasses/Bayes++/SLAM/fastSLAM.cpp,v 1.1.2.8 2005/07/16 07:47:34 mistevens Exp $ *//* * SLAM : Simultaneous Locatization and Mapping *  FastSLAM augmented particle algorithm *  Direct implementation without log(n) tree pruneing for associated observations */		// Bayes++ Bayesian filtering schemes#include "BayesFilter/SIRFlt.hpp"		// Types required for SLAM classes#include <map>		// Bayes++ SLAM#include "SLAM.hpp"#include "fastSLAM.hpp"#include <cmath>namespace {	template <class scalar>	inline scalar sqr(scalar x)	{		return x*x;	}}namespace SLAM_filter{Fast_SLAM::Fast_SLAM( BF::SIR_scheme& L_filter ) :	SLAM(),	L(L_filter),	wir(L.S.size2())// Construct filter using referenced SIR_filter for resampling{	std::fill (wir.begin(), wir.end(), Float(1.));		// Initial uniform weights	wir_update = false;}void Fast_SLAM::observe_new( unsigned feature, const Feature_observe_inverse& fom, const FM::Vec& z )/* * SLAM New Feature observation (overwrite) * Assumes there is no prior information about the feature (strictly a uniform un-informative prior) * * This implies *  a) There has no information about location so no resampling is requires *  b) Feature Posterior estimated directly from observation using inormation form * * fom: must have a the special from required for SLAM::obeserve_new */{	assert(z.size() == 1);		// Only single state observation supported	const std::size_t nL = L.S.size1();	// No of location states	const std::size_t nparticles = L.S.size2();	FeatureCondMap fmap(nparticles);	FM::Vec sz(nL+1);						// Location state	for (std::size_t pi = 0; pi < nparticles; ++pi)	{		sz.sub_range(0,nL) = FM::column (L.S, pi);		sz[nL] = z[0];		FM::Vec t = fom.h(sz);		fmap[pi].x = t[0];		fmap[pi].X = fom.Zv[0];	}	M.insert (std::make_pair(feature, fmap));}void Fast_SLAM::observe_new( unsigned feature, const FM::Float& t, const FM::Float& T )/* * SLAM New observation directly of state statistics (overwrite) */{	const std::size_t nparticles = L.S.size2();	Feature_1 m1;  				// single map feature	FeatureCondMap fmap(nparticles);	m1.x = t;			   // Initial particle conditional map is sample	m1.X = T;		    // independant	std::fill(fmap.begin(),fmap.end(), m1);	M.insert (std::make_pair(feature, fmap));}void Fast_SLAM::observe( unsigned feature, const Feature_observe& fom, const FM::Vec& z )/* * SLAM Feature observation *  Uses Extended Fast_SLAM observation equations * Note: Mathematically only weight ratios are important. Numerically however the range should be restricted. * The weights are computed here using the simplist form with common factor Ht removed. */{	assert(z.size() == 1);		// Only single state observation supported	const AllFeature::iterator inmap = M.find(feature);	if (inmap == M.end())	{		error (BF::Logic_exception("Observe non existing feature"));		return;	}								// Existing feature	FeatureCondMap& afm = (*inmap).second;	// Reference the associated feature map	const std::size_t nL = L.S.size1();	// No of location states	const std::size_t nparticles = L.S.size2();	Float Ht = fom.Hx(0,nL);	if (Ht == 0)		error (BF::Numeric_exception("observe Hx feature component zero"));							// Loop in invariants and temporary storage	FM::Vec x2(nL+1);					// Augmented state (particle + feature mean)	FM::Vec znorm(z.size());	const Float Z = fom.Zv[0];							// Iterate over particles	for (std::size_t pi = 0; pi != nparticles; ++pi)	{		Feature_1& m1 = afm[pi];		// Associated feature's map particle									x2.sub_range(0,nL) = FM::column (L.S, pi);		// Build Augmented state x2		x2[nL] = m1.x;		const FM::Vec& zp = fom.h(x2);	// Observation model		znorm = z;									// Normalised observation		fom.normalise(znorm, zp);														// Observation innovation and innovation variance		const Float s = (znorm[0] - zp[0]);		const Float S = sqr(Ht) * m1.X + Z;		if (S <= 0)			error (BF::Numeric_exception("Conditional feature estimate not PD"));		const Float sqrtS  = std::sqrt (S);		// Drop Ht which is a common factor for all weights										// Multiplicative fusion of observation weights, integral of Gaussian product g(p,P)*g(q,Q) 		wir[pi] *= exp(Float(-0.5)* sqr(s) / S) / sqrtS;										// Estimate associated features conditional map for resampled particles		Float W = m1.X*Ht / S;	// EKF for conditional feature observation - specialised for 1D and zero state uncertianty		m1.x += W * (znorm[0] - zp[0]);		m1.X -= sqr(W) * S;	}	wir_update = true;			// Weights have been updated requiring a resampling}Fast_SLAM::Float Fast_SLAM::update_resample( const Bayesian_filter::Importance_resampler& resampler )/* Resampling Update *  Resample particles using weights *  Propogate resampling to All features *  Only resamples if weights have been updated */{	if (wir_update)	{		const std::size_t nparticles = L.S.size2();		Resamples_t presamples(nparticles);		std::size_t R_unique;			// Determine resamples of S		Float lcond = resampler.resample (presamples, R_unique, wir, L.random);									// Initial uniform weights		std::fill (wir.begin(), wir.end(), Float(1.));		wir_update = false;									// Update S bases on resampling, and init filter		L.copy_resamples (L.S, presamples);		L.init_S ();									// Propogate resampling to All features		FeatureCondMap fmr(nparticles);		// Resampled feature map		for (AllFeature::iterator fi = M.begin(); fi != M.end(); ++fi)	// All Features		{			FeatureCondMap& fm = (*fi).second;		// Reference the feature map										// Iterate over All feature particles			FeatureCondMap::iterator fmi, fmi_begin = fm.begin(), fmi_end = fm.end();			FeatureCondMap::iterator fmri = fmr.begin();			for (fmi = fmi_begin; fmi < fmi_end; ++fmi)			{							// Multiple copies of this resampled feature				for (std::size_t res = presamples[fmi-fmi_begin]; res > 0; --res) {					*fmri = *fmi;					++fmri;				}			}			fm = fmr;				// Copy in resamples feature map		}		L.roughen ();				// Roughen location		L.stochastic_samples = R_unique;		return lcond;	}	else		return 1.;		// No resampling}void Fast_SLAM::forget( unsigned feature, bool must_exist )// Forget all feature information, feature no can be reused for a new feature{	AllFeature::size_type n = M.erase(feature);	if (n == 0 && must_exist)		error (BF::Logic_exception("Forget non existing feature"));}std::size_t Fast_SLAM::feature_unique_samples( unsigned feature )/* * Count the number of unique samples in S associated with a feature */{	const AllFeature::iterator inmap = M.find(feature);	if (inmap == M.end())	{		error (BF::Logic_exception("feature_unique_samples non existing feature"));		return 0;	}								// Existing feature	FeatureCondMap& afm = (*inmap).second;	// Reference the associated feature map	typedef FeatureCondMap::iterator Sref;	// Provide a ordering on feature sample means	struct order {		static bool less(Sref a, Sref b)		{			return (*a).x < (*b).x;		}	};						// Sorted reference container	typedef std::vector<Sref> SRContainer;	SRContainer sortR(afm.size());						// Reference each element in S	{	Sref elem = afm.begin();		SRContainer::iterator ssi = sortR.begin();		for (; ssi < sortR.end(); ++ssi)		{			*ssi = elem; ++elem;		}	}	std::sort (sortR.begin(), sortR.end(), order::less);						// Count element changes, precond: sortS not empty	std::size_t u = 1;	SRContainer::const_iterator ssi= sortR.begin();	SRContainer::const_iterator ssp = ssi;	++ssi;	while (ssi < sortR.end())	{		if (order::less(*ssp, *ssi))			++u;		ssp = ssi;		++ssi;	}	return u;}/* * Fast_SLAM_Kstatistics */Fast_SLAM_Kstatistics::Fast_SLAM_Kstatistics( BF::SIR_kalman_scheme& L_filter ) :	Fast_SLAM(L_filter), L(L_filter)// Construct filter using referenced SIR_filter for resampling{}void Fast_SLAM_Kstatistics::statistics_feature(		BF::Kalman_state_filter& kstat, std::size_t fs,		const AllFeature::const_iterator& fi, const AllFeature::const_iterator& fend ) const/* * Compute sample mean and covariance statistics of feature * We use the Maximum Likelihood (bias) estimate definition of covariance (1/n) *  fs is subscript in kstat to return statisics *  fi iterator of feature *  fend end of map iterator (statistics are computed for fi with a map subset) * * Numerics *  No check is made for the conditioning of samples with regard to mean and covariance *  Extreme ranges or very large sample sizes will result in inaccuracy *  The covariance should always remain PSD however *  * Precond: kstat contains location mean */{	const std::size_t nL = L.S.size1();	// No of location states	const std::size_t nparticles = L.S.size2();	const FeatureCondMap& fm = (*fi).second;		// Reference the feature map									// Iterate over All feature particles	FeatureCondMap::const_iterator fpi, fpi_begin = fm.begin(), fpi_end = fm.end();	Float mean_f = 0;				// Feature mean	for (fpi = fpi_begin; fpi < fpi_end; ++fpi)	{		mean_f += (*fpi).x;	}	mean_f /= Float(nparticles);	Float var_f = 0;				// Feature variance: is ML estimate given estimated mean	for (fpi = fpi_begin; fpi < fpi_end; ++fpi) {		var_f += (*fpi).X + sqr((*fpi).x - mean_f);	}	var_f /= Float(nparticles);	kstat.x[fs] = mean_f;			// Copy into Kalman statistics	kstat.X(fs,fs) = var_f;									// Location,feature covariance	for (std::size_t si = 0; si < nL; ++si)	{		Float covar_f_si = 0;		std::size_t spi = 0;		const Float mean_si = kstat.x[si];		for (fpi = fpi_begin; fpi < fpi_end; ++fpi, ++spi) {			covar_f_si += ((*fpi).x - mean_f) * (L.S(si,spi) - mean_si);		}		covar_f_si /= Float(nparticles);		kstat.X(si,fs) = covar_f_si;	}									// Feature,feature covariance. Iterate over previous features with means already computed	std::size_t fsj = nL;				// Feature subscript	for (AllFeature::const_iterator fj = M.begin(); fj != fend; ++fj, ++fsj)	{		Float covar_f_fi = 0;		FeatureCondMap::const_iterator fpj = (*fj).second.begin();		const Float mean_fi = kstat.x[fsj];		for (fpi = fpi_begin; fpi < fpi_end; ++fpi) {			covar_f_fi += ((*fpi).x - mean_f) * ((*fpj).x - mean_fi);			++fpj;		}		covar_f_fi /= Float(nparticles);		kstat.X(fs,fsj) = covar_f_fi;	}}void Fast_SLAM_Kstatistics::statistics_compressed( BF::Kalman_state_filter& kstat )/* * Compute sample mean and covariance statistics of filter *   *  kstat elements are filled first with Location statistics and then the Map feature statistics *  Feature statisics are are computed in feature number order and only for those for which there is space in kstat * Note: Covariance values are indeterminate for nparticles ==1 * Precond: *   nparticles >=1 (enforced by Sample_filter contruction) *   kstat must have space for Location statistics * Postcond: *  kstat compressed sample statisics of filter */{		const std::size_t nL = L.S.size1();	// No of location states	kstat.x.clear();			// Zero everything (required only for non existing feature states	kstat.X.clear();			// Zero everything (required only for non existing feature states								// Get Location statistics	if (nL > kstat.x.size())		error (BF::Logic_exception("kstat to small to hold filter locatition statistics"));	L.update_statistics();	FM::noalias(kstat.x.sub_range(0,nL)) = L.x;	FM::noalias(kstat.X.sub_matrix(0,nL, 0,nL)) = L.X;								// Iterated over feature statistics (that there is space for in kstat)	std::size_t fs = nL;						// Feature subscript	for (AllFeature::const_iterator fi = M.begin(); fi != M.end() && fs < kstat.x.size(); ++fi, ++fs)	{		statistics_feature(kstat, fs, fi, fi);	// build statistics of fi with other features up to fi	}}//statistics_compressedvoid Fast_SLAM_Kstatistics::statistics_sparse( BF::Kalman_state_filter& kstat )/* * Compute sample mean and covariance statistics of filter *   *  kstat elements are filled first with Location statistics and then the Map feature statistics *  Feature statisics are are computed in feature number as index (after location) and only for those for which there is space in kstat * Note: Covariance values are indeterminate for nparticles ==1 * Precond: *   nparticles >=1 (enforced by Sample_filter contruction) *   kstat must have space for Location statistics * Postcond: *  kstat sparse sample statisics of filter */{		const std::size_t nL = L.S.size1();	// No of location states	kstat.x.clear();			// Zero everything (required only for non existing feature states	kstat.X.clear();			// Zero everything (required only for non existing feature states								// Get Location statistics	if (nL > kstat.x.size())		error (BF::Logic_exception("kstat to small to hold filter locatition statistics"));	L.update_statistics();	FM::noalias(kstat.x.sub_range(0,nL)) = L.x;	FM::noalias(kstat.X.sub_matrix(0,nL, 0,nL)) = L.X;								// Iterated over feature statistics (that there is space for in kstat)	for (AllFeature::const_iterator fi = M.begin(); fi != M.end(); ++fi)	{		std::size_t fs = nL + (*fi).first;		// Feature subscript		if (fs < kstat.x.size())			// Space in kstat		{			statistics_feature(kstat, fs, fi, fi);	// build statistics of fi with other features up to fi		}	}//all feature}//statistics_sparse}//namespace SLAM

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区果冻传媒| 日本aⅴ免费视频一区二区三区 | 精品在线播放免费| 性欧美疯狂xxxxbbbb| 一区二区免费视频| 亚洲最大成人综合| 亚洲gay无套男同| 99久久婷婷国产精品综合| 日韩av电影一区| 日韩精品一二三| 日韩精品一区第一页| 视频一区二区三区在线| 日韩在线一二三区| 麻豆精品国产91久久久久久| 蜜臀久久99精品久久久画质超高清| 丝瓜av网站精品一区二区| 日韩在线播放一区二区| 久久精品久久久精品美女| 久久99久久久欧美国产| 国产成a人亚洲精品| 99久久久无码国产精品| 在线日韩av片| 日韩欧美一二三| 国产人成一区二区三区影院| 综合色中文字幕| 亚洲综合激情另类小说区| 日韩专区一卡二卡| 国产乱码精品一区二区三区忘忧草 | 国产精品福利av| 一区二区三区在线观看视频| 天堂资源在线中文精品| 激情综合网最新| 91视频你懂的| 日韩欧美国产电影| 中文字幕日本不卡| 日韩中文欧美在线| 成人动漫av在线| 欧美美女一区二区| 国产日韩欧美一区二区三区综合| 亚洲欧美一区二区三区国产精品| 视频一区欧美日韩| a亚洲天堂av| 欧美一区二区三区日韩| 亚洲欧美自拍偷拍| 久久99精品网久久| 欧美在线你懂得| 国产日产欧美一区| 全部av―极品视觉盛宴亚洲| 99久久婷婷国产综合精品电影| 日韩欧美在线1卡| 亚洲激情校园春色| 国产成人精品1024| 日韩精品一区二区三区在线| 韩国欧美国产1区| 色久综合一二码| 欧美激情一区二区三区蜜桃视频 | 欧美在线三级电影| 日本一区二区三区电影| 看电影不卡的网站| 欧美色精品在线视频| 一区在线观看视频| 国产成人午夜电影网| 日韩天堂在线观看| 首页综合国产亚洲丝袜| 91原创在线视频| 日本一区二区高清| 国产一区二区视频在线播放| 欧美一区二区精品在线| 亚洲影院理伦片| 色婷婷综合激情| 最新热久久免费视频| 国产成a人无v码亚洲福利| 欧美不卡激情三级在线观看| 亚洲国产精品久久艾草纯爱 | 中文字幕永久在线不卡| 国产精品一级在线| 国产亚洲精品久| 国产成人在线视频网站| 久久久久久亚洲综合影院红桃| 久久99蜜桃精品| 久久综合五月天婷婷伊人| 捆绑调教美女网站视频一区| 日韩一区二区三区视频| 久久99精品国产麻豆婷婷| 日韩视频国产视频| 美女精品自拍一二三四| 欧美v国产在线一区二区三区| 午夜欧美大尺度福利影院在线看| 欧美视频你懂的| 亚洲大片精品永久免费| 色欧美88888久久久久久影院| 综合在线观看色| 欧美伊人久久久久久午夜久久久久| 亚洲精选在线视频| 欧美日韩激情一区| 免费的成人av| 国产午夜精品久久| 91免费小视频| 视频一区欧美日韩| 国产偷国产偷精品高清尤物| 不卡视频一二三| 亚洲伦在线观看| 宅男在线国产精品| 国产乱码字幕精品高清av | 国产精品久线观看视频| 色综合中文字幕国产| 亚洲婷婷国产精品电影人久久| 91精品办公室少妇高潮对白| 日韩不卡手机在线v区| 久久人人爽人人爽| 欧美性色黄大片| 精油按摩中文字幕久久| 国产精品水嫩水嫩| 欧美日本一区二区三区四区| 韩国三级在线一区| 亚洲午夜精品久久久久久久久| 欧美一区二区三区在| av一区二区三区| 日韩成人精品在线| 亚洲人成在线播放网站岛国| 欧美一区二区三区在线观看视频| 成人精品亚洲人成在线| 三级在线观看一区二区 | 成人午夜私人影院| 日本不卡视频在线观看| 中文字幕制服丝袜一区二区三区 | 日本欧美一区二区| 国产精品国产自产拍在线| 日韩一区二区三区高清免费看看 | 中文字幕一区在线| 欧美成人伊人久久综合网| 色素色在线综合| 国产91精品一区二区麻豆亚洲| 日韩高清国产一区在线| 中文字幕一区二区三区在线观看 | 久久国内精品视频| 一区二区三区蜜桃| **网站欧美大片在线观看| 精品三级av在线| 久久亚洲精华国产精华液| 91福利视频网站| 99免费精品在线观看| 国产老妇另类xxxxx| 青椒成人免费视频| 午夜影院久久久| 一区二区三区自拍| 亚洲日本一区二区| 国产精品久久一级| 国产精品麻豆视频| 国产亚洲综合色| 国产午夜精品福利| 亚洲精品在线一区二区| 欧美一区二区精品久久911| 欧美色网一区二区| 欧美日韩大陆一区二区| 欧美日韩国产综合一区二区| 欧日韩精品视频| 在线观看日韩精品| 欧美体内she精高潮| 在线观看av不卡| 欧美日韩亚洲综合| 欧美精选在线播放| 日韩亚洲欧美高清| 精品国产91九色蝌蚪| 久久久精品欧美丰满| 国产欧美一区二区精品忘忧草| 久久久亚洲高清| 日本一区二区三区高清不卡| 国产精品久久久久久亚洲伦| 中文字幕一区二区三区在线观看| 亚洲色图制服丝袜| 一区二区三区四区高清精品免费观看 | 悠悠色在线精品| 亚洲电影视频在线| 精品一区二区三区视频| 国产毛片精品一区| bt7086福利一区国产| 在线亚洲一区观看| 日韩你懂的在线播放| 国产欧美日韩另类视频免费观看| 国产精品动漫网站| 五月天激情综合网| 国产成人亚洲综合a∨婷婷图片| 97成人超碰视| 欧美一二区视频| 中文字幕国产一区| 视频一区欧美日韩| 国产91丝袜在线18| 欧美日韩综合色| 久久久久久一二三区| 亚洲久草在线视频| 精品一区二区三区免费毛片爱 | 日韩久久一区二区| 午夜在线电影亚洲一区| 国产99精品国产| 欧美人妇做爰xxxⅹ性高电影| 久久蜜桃一区二区| 天堂一区二区在线| av成人免费在线观看| 欧美mv日韩mv国产网站app|