OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
RunningDataPredictCorrect.cpp
Go to the documentation of this file.
1 
13 // Copyright 2015 Sensics, Inc.
14 //
15 // Licensed under the Apache License, Version 2.0 (the "License");
16 // you may not use this file except in compliance with the License.
17 // You may obtain a copy of the License at
18 //
19 // http://www.apache.org/licenses/LICENSE-2.0
20 //
21 // Unless required by applicable law or agreed to in writing, software
22 // distributed under the License is distributed on an "AS IS" BASIS,
23 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 // See the License for the specific language governing permissions and
25 // limitations under the License.
26 
27 // Internal Includes
28 #include "RunningData.h"
29 #include <osvr/Util/Verbosity.h>
30 
31 // Library/third-party includes
32 #ifdef OSVR_FPE
33 #include <FPExceptionEnabler.h>
34 #endif
35 
36 // Standard includes
37 // - none
38 
40 
41 namespace ei = osvr::util::eigen_interop;
42 
43 void VideoIMUFusion::RunningData::handleIMUReport(
44  const OSVR_TimeValue &timestamp, const OSVR_OrientationReport &report) {
45  state().setQuaternion(ei::map(report.rotation));
46 }
47 
48 void VideoIMUFusion::RunningData::handleIMUVelocity(
49  const OSVR_TimeValue &timestamp, const Eigen::Vector3d &angVel) {
50  state().angularVelocity() = angVel;
51 }
52 
53 void VideoIMUFusion::RunningData::handleVideoTrackerReport(
54  const OSVR_TimeValue &timestamp, const OSVR_PoseReport &report) {
55  state().position() = takeCameraPoseToRoom(report.pose).translation();
56 }
57 
60  auto dt = duration(timestamp, m_last);
61  if (dt > 0) {
62  m_last = timestamp;
63  }
64  return true;
65 }
OSVR_PoseState pose
The pose structure, containing a position vector and a rotation quaternion.
void setQuaternion(Eigen::Quaterniond const &quaternion)
Intended for startup use.
Definition: PoseState.h:189
double duration(TimeValue const &a, TimeValue const &b)
Get a double containing seconds between the time points.
Definition: TimeValue.h:62
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.
Internal, configured header file for verbosity macros.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
OSVR_OrientationState rotation
The rotation unit quaternion.
Report type for a pose (position and orientation) callback on a tracker interface.