From bf389de774a14b658850d3cf3940b83af787dd67 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 11 Jun 2013 11:22:43 -0700 Subject: [PATCH] Testing a different coordinate conversion. --- interface/src/SerialInterface.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/interface/src/SerialInterface.cpp b/interface/src/SerialInterface.cpp index cbd03f801b..03a03b87aa 100644 --- a/interface/src/SerialInterface.cpp +++ b/interface/src/SerialInterface.cpp @@ -216,8 +216,9 @@ void SerialInterface::readData(float deltaTime) { // From MPU-9150 register map, with setting on // highest resolution = +/- 2G - _lastAcceleration = glm::vec3(-accelXRate, -accelYRate, -accelZRate) * LSB_TO_METERS_PER_SECOND2; - + //_lastAcceleration = glm::vec3(-accelXRate, -accelYRate, -accelZRate) * LSB_TO_METERS_PER_SECOND2; + _lastAcceleration = glm::vec3(-accelYRate, accelXRate, accelZRate) * LSB_TO_METERS_PER_SECOND2; + int rollRate, yawRate, pitchRate; convertHexToInt(sensorBuffer + 22, rollRate); @@ -227,8 +228,12 @@ void SerialInterface::readData(float deltaTime) { // Convert the integer rates to floats const float LSB_TO_DEGREES_PER_SECOND = 1.f / 16.4f; // From MPU-9150 register map, 2000 deg/sec. glm::vec3 rotationRates; - rotationRates[0] = ((float) -pitchRate) * LSB_TO_DEGREES_PER_SECOND; - rotationRates[1] = ((float) -yawRate) * LSB_TO_DEGREES_PER_SECOND; + //rotationRates[0] = ((float) -pitchRate) * LSB_TO_DEGREES_PER_SECOND; + //rotationRates[1] = ((float) -yawRate) * LSB_TO_DEGREES_PER_SECOND; + //rotationRates[2] = ((float) -rollRate) * LSB_TO_DEGREES_PER_SECOND; + + rotationRates[0] = ((float) -yawRate) * LSB_TO_DEGREES_PER_SECOND; + rotationRates[1] = ((float) pitchRate) * LSB_TO_DEGREES_PER_SECOND; rotationRates[2] = ((float) -rollRate) * LSB_TO_DEGREES_PER_SECOND; // compute the angular acceleration