odometry
State.hpp
Go to the documentation of this file.
1 #ifndef __ODOMETRY_STATE_HPP__
2 #define __ODOMETRY_STATE_HPP__
3 
4 #include <Eigen/Core>
5 #include <base/Time.hpp>
6 #include <base/Pose.hpp>
7 
8 namespace odometry
9 {
13  template <class BodyState_>
14  class State
15  {
16  public:
17  State()
18  : update_counter(0) {}
19 
20  virtual ~State() {};
21 
26  virtual void update( const BodyState_& state )
27  {
28  // make the current configuration the previous configuration
29  state_k = state_kp;
30  // set the current configuration with the new values
31  state_kp = state;
33  }
34 
39  bool isValid()
40  {
41  return update_counter > 1;
42  }
43 
48  base::Time getTimeDelta() const
49  {
50  return state_kp.time - state_k.time;
51  }
52 
53  const BodyState_& getCurrent() const
54  {
55  return state_kp;
56  }
57 
58  const BodyState_& getPrevious() const
59  {
60  return state_k;
61  }
62 
63  protected:
65 
67  BodyState_ state_k, state_kp;
68  };
69 }
70 
71 #endif
bool isValid()
Definition: State.hpp:39
State()
Definition: State.hpp:17
const BodyState_ & getPrevious() const
Definition: State.hpp:58
BodyState_ state_k
Definition: State.hpp:67
size_t update_counter
Definition: State.hpp:64
virtual ~State()
Definition: State.hpp:20
base::Time getTimeDelta() const
Definition: State.hpp:48
BodyState_ state_kp
Definition: State.hpp:67
Definition: State.hpp:14
const BodyState_ & getCurrent() const
Definition: State.hpp:53
virtual void update(const BodyState_ &state)
Definition: State.hpp:26
Definition: BodyState.cpp:5