nonlinearanalyticconditionalgaussianmobile.cpp
Go to the documentation of this file.
1 // $Id: nonlinearanalyticconditionalgaussianmobile.cpp 5823 2005-10-27 13:43:02Z TDeLaet $
2 // Copyright (C) 2006 Tinne De Laet <first dot last at mech dot kuleuven dot be>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation; either version 2.1 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
20 #include <wrappers/rng/rng.h> // Wrapper around several rng
21  // libraries
22 #define NUMCONDARGUMENTS_MOBILE 2
23 
24 namespace BFL
25 {
26  using namespace MatrixWrapper;
27 
28 
30  : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,NUMCONDARGUMENTS_MOBILE)
31  {
32  }
33 
34 
36 
38  {
39  ColumnVector state = ConditionalArgumentGet(0);
40  ColumnVector vel = ConditionalArgumentGet(1);
41  state(1) += cos(state(3)) * vel(1);
42  state(2) += sin(state(3)) * vel(1);
43  state(3) += vel(2);
44  return state + AdditiveNoiseMuGet();
45  }
46 
47  Matrix NonLinearAnalyticConditionalGaussianMobile::dfGet(unsigned int i) const
48  {
49  if (i==0)//derivative to the first conditional argument (x)
50  {
51  ColumnVector state = ConditionalArgumentGet(0);
52  ColumnVector vel = ConditionalArgumentGet(1);
53  Matrix df(3,3);
54  df(1,1)=1;
55  df(1,2)=0;
56  df(1,3)=-vel(1)*sin(state(3));
57  df(2,1)=0;
58  df(2,2)=1;
59  df(2,3)=vel(1)*cos(state(3));
60  df(3,1)=0;
61  df(3,2)=0;
62  df(3,3)=1;
63  return df;
64  }
65  else
66  {
67  if (i >= NumConditionalArgumentsGet())
68  {
69  cerr << "This pdf Only has " << NumConditionalArgumentsGet() << " conditional arguments\n";
70  exit(-BFL_ERRMISUSE);
71  }
72  else{
73  cerr << "The df is not implemented for the" <<i << "th conditional argument\n";
74  exit(-BFL_ERRMISUSE);
75  }
76  }
77  }
78 
79 }//namespace BFL
80 
#define BFL_ERRMISUSE
virtual MatrixWrapper::ColumnVector ExpectedValueGet() const
Get the expected value E[x] of the pdf.
virtual MatrixWrapper::Matrix dfGet(unsigned int i) const
returns derivative from function to n-th conditional variable


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Mon Feb 28 2022 21:56:33