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

Commit 9dea6416 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

head tracking processor: improve log am: f8a8526d

parents 98b842d7 f8a8526d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {
            mModeSelector.setScreenStable(mWorldToScreenTimestamp.value(), screenStable);
            // Whenever the screen is unstable, recenter the head pose.
            if (!screenStable) {
                recenter(true, false);
                recenter(true, false, "calculate: screen movement");
            }
            mScreenHeadFusion.setWorldToScreenPose(mWorldToScreenTimestamp.value(),
                                                   worldToLogicalScreen);
@@ -109,7 +109,7 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {
            // Auto-recenter.
            bool headStable = mHeadStillnessDetector.calculate(timestamp);
            if (headStable || !screenStable) {
                recenter(true, false);
                recenter(true, false, "calculate: head movement");
                worldToHead = mHeadPoseBias.getOutput();
            }

@@ -139,16 +139,16 @@ class HeadTrackingProcessorImpl : public HeadTrackingProcessor {

    HeadTrackingMode getActualMode() const override { return mModeSelector.getActualMode(); }

    void recenter(bool recenterHead, bool recenterScreen) override {
    void recenter(bool recenterHead, bool recenterScreen, std::string source) override {
        if (recenterHead) {
            mHeadPoseBias.recenter();
            mHeadStillnessDetector.reset();
            mLocalLog.log("recenter Head");
            mLocalLog.log("recenter Head from %s", source.c_str());
        }
        if (recenterScreen) {
            mScreenPoseBias.recenter();
            mScreenStillnessDetector.reset();
            mLocalLog.log("recenter Screen");
            mLocalLog.log("recenter Screen from %s", source.c_str());
        }

        // If a sensor being recentered is included in the current mode, apply rate limiting to
+2 −1
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ class HeadTrackingProcessor {
    /**
     * This causes the current poses for both the head and/or screen to be considered "center".
     */
    virtual void recenter(bool recenterHead = true, bool recenterScreen = true) = 0;
    virtual void recenter(
            bool recenterHead = true, bool recenterScreen = true, std::string source = "") = 0;

    /**
     * Dump HeadTrackingProcessor parameters under caller lock.
+5 −5
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ void SpatializerPoseController::setHeadSensor(int32_t sensor) {
        mHeadSensor = INVALID_SENSOR;
    }

    mProcessor->recenter(true /* recenterHead */, false /* recenterScreen */);
    mProcessor->recenter(true /* recenterHead */, false /* recenterScreen */, __func__);
}

void SpatializerPoseController::setScreenSensor(int32_t sensor) {
@@ -229,7 +229,7 @@ void SpatializerPoseController::setScreenSensor(int32_t sensor) {
        mScreenSensor = INVALID_SENSOR;
    }

    mProcessor->recenter(false /* recenterHead */, true /* recenterScreen */);
    mProcessor->recenter(false /* recenterHead */, true /* recenterScreen */, __func__);
}

void SpatializerPoseController::setDesiredMode(HeadTrackingMode mode) {
@@ -276,7 +276,7 @@ SpatializerPoseController::calculate_l() {

void SpatializerPoseController::recenter() {
    std::lock_guard lock(mMutex);
    mProcessor->recenter();
    mProcessor->recenter(true /* recenterHead */, true /* recenterScreen */, __func__);
}

void SpatializerPoseController::onPose(int64_t timestamp, int32_t sensor, const Pose3f& pose,
@@ -286,13 +286,13 @@ void SpatializerPoseController::onPose(int64_t timestamp, int32_t sensor, const
        mProcessor->setWorldToHeadPose(timestamp, pose,
                                       twist.value_or(Twist3f()) / kTicksPerSecond);
        if (isNewReference) {
            mProcessor->recenter(true, false);
            mProcessor->recenter(true, false, __func__);
        }
    }
    if (sensor == mScreenSensor) {
        mProcessor->setWorldToScreenPose(timestamp, pose);
        if (isNewReference) {
            mProcessor->recenter(false, true);
            mProcessor->recenter(false, true, __func__);
        }
    }
}