Esempio n. 1
0
        private bool ReadTrackIRData(ref InternalHeadPoseData output)
        {
            if (trackIRWorker == null)
            {
                trackIRWorker = SetupRealTrackIRDll();
            }

            var trackirData = freepieData.Read(x => x.TrackIRData);

            if (DateTime.Now - new DateTime(trackirData.LastUpdatedTicks) > TimeSpan.FromSeconds(WorkerProcessTimeout))
            {
                trackIRWorker.Dispose();
                throw new Exception("Lost contact with worker process.");
            }

            var data = trackirData.RealTrackIRData;

            if (data.FrameSignature == lastFrame || data.FrameSignature == 0)
            {
                return(false);
            }

            output = new InternalHeadPoseData {
                Yaw = data.Yaw, Pitch = data.Pitch, Roll = data.Roll, X = data.X, Y = data.Y, Z = data.Z
            };

            lastFrame = data.FrameSignature;

            return(true);
        }