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 #include "nonlinearanalyticconditionalgaussianodo.h"
00019 #include <bfl/wrappers/rng/rng.h>
00020 #define NUMCONDARGUMENTS_MOBILE 2
00021
00022 namespace BFL
00023 {
00024 using namespace MatrixWrapper;
00025
00026
00027 NonLinearAnalyticConditionalGaussianOdo::NonLinearAnalyticConditionalGaussianOdo(const Gaussian& additiveNoise)
00028 : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,NUMCONDARGUMENTS_MOBILE),
00029 df(6,6)
00030 {
00031
00032 for (unsigned int i=1; i<=6; i++)
00033 {
00034 for (unsigned int j=1; j<=6; j++)
00035 {
00036 if (i==j) df(i,j) = 1;
00037 else df(i,j) = 0;
00038 }
00039 }
00040 }
00041
00042
00043 NonLinearAnalyticConditionalGaussianOdo::~NonLinearAnalyticConditionalGaussianOdo(){}
00044
00045 ColumnVector NonLinearAnalyticConditionalGaussianOdo::ExpectedValueGet() const
00046 {
00047 ColumnVector state = ConditionalArgumentGet(0);
00048 ColumnVector vel = ConditionalArgumentGet(1);
00049 state(1) += cos(state(6)) * vel(1);
00050 state(2) += sin(state(6)) * vel(1);
00051 state(6) += vel(2);
00052 return state + AdditiveNoiseMuGet();
00053 }
00054
00055 Matrix NonLinearAnalyticConditionalGaussianOdo::dfGet(unsigned int i) const
00056 {
00057 if (i==0)
00058 {
00059 double vel_trans = ConditionalArgumentGet(1)(1);
00060 double yaw = ConditionalArgumentGet(0)(6);
00061
00062 df(1,3)=-vel_trans*sin(yaw);
00063 df(2,3)= vel_trans*cos(yaw);
00064
00065 return df;
00066 }
00067 else
00068 {
00069 if (i >= NumConditionalArgumentsGet())
00070 {
00071 cerr << "This pdf Only has " << NumConditionalArgumentsGet() << " conditional arguments\n";
00072 exit(-BFL_ERRMISUSE);
00073 }
00074 else{
00075 cerr << "The df is not implemented for the" <<i << "th conditional argument\n";
00076 exit(-BFL_ERRMISUSE);
00077 }
00078 }
00079 }
00080
00081 }