nuclear@0: /************************************************************************************ nuclear@0: nuclear@0: Filename : Tracking_SensorStateReader.h nuclear@0: Content : Separate reader component that is able to recover sensor pose nuclear@0: Created : June 4, 2014 nuclear@0: Authors : Chris Taylor nuclear@0: nuclear@0: Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. nuclear@0: nuclear@0: Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); nuclear@0: you may not use the Oculus VR Rift SDK except in compliance with the License, nuclear@0: which is provided at the time of installation or download, or which nuclear@0: otherwise accompanies this software in either electronic or hard copy form. nuclear@0: nuclear@0: You may obtain a copy of the License at nuclear@0: nuclear@0: http://www.oculusvr.com/licenses/LICENSE-3.2 nuclear@0: nuclear@0: Unless required by applicable law or agreed to in writing, the Oculus VR SDK nuclear@0: distributed under the License is distributed on an "AS IS" BASIS, nuclear@0: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. nuclear@0: See the License for the specific language governing permissions and nuclear@0: limitations under the License. nuclear@0: nuclear@0: *************************************************************************************/ nuclear@0: nuclear@0: #ifndef Tracking_SensorStateReader_h nuclear@0: #define Tracking_SensorStateReader_h nuclear@0: nuclear@0: #include "../Kernel/OVR_Lockless.h" nuclear@0: #include "Tracking_SensorState.h" nuclear@0: nuclear@0: #include "../OVR_Profile.h" nuclear@0: nuclear@0: namespace OVR { namespace Tracking { nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------- nuclear@0: // SensorStateReader nuclear@0: nuclear@0: // User interface to retrieve pose from the sensor fusion subsystem nuclear@0: class SensorStateReader : public NewOverrideBase nuclear@0: { nuclear@0: protected: nuclear@0: const CombinedSharedStateUpdater *Updater; nuclear@0: nuclear@0: nuclear@0: // Last latency warning time nuclear@0: mutable double LastLatWarnTime; nuclear@0: nuclear@0: // Transform from real-world coordinates to centered coordinates nuclear@0: Posed CenteredFromWorld; nuclear@0: nuclear@0: public: nuclear@0: SensorStateReader(); nuclear@0: nuclear@0: // Initialize the updater nuclear@0: void SetUpdater(const CombinedSharedStateUpdater *updater); nuclear@0: nuclear@0: // Re-centers on the current yaw (optionally pitch) and translation nuclear@0: void RecenterPose(); nuclear@0: nuclear@0: // Get the full dynamical system state of the CPF, which includes velocities and accelerations, nuclear@0: // predicted at a specified absolute point in time. nuclear@0: bool GetSensorStateAtTime(double absoluteTime, Tracking::TrackingState& state) const; nuclear@0: nuclear@0: // Get the predicted pose (orientation, position) of the center pupil frame (CPF) at a specific point in time. nuclear@0: bool GetPoseAtTime(double absoluteTime, Posef& transform) const; nuclear@0: nuclear@0: // Get the sensor status (same as GetSensorStateAtTime(...).Status) nuclear@0: uint32_t GetStatus() const; nuclear@0: nuclear@0: const Posed getCenteredFromWorld() nuclear@0: { nuclear@0: return CenteredFromWorld; nuclear@0: } nuclear@0: nuclear@0: void setCenteredFromWorld(const Posed _CenteredFromWorld) nuclear@0: { nuclear@0: CenteredFromWorld = _CenteredFromWorld; nuclear@0: } nuclear@0: }; nuclear@0: nuclear@0: nuclear@0: }} // namespace OVR::Tracking nuclear@0: nuclear@0: #endif // Tracking_SensorStateReader_h