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
00020 #ifndef __NON_LINEAR_SYSTEM_CONDITIONAL_GAUSSIAN_MOBILE__
00021 #define __NON_LINEAR_SYSTEM_CONDITIONAL_GAUSSIAN_MOBILE__
00022
00023 #include <pdf/analyticconditionalgaussian_additivenoise.h>
00024
00025 namespace BFL
00026 {
00028
00034 class NonLinearAnalyticConditionalGaussianMobile : public AnalyticConditionalGaussianAdditiveNoise
00035 {
00036 public:
00038
00047 NonLinearAnalyticConditionalGaussianMobile( const Gaussian& additiveNoise);
00048
00050 virtual ~NonLinearAnalyticConditionalGaussianMobile();
00051
00052
00053 virtual MatrixWrapper::ColumnVector ExpectedValueGet() const;
00054 virtual MatrixWrapper::Matrix dfGet(unsigned int i) const;
00055 };
00056
00057 }
00058
00059 #endif //// $Id: nonlinearanalyticconditionalgaussianmobile.cpp 5823 2005-10-27 13:43:02Z TDeLaet $
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #include "bayesian_filtering/nonlinearanalyticconditionalgaussianmobile.h"
00078 #include <wrappers/rng/rng.h>
00079
00080 #define NUMCONDARGUMENTS_MOBILE 2
00081
00082 namespace BFL
00083 {
00084 using namespace MatrixWrapper;
00085
00086
00087 NonLinearAnalyticConditionalGaussianMobile::NonLinearAnalyticConditionalGaussianMobile(const Gaussian& additiveNoise)
00088 : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,NUMCONDARGUMENTS_MOBILE)
00089 {}
00090
00091
00092 NonLinearAnalyticConditionalGaussianMobile::~NonLinearAnalyticConditionalGaussianMobile(){}
00093 void angleOverflowCorrect(double& a)
00094 {
00095 while ((a) > M_PI) a -= 2*M_PI;
00096 while ((a) < -M_PI) a += 2*M_PI;
00097 }
00098 ColumnVector NonLinearAnalyticConditionalGaussianMobile::ExpectedValueGet() const
00099 {
00100
00101 ColumnVector state = ConditionalArgumentGet(0);
00102 ColumnVector delta_odom = ConditionalArgumentGet(1)+AdditiveNoiseMuGet();
00103 state(1) += cos(state(3)+delta_odom(1))*delta_odom(2);
00104 state(2) += sin(state(3)+delta_odom(1))*delta_odom(2);
00105 state(3) += delta_odom(1)+delta_odom(3);
00106 angleOverflowCorrect(state(3));
00107 return state;
00108 }
00109
00110 Matrix NonLinearAnalyticConditionalGaussianMobile::dfGet(unsigned int i) const
00111 {
00112 if (i==0)
00113 {
00114 ColumnVector state = ConditionalArgumentGet(0);
00115 ColumnVector delta_odom = ConditionalArgumentGet(1);
00116
00117
00118 Matrix df(3,3);
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 df(1,1)=1;
00133 df(1,2)=0;
00134 df(1,3)=-sin(state(3)+delta_odom(1))*delta_odom(2);
00135 df(2,1)=0;
00136 df(2,2)=1;
00137 df(2,3)=cos(state(3)+delta_odom(1))*delta_odom(2);
00138 df(3,1)=0;
00139 df(3,2)=0;
00140 df(3,3)=1;
00141
00142 return df;
00143 }
00144 else
00145 {
00146 if (i >= NumConditionalArgumentsGet())
00147 {
00148 cerr << "This pdf Only has " << NumConditionalArgumentsGet() << " conditional arguments\n";
00149 exit(-BFL_ERRMISUSE);
00150 }
00151 else{
00152 cerr << "The df is not implemented for the" <<i << "th conditional argument\n";
00153 exit(-BFL_ERRMISUSE);
00154 }
00155 }
00156 }
00157
00158 }
00159