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

Commit 54f07586 authored by Ytai Ben-Tsvi's avatar Ytai Ben-Tsvi
Browse files

Convert between sensor framework and head tracking frames

We use different frame conventions in the head tracking library and we
forgot to do the conversion.

Test: Manual inspection of logs while running head tracking.
Bug: 188502620
Change-Id: Icc750d581bbe269c81a2972b4fe2e11cde040ddf
parent 2be8b29b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -21,13 +21,14 @@
#include <inttypes.h>

#include <future>
#include <iostream>
#include <map>
#include <thread>

#include <android/looper.h>
#include <log/log_main.h>

#include "QuaternionUtil.h"

namespace android {
namespace media {
namespace {
@@ -217,6 +218,8 @@ class SensorPoseProviderImpl : public SensorPoseProvider {
            case ASENSOR_TYPE_ROTATION_VECTOR:
            case ASENSOR_TYPE_GAME_ROTATION_VECTOR: {
                Eigen::Quaternionf quat(event.data[3], event.data[0], event.data[1], event.data[2]);
                // Adapt to different frame convention.
                quat *= rotateX(-M_PI_2);
                return std::make_tuple(Pose3f(quat), std::optional<Twist3f>());
            }