From d87e165b06b8ffee736245c6fb2047d6d8038ee0 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 6 Jun 2013 14:08:53 -0700 Subject: [PATCH] Acceleration is presumably relative to the current orientation. --- interface/src/SerialInterface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/SerialInterface.cpp b/interface/src/SerialInterface.cpp index 5bcb8b32ca..e0c5da889b 100644 --- a/interface/src/SerialInterface.cpp +++ b/interface/src/SerialInterface.cpp @@ -260,7 +260,8 @@ void SerialInterface::readData(float deltaTime) { } else { // Use gravity reading to do sensor fusion on the pitch and roll estimation estimatedRotation = safeMix(estimatedRotation, - rotationBetween(_gravity, _lastAcceleration) * estimatedRotation, 1.0f / SENSOR_FUSION_SAMPLES); + rotationBetween(estimatedRotation * _lastAcceleration, _gravity) * estimatedRotation, + 1.0f / SENSOR_FUSION_SAMPLES); } }