public void OnPoseAvailable(TangoPoseData pose) { // Update the text views with Pose info. updateTextViewWith(pose); bool updateRenderer = false; if (mIsRelocalized) { if (pose.BaseFrame == TangoPoseData.CoordinateFrameAreaDescription && pose.TargetFrame == TangoPoseData.CoordinateFrameDevice) { updateRenderer = true; } } else { if (pose.BaseFrame == TangoPoseData.CoordinateFrameStartOfService && pose.TargetFrame == TangoPoseData.CoordinateFrameDevice) { updateRenderer = true; } } // Update the trajectory, model matrix, and view matrix, then // render the scene again if (updateRenderer && (mRenderer.Trajectory != null)) { float[] translation = pose.GetTranslationAsFloats(); mRenderer.Trajectory.updateTrajectory(translation); mRenderer.ModelMatCalculator.updateModelMatrix(translation, pose.GetRotationAsFloats()); mRenderer.updateViewMatrix(); mGLView.RequestRender(); } }
public void OnPoseAvailable(TangoPoseData pose) { RunOnUiThread(() => { // Log whenever Motion Tracking enters a n invalid state if (!mIsAutoRecovery && (pose.StatusCode == TangoPoseData.PoseInvalid)) { Log.Wtf(this.GetType().Name, "Invalid State"); } mDeltaTime = (float)(pose.Timestamp - mPreviousTimeStamp) * SECS_TO_MILLISECS; mPreviousTimeStamp = (float)pose.Timestamp; Log.Info(_TAG, "Delta Time is: " + mDeltaTime); count++; // Update the OpenGL renderable objects with the new Tango Pose // data if (mRenderer.Trajectory != null) { float[] translation = pose.GetTranslationAsFloats(); mRenderer.Trajectory.updateTrajectory(translation); mRenderer.ModelMatCalculator.updateModelMatrix(translation, pose.GetRotationAsFloats()); mRenderer.updateViewMatrix(); mGLView.RequestRender(); } string translationString = "[" + threeDec.format(pose.Translation[0]) + ", " + threeDec.format(pose.Translation[1]) + ", " + threeDec.format(pose.Translation[2]) + "] "; string quaternionString = "[" + threeDec.format(pose.Rotation[0]) + ", " + threeDec.format(pose.Rotation[1]) + ", " + threeDec.format(pose.Rotation[2]) + ", " + threeDec.format(pose.Rotation[3]) + "] "; // Display pose data On screen in TextViews mPoseTextView.Text = translationString; mQuatTextView.Text = quaternionString; mPoseCountTextView.Text = count.ToString(); mDeltaTextView.Text = threeDec.format(mDeltaTime); if (pose.StatusCode == TangoPoseData.PoseValid) { mPoseStatusTextView.Text = "Valid"; } else if (pose.StatusCode == TangoPoseData.PoseInvalid) { mPoseStatusTextView.Text = "Invalid"; } else if (pose.StatusCode == TangoPoseData.PoseInitializing) { mPoseStatusTextView.Text = "Initializing"; } else if (pose.StatusCode == TangoPoseData.PoseUnknown) { mPoseStatusTextView.Text = "Unknown"; } }); }
public void OnPoseAvailable(TangoPoseData pose) { mDeltaTime = (float)(pose.Timestamp - mPosePreviousTimeStamp) * SECS_TO_MILLI; mPosePreviousTimeStamp = (float)pose.Timestamp; count++; mRenderer.ModelMatCalculator.updateModelMatrix(pose.GetTranslationAsFloats(), pose.GetRotationAsFloats()); mRenderer.updateViewMatrix(); mGLView.RequestRender(); // Update the UI with TangoPose information RunOnUiThread(() => { string translationString = "[" + threeDec.format(pose.Translation[0]) + ", " + threeDec.format(pose.Translation[1]) + ", " + threeDec.format(pose.Translation[2]) + "] "; string quaternionString = "[" + threeDec.format(pose.Rotation[0]) + ", " + threeDec.format(pose.Rotation[1]) + ", " + threeDec.format(pose.Rotation[2]) + ", " + threeDec.format(pose.Rotation[3]) + "] "; // Display pose data On screen in TextViews mPoseTextView.Text = translationString; mQuatTextView.Text = quaternionString; mPoseCountTextView.Text = Convert.ToString(count); mDeltaTextView.Text = threeDec.format(mDeltaTime); if (pose.StatusCode == TangoPoseData.PoseValid) { mPoseStatusTextView.Text = "Valid"; } else if (pose.StatusCode == TangoPoseData.PoseInvalid) { mPoseStatusTextView.Text = "Invalid"; } else if (pose.StatusCode == TangoPoseData.PoseInitializing) { mPoseStatusTextView.Text = "Initializing"; } else if (pose.StatusCode == TangoPoseData.PoseUnknown) { mPoseStatusTextView.Text = "Unknown"; } }); }