ovr_sdk
diff LibOVR/Src/Tracking/Tracking_SensorStateReader.h @ 0:1b39a1b46319
initial 0.4.4
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 14 Jan 2015 06:51:16 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/LibOVR/Src/Tracking/Tracking_SensorStateReader.h Wed Jan 14 06:51:16 2015 +0200 1.3 @@ -0,0 +1,87 @@ 1.4 +/************************************************************************************ 1.5 + 1.6 +Filename : Tracking_SensorStateReader.h 1.7 +Content : Separate reader component that is able to recover sensor pose 1.8 +Created : June 4, 2014 1.9 +Authors : Chris Taylor 1.10 + 1.11 +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 1.12 + 1.13 +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 1.14 +you may not use the Oculus VR Rift SDK except in compliance with the License, 1.15 +which is provided at the time of installation or download, or which 1.16 +otherwise accompanies this software in either electronic or hard copy form. 1.17 + 1.18 +You may obtain a copy of the License at 1.19 + 1.20 +http://www.oculusvr.com/licenses/LICENSE-3.2 1.21 + 1.22 +Unless required by applicable law or agreed to in writing, the Oculus VR SDK 1.23 +distributed under the License is distributed on an "AS IS" BASIS, 1.24 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.25 +See the License for the specific language governing permissions and 1.26 +limitations under the License. 1.27 + 1.28 +*************************************************************************************/ 1.29 + 1.30 +#ifndef Tracking_SensorStateReader_h 1.31 +#define Tracking_SensorStateReader_h 1.32 + 1.33 +#include "../Kernel/OVR_Lockless.h" 1.34 +#include "Tracking_SensorState.h" 1.35 + 1.36 +#include "../OVR_Profile.h" 1.37 + 1.38 +namespace OVR { namespace Tracking { 1.39 + 1.40 + 1.41 +//----------------------------------------------------------------------------- 1.42 +// SensorStateReader 1.43 + 1.44 +// User interface to retrieve pose from the sensor fusion subsystem 1.45 +class SensorStateReader : public NewOverrideBase 1.46 +{ 1.47 +protected: 1.48 + const CombinedSharedStateUpdater *Updater; 1.49 + 1.50 + 1.51 + // Last latency warning time 1.52 + mutable double LastLatWarnTime; 1.53 + 1.54 + // Transform from real-world coordinates to centered coordinates 1.55 + Posed CenteredFromWorld; 1.56 + 1.57 +public: 1.58 + SensorStateReader(); 1.59 + 1.60 + // Initialize the updater 1.61 + void SetUpdater(const CombinedSharedStateUpdater *updater); 1.62 + 1.63 + // Re-centers on the current yaw (optionally pitch) and translation 1.64 + void RecenterPose(); 1.65 + 1.66 + // Get the full dynamical system state of the CPF, which includes velocities and accelerations, 1.67 + // predicted at a specified absolute point in time. 1.68 + bool GetSensorStateAtTime(double absoluteTime, Tracking::TrackingState& state) const; 1.69 + 1.70 + // Get the predicted pose (orientation, position) of the center pupil frame (CPF) at a specific point in time. 1.71 + bool GetPoseAtTime(double absoluteTime, Posef& transform) const; 1.72 + 1.73 + // Get the sensor status (same as GetSensorStateAtTime(...).Status) 1.74 + uint32_t GetStatus() const; 1.75 + 1.76 + const Posed getCenteredFromWorld() 1.77 + { 1.78 + return CenteredFromWorld; 1.79 + } 1.80 + 1.81 + void setCenteredFromWorld(const Posed _CenteredFromWorld) 1.82 + { 1.83 + CenteredFromWorld = _CenteredFromWorld; 1.84 + } 1.85 +}; 1.86 + 1.87 + 1.88 +}} // namespace OVR::Tracking 1.89 + 1.90 +#endif // Tracking_SensorStateReader_h