OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
RunningData.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_RunningData_h_GUID_6B3479E5_9D56_4BA9_DEC0_84AF53842168
26 #define INCLUDED_RunningData_h_GUID_6B3479E5_9D56_4BA9_DEC0_84AF53842168
27 
28 #ifdef OSVR_VIDEOIMUFUSION_VERBOSE
29 #include <iostream>
31 template <typename T>
32 inline void dumpKalmanDebugOuput(const char name[], const char expr[],
33  T const &value) {
34  std::cout << "\n(Kalman Debug Output) " << name << " [" << expr << "]:\n"
35  << value << std::endl;
36 }
37 
38 #define OSVR_KALMAN_DEBUG_OUTPUT(Name, Value) \
39  dumpKalmanDebugOuput(Name, #Value, Value)
40 
41 #endif // OSVR_VIDEOIMUFUSION_VERBOSE
42 
43 // Internal Includes
44 #include "VideoIMUFusion.h"
45 #include "FusionParams.h"
46 #include <osvr/Util/EigenInterop.h>
47 #include <osvr/Util/TimeValue.h>
48 
50 #if 0
55 #endif
56 
57 #include <osvr/Util/Verbosity.h>
58 
59 // Library/third-party includes
60 // - none
61 
62 // Standard includes
63 // - none
64 
67 #if 0
68 using AbsoluteOrientationMeasurement =
70 using AbsolutePositionMeasurement =
72 using AngularVelocityMeasurement =
74 #endif
76  public:
77  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
78  RunningData(VideoIMUFusionParams const &params,
79  Eigen::Isometry3d const &rTc,
80  OSVR_OrientationState const &initialIMU,
81  OSVR_PoseState const &initialVideo,
82  OSVR_TimeValue const &lastTS);
83 
84  void handleIMUReport(const OSVR_TimeValue &timestamp,
85  const OSVR_OrientationReport &report);
86  void handleIMUVelocity(const OSVR_TimeValue &timestamp,
87  const Eigen::Vector3d &angVel);
88  void handleVideoTrackerReport(const OSVR_TimeValue &timestamp,
89  const OSVR_PoseReport &report);
90 
92  bool preReport(const OSVR_TimeValue &timestamp);
93 
94  Eigen::Quaterniond getOrientation() const {
95  return state().getQuaternion();
96  }
97  Eigen::Vector3d getPosition() const { return state().position(); }
98 
99  Eigen::Isometry3d takeCameraPoseToRoom(OSVR_PoseState const &pose) {
100  return m_rTc * osvr::util::eigen_interop::map(pose);
101  }
102 
103  Eigen::Matrix<double, 12, 12> const &getErrorCovariance() const {
104  return state().errorCovariance();
105  }
106 
107  private:
108  FilterState &state() { return m_state; }
109  FilterState const &state() const { return m_state; }
110  ProcessModel &processModel() { return m_processModel; }
111  ProcessModel const &processModel() const { return m_processModel; }
112  ProcessModel m_processModel;
113  FilterState m_state;
114 #if 0
115  AbsoluteOrientationMeasurement m_imuMeas;
116  AngularVelocityMeasurement m_imuMeasVel;
117  AbsoluteOrientationMeasurement m_cameraMeasOri;
118  AbsolutePositionMeasurement m_cameraMeasPos;
119 #endif
120  const Eigen::Isometry3d m_rTc;
121  OSVR_TimeValue m_last;
122 };
123 
124 #endif // INCLUDED_RunningData_h_GUID_6B3479E5_9D56_4BA9_DEC0_84AF53842168
Header wrapping include of and for warning quieting.
A structure defining a quaternion, often a unit quaternion representing 3D rotation.
Definition: QuaternionC.h:49
StateSquareMatrix const & errorCovariance() const
P.
Definition: PoseState.h:183
Report type for an orientation callback on a tracker interface.
bool preReport(const OSVR_TimeValue &timestamp)
Returns true if we succeeded and can filter in some data.
Header providing a C++ wrapper around TimeValueC.h.
Internal, configured header file for verbosity macros.
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Definition: Pose3C.h:54
Header for interoperation between the Eigen math library, the internal mini math library, and VRPN's quatlib.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Header for measurements of absolute orientation.
Report type for a pose (position and orientation) callback on a tracker interface.