nonlinearanalyticconditionalgaussianodo.cpp
Go to the documentation of this file.
00001 // Copyright (C) 2008 Wim Meeussen <meeussen at willowgarage com>
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU Lesser General Public License as published by
00005 // the Free Software Foundation; either version 2.1 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 //
00017 
00018 #include "nonlinearanalyticconditionalgaussianodo.h"
00019 #include <bfl/wrappers/rng/rng.h> // Wrapper around several rng libraries
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     // initialize df matrix
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)//derivative to the first conditional argument (x)
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 }//namespace BFL


ekf_localization
Author(s):
autogenerated on Sat Jun 8 2019 20:11:55