OSDN Git Service

Merge "Pose flicker fix on some devices" into oc-dev am: 5da2188e4c
authorOkan Arikan <okana@google.com>
Fri, 21 Apr 2017 08:18:57 +0000 (08:18 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Fri, 21 Apr 2017 08:18:57 +0000 (08:18 +0000)
am: 1c8b3073f6

Change-Id: Ice8603e580a34d3d99ee404c9aabbe2fb1ad0960

1  2 
services/vr/sensord/pose_service.cpp

@@@ -463,28 -458,19 +463,31 @@@ void PoseService::UpdatePoseMode() 
        }
        start_from_head_rotation.normalize();
  
 -      // Neck / head model code procedure for when no 6dof is available.
 -      // To apply the neck model, first translate the head pose to the new
 -      // center of eyes, then rotate around the origin (the original head
 -      // pos).
 -      Vector3d position =
 -          start_from_head_rotation * Vector3d(0.0, kDefaultNeckVerticalOffset,
 -                                              -kDefaultNeckHorizontalOffset);
 +      Vector3d position;
 +      switch (pose_mode_) {
 +        default:
 +        case DVR_POSE_MODE_3DOF:
 +          // Neck / head model code procedure for when no 6dof is available.
 +          // To apply the neck model, first translate the head pose to the new
 +          // center of eyes, then rotate around the origin (the original head
 +          // pos).
 +          position = start_from_head_rotation *
 +                     Vector3d(0.0, kDefaultNeckVerticalOffset,
 +                              -kDefaultNeckHorizontalOffset);
 +          break;
 +        case DVR_POSE_MODE_FLOAT:
 +          // Change position a bit in facing direction.
 +          mock_pos_offset_ += start_from_head_rotation.toRotationMatrix() * Vector3d(0, 0, -0.01);
 +          ResetMockDeviatedPosition();
 +          position = mock_pos_offset_;
 +          break;
 +      }
  
        // Update the current latency model.
-       sensor_latency_.AddLatency(GetSystemClockNs() - pose_state.timestamp_ns);
+       if (pose_state.timestamp_ns != 0) {
+         sensor_latency_.AddLatency(GetSystemClockNs() -
+                                    pose_state.timestamp_ns);
+       }
  
        // Update the timestamp with the expected latency.
        WriteAsyncPoses(