Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d17f9e4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix head-pose prediction bug and increase time"

parents 1dc2091f 3c234b1b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -56,6 +56,16 @@ class Twist3f {
               mRotationalVelocity.isApprox(other.mRotationalVelocity, prec);
    }

    template<typename T>
    Twist3f operator*(const T& s) const {
        return Twist3f(mTranslationalVelocity * s, mRotationalVelocity * s);
    }

    template<typename T>
    Twist3f operator/(const T& s) const {
        return Twist3f(mTranslationalVelocity / s, mRotationalVelocity / s);
    }

  private:
    Eigen::Vector3f mTranslationalVelocity;
    Eigen::Vector3f mRotationalVelocity;
+3 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ constexpr float kMaxRotationalVelocity = 8;
// twist (velocity). It should be set to a value that matches the characteristic durations of moving
// one's head. The higher we set this, the more latency we are able to reduce, but setting this too
// high will result in high prediction errors whenever the head accelerates (changes velocity).
constexpr auto kPredictionDuration = 10ms;
constexpr auto kPredictionDuration = 50ms;

// After losing this many consecutive samples from either sensor, we would treat the measurement as
// stale;
@@ -236,7 +236,8 @@ void SpatializerPoseController::onPose(int64_t timestamp, int32_t sensor, const
                                       const std::optional<Twist3f>& twist, bool isNewReference) {
    std::lock_guard lock(mMutex);
    if (sensor == mHeadSensor) {
        mProcessor->setWorldToHeadPose(timestamp, pose, twist.value_or(Twist3f()));
        mProcessor->setWorldToHeadPose(timestamp, pose,
                                       twist.value_or(Twist3f()) / kTicksPerSecond);
        if (isNewReference) {
            mProcessor->recenter(true, false);
        }