Ejemplo n.º 1
0
        // Handle new pose update event
        private void PoseDataReceived(HoloDataClient.HoloPose poseData)
        {
            Console.WriteLine("\n");

            //Console.WriteLine("== HoloLens Data Update ==");
            string display = "";

            display += string.Format("\tpos ({0:N3}, {1:N3}, {2:N3})", poseData.camPos.X, poseData.camPos.Y, poseData.camPos.Z);
            display += string.Format("\t\trot ({0:N3}, {1:N3}, {2:N3}, {2:N3})", poseData.camRot.W, poseData.camRot.X, poseData.camRot.Y, poseData.camRot.Z);
            //Console.WriteLine(display);


            NatNetClient.NatNetPoseData nnPoseData = natNetClient_.FetchFrameData();

            // Assemble log line
            string log = "";

            log += string.Format("{0:F6},{1:F6},{2:F6},", poseData.camPos.X, poseData.camPos.Y, poseData.camPos.Z);
            log += string.Format("{0:F8},{1:F8},{2:F8},{3:F8},", poseData.camRot.W, poseData.camRot.X, poseData.camRot.Y, poseData.camRot.Z);
            log += string.Format("{0:F6},{1:F6},{2:F6},", nnPoseData.rbPos.X, nnPoseData.rbPos.Y, nnPoseData.rbPos.Z);
            log += string.Format("{0:F8},{1:F8},{2:F8},{3:F8},", nnPoseData.rbRot.W, nnPoseData.rbRot.X, nnPoseData.rbRot.Y, nnPoseData.rbRot.Z);

            // Add timestamp
            string timestamp = Math.Round((System.DateTime.Now - logStartTime_).TotalMilliseconds).ToString();

            log += string.Format("{0}", timestamp);

            WriteToLog(log);


            List <double> hldata = new List <double>()
            {
                poseData.kbPos.X, poseData.kbPos.Y, poseData.kbPos.Z, poseData.kbRot.W, poseData.kbRot.X, poseData.kbRot.Y, poseData.kbRot.Z, poseData.camPos.X, poseData.camPos.Y, poseData.camPos.Z, poseData.camRot.W, poseData.camRot.X, poseData.camRot.Y, poseData.camRot.Z
            };
            List <double> opdata = new List <double>()
            {
                nnPoseData.rbPos.X, nnPoseData.rbPos.Y, nnPoseData.rbPos.Z, nnPoseData.rbRot.W, nnPoseData.rbRot.X, nnPoseData.rbRot.Y, nnPoseData.rbRot.Z
            };

            HLdata.Add(hldata);
            OPdata.Add(opdata);
        }
Ejemplo n.º 2
0
        // Handle new pose update event
        private void PoseDataReceived(HoloDataClient.HoloPose poseData)
        {
            // Fetch nnPose to be approx synchronised with HL pose
            NatNetClient.NatNetPoseData nnPoseData = natNetClient_.FetchFrameData();

            // Check that log file name has been initialized
            if (eventLogFile_ != "")
            {
                // Assemble log line
                string log = "";
                log += string.Format("{0:F6},{1:F6},{2:F6},", poseData.camPos.X, poseData.camPos.Y, poseData.camPos.Z);
                log += string.Format("{0:F8},{1:F8},{2:F8},{3:F8},", poseData.camRot.W, poseData.camRot.X, poseData.camRot.Y, poseData.camRot.Z);
                log += string.Format("{0:F6},{1:F6},{2:F6},", poseData.kbPos.X, poseData.kbPos.Y, poseData.kbPos.Z);
                log += string.Format("{0:F8},{1:F8},{2:F8},{3:F8},", poseData.kbRot.W, poseData.kbRot.X, poseData.kbRot.Y, poseData.kbRot.Z);
                log += string.Format("{0:F6},{1:F6},{2:F6},", nnPoseData.rbPos.X, nnPoseData.rbPos.Y, nnPoseData.rbPos.Z);
                log += string.Format("{0:F8},{1:F8},{2:F8},{3:F8},", nnPoseData.rbRot.W, nnPoseData.rbRot.X, nnPoseData.rbRot.Y, nnPoseData.rbRot.Z);

                // Add timestamp
                string timestamp = Math.Round((System.DateTime.Now - logStartTime_).TotalMilliseconds).ToString();

                log += string.Format("{0}", timestamp);

                WriteToFile(eventLogFile_, log);
            }

            // Append data to HL and OP data lists
            List <double> hldata = new List <double>()
            {
                poseData.kbPos.X, poseData.kbPos.Y, poseData.kbPos.Z, poseData.kbRot.W, poseData.kbRot.X, poseData.kbRot.Y, poseData.kbRot.Z, poseData.camPos.X, poseData.camPos.Y, poseData.camPos.Z, poseData.camRot.W, poseData.camRot.X, poseData.camRot.Y, poseData.camRot.Z
            };
            List <double> opdata = new List <double>()
            {
                nnPoseData.rbPos.X, nnPoseData.rbPos.Y, nnPoseData.rbPos.Z, nnPoseData.rbRot.W, nnPoseData.rbRot.X, nnPoseData.rbRot.Y, nnPoseData.rbRot.Z
            };

            HLdata.Add(hldata);
            OPdata.Add(opdata);
        }