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/nonlinearanalyticconditionalgaussian3D.h"
00020 #include <wrappers/rng/rng.h>
00021
00022 #define NUMCONDARGUMENTS_MOBILE 2
00023
00024 namespace BFL
00025 {
00026 using namespace MatrixWrapper;
00027
00028
00029 NonLinearAnalyticConditionalGaussian3D::NonLinearAnalyticConditionalGaussian3D(const Gaussian& additiveNoise)
00030 : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,NUMCONDARGUMENTS_MOBILE)
00031 {}
00032
00033 NonLinearAnalyticConditionalGaussian3D::~NonLinearAnalyticConditionalGaussian3D(){}
00034
00035 ColumnVector NonLinearAnalyticConditionalGaussian3D::ExpectedValueGet() const
00036 {
00037 ColumnVector state = ConditionalArgumentGet(0);
00038 ColumnVector input = ConditionalArgumentGet(1);
00039
00040
00041 Matrix T_homogeneous(4,4);
00042 T_homogeneous=0;
00043
00044
00045 T_homogeneous(1,1)=1.0;
00046 T_homogeneous(2,2)=1.0;
00047 T_homogeneous(3,3)=1.0;
00048
00049
00050 T_homogeneous(1,4)=input(1);
00051 T_homogeneous(2,4)=input(2);
00052 T_homogeneous(3,4)=input(3);
00053 T_homogeneous(4,4)=1.0;
00054
00055
00056 ColumnVector state_homogeneous(4);
00057 state_homogeneous=0;
00058 state_homogeneous(1)=state(1); state_homogeneous(2)=state(2); state_homogeneous(3)=state(3); state_homogeneous(4)=1.0;
00059
00060
00061 state_homogeneous=T_homogeneous * state_homogeneous;
00062
00063
00064 state(1)=state_homogeneous(1); state(2)=state_homogeneous(2); state(3)=state_homogeneous(3);
00065 return state + AdditiveNoiseMuGet();
00066 }
00067
00068 Matrix NonLinearAnalyticConditionalGaussian3D::dfGet(unsigned int i) const
00069 {
00070 if (i==0)
00071 {
00072 ColumnVector state = ConditionalArgumentGet(0);
00073 ColumnVector vel = ConditionalArgumentGet(1);
00074 Matrix df(3,3);
00075 df(1,1)=1;
00076 df(1,2)=0;
00077 df(1,3)=-vel(1)*sin(state(3));
00078 df(2,1)=0;
00079 df(2,2)=1;
00080 df(2,3)=vel(1)*cos(state(3));
00081 df(3,1)=0;
00082 df(3,2)=0;
00083 df(3,3)=1;
00084
00085
00086 return df;
00087 }
00088 else
00089 {
00090 if (i >= NumConditionalArgumentsGet())
00091 {
00092 cerr << "This pdf Only has " << NumConditionalArgumentsGet() << " conditional arguments\n";
00093 exit(-BFL_ERRMISUSE);
00094 }
00095 else
00096 {
00097 cerr << "The df is not implemented for the" <<i << "th conditional argument\n";
00098 exit(-BFL_ERRMISUSE);
00099 }
00100 }
00101 }
00102
00103 }
00104
00105