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

Commit 5e6c0f31 authored by Ytai Ben-Tsvi's avatar Ytai Ben-Tsvi
Browse files

Feed stillness detectors with pre-compensated poses

The drift compensator may create motion (toward center) that doesn't
actually exist physically, thus interfering with our ability to
determine stillness.

Test: Manual verification.
Change-Id: Id645c535328f909d8a490352df06e2000a9ad44e
parent dd31ee05
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {
        Pose3f predictedWorldToHead =
                worldToHead * integrate(headTwist, mOptions.predictionDuration);
        mHeadPoseDriftCompensator.setInput(timestamp, predictedWorldToHead);
        mHeadStillnessDetector.setInput(timestamp, predictedWorldToHead);
        mWorldToHeadTimestamp = timestamp;
    }

@@ -76,8 +77,9 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {
            mPhysicalToLogicalAngle = mPendingPhysicalToLogicalAngle;
        }

        mScreenPoseDriftCompensator.setInput(
                timestamp, worldToScreen * Pose3f(rotateY(-mPhysicalToLogicalAngle)));
        Pose3f worldToLogicalScreen = worldToScreen * Pose3f(rotateY(-mPhysicalToLogicalAngle));
        mScreenPoseDriftCompensator.setInput(timestamp, worldToLogicalScreen);
        mScreenStillnessDetector.setInput(timestamp, worldToLogicalScreen);
        mWorldToScreenTimestamp = timestamp;
    }

@@ -93,8 +95,6 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {
        // Handle the screen first, since it might trigger a recentering of the head.
        if (mWorldToScreenTimestamp.has_value()) {
            const Pose3f worldToLogicalScreen = mScreenPoseDriftCompensator.getOutput();
            mScreenStillnessDetector.setInput(mWorldToScreenTimestamp.value(),
                                              worldToLogicalScreen);
            bool screenStable = mScreenStillnessDetector.calculate(timestamp);
            mModeSelector.setScreenStable(mWorldToScreenTimestamp.value(), screenStable);
            // Whenever the screen is unstable, recenter the head pose.
@@ -108,7 +108,6 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {
        // Handle head.
        if (mWorldToHeadTimestamp.has_value()) {
            Pose3f worldToHead = mHeadPoseDriftCompensator.getOutput();
            mHeadStillnessDetector.setInput(mWorldToHeadTimestamp.value(), worldToHead);
            // Auto-recenter.
            if (mHeadStillnessDetector.calculate(timestamp)) {
                recenter(true, false);