TooN Algorithm Library - tag  0.2
constantposition.h
Go to the documentation of this file.
1 #ifndef TAG_CONSTANTPOSITION_H
2 #define TAG_CONSTANTPOSITION_H
3 
4 #include <TooN/se3.h>
5 
6 namespace tag {
7 
8 namespace ConstantPosition {
9 
14 
18 class State {
19 public:
20  State(void){
21  reset();
22  }
23 
24  void reset(void){
25  pose = TooN::SE3<>();
26  covariance = TooN::Identity;
27  }
28 
29  static const int STATE_DIMENSION = 6;
30  TooN::SE3<> pose;
31  TooN::Matrix<STATE_DIMENSION> covariance;
32 };
33 
36 template <class O>
37 O & operator<< (O & os , const State & st){
38  os << st.pose.ln() << st.pose.inverse().get_translation();
39  return os;
40 }
41 
46 class Model {
47 public:
49  TooN::Vector<State::STATE_DIMENSION> sigma;
51  TooN::Matrix<State::STATE_DIMENSION> jacobian;
53  TooN::Matrix<State::STATE_DIMENSION> noise;
54 
55  Model(void){
56  sigma = TooN::Zeros;
57  noise = TooN::Zeros;
58  jacobian = TooN::Identity;
59  }
60 
62  TooN::Matrix<State::STATE_DIMENSION> & getJacobian(const State & state, double dt){
63  return jacobian;
64  }
65 
66  void updateState( State & state, const double dt ){
67  }
68 
69  TooN::Matrix<State::STATE_DIMENSION> & getNoiseCovariance( double dt ){
70  for(unsigned int i = 0; i < 6; i++){
71  noise(i,i) = dt * sigma[i];
72  }
73  return noise;
74  }
75 
76  void updateFromMeasurement( State & state, const TooN::Vector<State::STATE_DIMENSION> & innovation ){
77  state.pose = TooN::SE3<>::exp(innovation) * state.pose;
78  }
79 };
80 
81 } // namespace ConstantPosition
82 
83 } // namespace tag
84 
85 #endif