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

Commit 519d4199 authored by Andy Hung's avatar Andy Hung Committed by Automerger Merge Worker
Browse files

Merge "SensorPoseProvider: Remove custom sensor handling" into tm-dev am: 471f3ac6

parents 70b38d97 471f3ac6
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -158,7 +158,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider {
    enum DataFormat {
        kUnknown,
        kQuaternion,
        kRotationVectorsAndFlags,
        kRotationVectorsAndDiscontinuityCount,
    };

@@ -283,10 +282,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider {
            return DataFormat::kRotationVectorsAndDiscontinuityCount;
        }

        if (sensor->getStringType() == "com.google.hardware.sensor.hid_dynamic.headtracker") {
            return DataFormat::kRotationVectorsAndFlags;
        }

        return DataFormat::kUnknown;
    }

@@ -332,21 +327,6 @@ class SensorPoseProviderImpl : public SensorPoseProvider {
                return PoseEvent{Pose3f(quat), std::optional<Twist3f>(), false};
            }

            case DataFormat::kRotationVectorsAndFlags: {
                // Custom sensor, assumed to contain:
                // 3 floats representing orientation as a rotation vector (in rad).
                // 3 floats representing angular velocity as a rotation vector (in rad/s).
                // 1 uint32_t of flags, where:
                // - LSb is '1' iff the given sample is the first one in a new frame of reference.
                // - The rest of the bits are reserved for future use.
                Eigen::Vector3f rotation = {event.data[0], event.data[1], event.data[2]};
                Eigen::Vector3f twist = {event.data[3], event.data[4], event.data[5]};
                Eigen::Quaternionf quat = rotationVectorToQuaternion(rotation);
                uint32_t flags = *reinterpret_cast<const uint32_t*>(&event.data[6]);
                return PoseEvent{Pose3f(quat), Twist3f(Eigen::Vector3f::Zero(), twist),
                                 (flags & (1 << 0)) != 0};
            }

            case DataFormat::kRotationVectorsAndDiscontinuityCount: {
                Eigen::Vector3f rotation = {event.head_tracker.rx, event.head_tracker.ry,
                                            event.head_tracker.rz};