OSVR-Core
PureVectorState.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_PureVectorState_h_GUID_5347542B_F2F6_46A2_E49B_3EF0B0A9F9ED
26 #define INCLUDED_PureVectorState_h_GUID_5347542B_F2F6_46A2_E49B_3EF0B0A9F9ED
27 
28 // Internal Includes
29 #include "FlexibleKalmanBase.h"
30 
31 // Library/third-party includes
32 // - none
33 
34 // Standard includes
35 // - none
36 namespace osvr {
37 namespace kalman {
40  template <types::DimensionType Dim = 3> class PureVectorState {
41  public:
42  static const types::DimensionType DIMENSION = Dim;
45 
46  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47  PureVectorState(double x, double y, double z)
48  : m_state(x, y, z), m_errorCovariance(SquareMatrix::Zero()) {
49  static_assert(DIMENSION == 3, "This constructor, which takes 3 "
50  "scalars, only works with a 3D "
51  "vector!");
52  }
53 
54  PureVectorState(double x, double y, double z,
55  SquareMatrix const &covariance)
56  : m_state(x, y, z), m_errorCovariance(covariance) {
57  static_assert(DIMENSION == 3, "This constructor, which takes 3 "
58  "scalars, only works with a 3D "
59  "vector!");
60  }
61 
62  PureVectorState(StateVector const &state,
63  SquareMatrix const &covariance)
64  : m_state(state), m_errorCovariance(covariance) {}
68  void setStateVector(StateVector const &state) { m_state = state; }
70  StateVector const &stateVector() const { return m_state; }
71  // set P
72  void setErrorCovariance(SquareMatrix const &errorCovariance) {
73  m_errorCovariance = errorCovariance;
74  }
76  SquareMatrix const &errorCovariance() const {
77  return m_errorCovariance;
78  }
79  void postCorrect() {}
81  private:
83  StateVector m_state;
85  SquareMatrix m_errorCovariance;
86  };
87 
88 } // namespace kalman
89 } // namespace osvr
90 #endif // INCLUDED_PureVectorState_h_GUID_5347542B_F2F6_46A2_E49B_3EF0B0A9F9ED
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
SquareMatrix const & errorCovariance() const
P.
Definition: PureVectorState.h:76
StateVector const & stateVector() const
xhat
Definition: PureVectorState.h:70
std::size_t DimensionType
Type for dimensions.
Definition: FlexibleKalmanBase.h:51
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
A very simple (3D by default) vector state with no velocity, ideal for use as a position, with ConstantProcess for beacon autocalibration.
Definition: PureVectorState.h:40