Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "bayesian_filtering/nonlinearsystempdf.h"
00020 #include <wrappers/rng/rng.h>
00021
00022 #define SYSMODEL_NUMCONDARGUMENTS_MOBILE 2
00023 #define SYSMODEL_DIMENSION_MOBILE 3
00024
00025 namespace BFL
00026 {
00027 using namespace MatrixWrapper;
00028
00029 NonlinearSystemPdf::NonlinearSystemPdf(const Gaussian& additiveNoise)
00030 : ConditionalPdf<ColumnVector,ColumnVector>(SYSMODEL_DIMENSION_MOBILE,SYSMODEL_NUMCONDARGUMENTS_MOBILE)
00031 {
00032 _additiveNoise = additiveNoise;
00033 }
00034
00035 NonlinearSystemPdf::~NonlinearSystemPdf(){}
00036
00037 bool NonlinearSystemPdf::SampleFrom(Sample<ColumnVector>& one_sample, int method, void * args) const
00038 {
00039 ColumnVector state = ConditionalArgumentGet(0);
00040 ColumnVector input = ConditionalArgumentGet(1);
00041
00042
00043
00044 Matrix T_homogeneous(4,4);
00045
00046
00047 for(unsigned int row=1; row<=4; ++row)
00048 {
00049 for(unsigned int col=1; col<=4; ++col)
00050 {
00051 unsigned int index=col+(row-1)*4;
00052 T_homogeneous(row,col)=input(index);
00053 }
00054 }
00055
00056
00057 ColumnVector state_homogeneous(4);
00058 state_homogeneous=0;
00059 state_homogeneous(1)=state(1); state_homogeneous(2)=state(2); state_homogeneous(3)=state(3); state_homogeneous(4)=1.0;
00060
00061
00062 state_homogeneous=T_homogeneous * state_homogeneous;
00063
00064
00065 state(1)=state_homogeneous(1); state(2)=state_homogeneous(2); state(3)=state_homogeneous(3);
00066
00067
00068
00069 Sample<ColumnVector> noise;
00070 _additiveNoise.SampleFrom(noise, method, args);
00071
00072
00073 one_sample.ValueSet(state+noise.ValueGet());
00074
00075
00076 return true;
00077 }
00078 void NonlinearSystemPdf::AdditiveNoiseSigmaSet(const MatrixWrapper::SymmetricMatrix &sigma)
00079 {
00080 _additiveNoise.CovarianceSet(sigma);
00081 }
00082
00083
00084 }
00085