OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
RunningData.cpp
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 // Internal Includes
26 #include "RunningData.h"
27 
28 // Library/third-party includes
29 #ifdef OSVR_FPE
30 #include <FPExceptionEnabler.h>
31 #endif
32 
33 // Standard includes
34 // - none
35 
36 static const double InitialStateError[] = {
37  1., 1., 1., 10., 10., 10., 100., 100., 100., 1000., 1000., 1000.};
38 #if 0
39 static const double IMUError = 1.0E-8;
40 static const double IMUErrorVector[] = {IMUError, IMUError * 5., IMUError};
41 static const double CameraOriError = 1.0E-1;
42 static const double CameraOrientationError[] = {CameraOriError, CameraOriError,
43  CameraOriError};
44 static const double CameraPosError = 3.0E-4;
45 static const double CameraPositionError[] = {CameraPosError, CameraPosError,
46  CameraPosError * 0.1};
47 
48 static const double PositionNoiseAutocorrelation = 0.01;
49 static const double OrientationNoiseAutocorrelation = 0.1;
50 
51 static const double VelocityDamping = .01;
52 #endif
53 
55 namespace ei = osvr::util::eigen_interop;
56 
57 VideoIMUFusion::RunningData::RunningData(
58  VideoIMUFusionParams const &params, Eigen::Isometry3d const &rTc,
59  OSVR_OrientationState const &initialIMU, OSVR_PoseState const &initialVideo,
60  OSVR_TimeValue const &lastTS)
61  : m_processModel(params.damping, params.positionNoise, params.oriNoise),
62  m_state(),
63 #if 0
64  m_imuMeas(ei::map(initialIMU),
65  Vector<3>::Constant(params.imuOriVariance)),
66  m_imuMeasVel(Vector<3>::Zero(),
67  Vector<3>::Constant(params.imuAngVelVariance)),
68  m_cameraMeasOri(Eigen::Quaterniond::Identity(),
69  Vector<3>::Constant(params.videoOriVariance)),
70  m_cameraMeasPos(Vector<3>::Zero(),
71  Vector<3>::Constant(params.videoPosVariance)),
72 #endif
73  m_rTc(rTc), m_last(lastTS) {
74 
75 #ifdef OSVR_FPE
76  FPExceptionEnabler fpe;
77 #endif
78  Eigen::Isometry3d roomPose = takeCameraPoseToRoom(initialVideo);
82 
83  position(initialState) = roomPose.translation();
84  state().setStateVector(initialState);
85  state().setQuaternion(Eigen::Quaterniond(roomPose.rotation()));
86  state().setErrorCovariance(Vector<12>(InitialStateError).asDiagonal());
87 }
Eigen::Matrix< Scalar, n, 1 > Vector
A vector of length n.
Vector< Dimension< T >::value > DimVector
A vector of length = dimension of T.
A structure defining a quaternion, often a unit quaternion representing 3D rotation.
Definition: QuaternionC.h:49
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Definition: Pose3C.h:54
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81