diff options
Diffstat (limited to 'LibOVR/Src/Tracking')
-rw-r--r-- | LibOVR/Src/Tracking/Tracking_PoseState.h | 14 | ||||
-rw-r--r-- | LibOVR/Src/Tracking/Tracking_SensorState.h | 36 | ||||
-rw-r--r-- | LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp | 33 | ||||
-rw-r--r-- | LibOVR/Src/Tracking/Tracking_SensorStateReader.h | 17 |
4 files changed, 58 insertions, 42 deletions
diff --git a/LibOVR/Src/Tracking/Tracking_PoseState.h b/LibOVR/Src/Tracking/Tracking_PoseState.h index 393d483..19e2ee2 100644 --- a/LibOVR/Src/Tracking/Tracking_PoseState.h +++ b/LibOVR/Src/Tracking/Tracking_PoseState.h @@ -5,16 +5,16 @@ Content : Describes the complete pose at a point in time, including deriva Created : May 13, 2014 Authors : Dov Katz -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -120,6 +120,14 @@ namespace OVR { template<> struct CompatibleTypes<OVR::PoseState<float> > { typedef ovrPoseStatef Type; }; template<> struct CompatibleTypes<OVR::PoseState<double> > { typedef ovrPoseStated Type; }; + static_assert((sizeof(PoseState<double>) == sizeof(Pose<double>) + 4*sizeof(Vector3<double>) + sizeof(double)), "sizeof(PoseState<double>) failure"); +#ifdef OVR_CPU_X86_64 + static_assert((sizeof(PoseState<float>) == sizeof(Pose<float>) + 4*sizeof(Vector3<float>) + sizeof(uint32_t) + sizeof(double)), "sizeof(PoseState<float>) failure"); //TODO: Manually pad template. +#elif defined(OVR_OS_WIN32) // The Windows 32 bit ABI aligns 64 bit values on 64 bit boundaries + static_assert((sizeof(PoseState<float>) == sizeof(Pose<float>) + 4*sizeof(Vector3<float>) + sizeof(uint32_t) + sizeof(double)), "sizeof(PoseState<float>) failure"); +#else // Else Unix/Apple 32 bit ABI, which aligns 64 bit values on 32 bit boundaries. + static_assert((sizeof(PoseState<float>) == sizeof(Pose<float>) + 4*sizeof(Vector3<float>) + sizeof(double)), "sizeof(PoseState<float>) failure"); +#endif } #endif // Tracking_PoseState_h diff --git a/LibOVR/Src/Tracking/Tracking_SensorState.h b/LibOVR/Src/Tracking/Tracking_SensorState.h index b7c87ea..e13c3ef 100644 --- a/LibOVR/Src/Tracking/Tracking_SensorState.h +++ b/LibOVR/Src/Tracking/Tracking_SensorState.h @@ -5,16 +5,16 @@ Content : Sensor state information shared by tracking system with games Created : May 13, 2014 Authors : Dov Katz, Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -70,7 +70,7 @@ enum StatusBits class TrackingState { public: - TrackingState() : StatusFlags(0) { } + TrackingState() : HeadPose(), CameraPose(), LeveledCameraPose(), RawSensorData(), StatusFlags(0), LastVisionProcessingTime(0.0) { } // C-interop support TrackingState(const ovrTrackingState& s); @@ -92,8 +92,16 @@ public: //// 0.4.1 - // Time spent processing the last vision frame + // Measures the time from receiving the camera frame until vision CPU processing completes. double LastVisionProcessingTime; + + //// 0.4.3 + + // Measures the time from exposure until the pose is available for the frame, including processing time. + double LastVisionFrameLatency; + + // Tag the vision processing results to a certain frame counter number. + uint32_t LastCameraFrameCounter; }; @@ -115,17 +123,33 @@ struct LocklessSensorState // ImuFromCpf for HMD pose tracking Posed ImuFromCpf; + + // Performance logging double LastVisionProcessingTime; + double LastVisionFrameLatency; + uint32_t LastCameraFrameCounter; + uint32_t _PAD_1_; // Initialized to invalid state LocklessSensorState() : - StatusFlags(0) + WorldFromImu() + , RawSensorData() + , WorldFromCamera() + , StatusFlags(0) + , _PAD_0_(0) // This assignment should be irrelevant, but it quells static/runtime analysis complaints. + , ImuFromCpf() + , LastVisionProcessingTime(0.0) + , LastVisionFrameLatency(0.0) + , LastCameraFrameCounter(0) + , _PAD_1_(0) // " { } LocklessSensorState& operator = (const LocklessSensorStatePadding& rhs); }; +static_assert((sizeof(LocklessSensorState) == sizeof(PoseState<double>) + sizeof(SensorDataType) + sizeof(Pose<double>) + 2*sizeof(uint32_t) + sizeof(Posed) + sizeof(double)*2 + sizeof(uint32_t)*2), "sizeof(LocklessSensorState) failure"); + // Padded out version stored in the updater slots // Designed to be a larger fixed size to allow the data to grow in the future // without breaking older compiled code. diff --git a/LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp b/LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp index bad4ffc..a506b26 100644 --- a/LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp +++ b/LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp @@ -5,16 +5,16 @@ Content : Separate reader component that is able to recover sensor pose Created : June 4, 2014 Authors : Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -136,7 +136,7 @@ bool SensorStateReader::GetSensorStateAtTime(double absoluteTime, TrackingState& { return false; } - + // Delta time from the last available data double pdt = absoluteTime - lstate.WorldFromImu.TimeInSeconds; static const double maxPdt = 0.1; @@ -167,6 +167,7 @@ bool SensorStateReader::GetSensorStateAtTime(double absoluteTime, TrackingState& ss.RawSensorData = lstate.RawSensorData; ss.LastVisionProcessingTime = lstate.LastVisionProcessingTime; + ss.LastVisionFrameLatency = lstate.LastVisionFrameLatency; return true; } @@ -203,28 +204,4 @@ uint32_t SensorStateReader::GetStatus() const return lstate.StatusFlags; } -void SensorStateReader::LoadProfileCenteredFromWorld(Profile* profile) -{ - double camerastate[7]; - if (profile->GetDoubleValues(OVR_KEY_CAMERA_POSITION, camerastate, 7) == 0) - { - for (int i = 0; i < 7; i++) camerastate[i] = 0; - camerastate[3] = 1;//no offset. by default, give the quaternion w component value 1 - } - - OVR::Quatd orientation = OVR::Quatd(camerastate[0], camerastate[1], camerastate[2], camerastate[3]); - OVR::Vector3d position = OVR::Vector3d(camerastate[4], camerastate[5], camerastate[6]); - - CenteredFromWorld = OVR::Posed(orientation, position); - -} - -void SensorStateReader::SaveProfileCenteredFromWorld(Profile* profile) -{ - OVR::Quatd rot = CenteredFromWorld.Rotation; - OVR::Vector3d trans = CenteredFromWorld.Translation; - double vals[7] = { rot.x, rot.y, rot.z, rot.w, trans.x, trans.y, trans.z }; - profile->SetDoubleValues(OVR_KEY_CAMERA_POSITION, vals, 7); -} - }} // namespace OVR::Tracking diff --git a/LibOVR/Src/Tracking/Tracking_SensorStateReader.h b/LibOVR/Src/Tracking/Tracking_SensorStateReader.h index 53b6efe..c2922c8 100644 --- a/LibOVR/Src/Tracking/Tracking_SensorStateReader.h +++ b/LibOVR/Src/Tracking/Tracking_SensorStateReader.h @@ -5,16 +5,16 @@ Content : Separate reader component that is able to recover sensor pose Created : June 4, 2014 Authors : Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -70,8 +70,15 @@ public: // Get the sensor status (same as GetSensorStateAtTime(...).Status) uint32_t GetStatus() const; - void LoadProfileCenteredFromWorld(Profile* profile); - void SaveProfileCenteredFromWorld(Profile* profile); + const Posed getCenteredFromWorld() + { + return CenteredFromWorld; + } + + void setCenteredFromWorld(const Posed _CenteredFromWorld) + { + CenteredFromWorld = _CenteredFromWorld; + } }; |