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