From ece0924b856c905ce54e97446ea24d7c89a61746 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 21 Nov 2015 17:45:11 +0100 Subject: No need to swap x and y. Change-Id: I21a8d3eab9d31351d03c6cbcafd008d5b2fc6712 Reviewed-by: Laszlo Agocs --- README.md | 7 +++---- src/sensehat/qsensehatsensors.cpp | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index eafd59a..a6a568b 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,7 @@ Sensors example: Raspbian's default calibration from /etc is picked up automatically, similarly to the Python lib. Note however that this is a text file and numbers may not be parsable with -locale settings that use a decimal separator other than the dot. If the orientation is -reported as all-NaNs, check this first. +locale settings that use a decimal separator other than the dot. If the orientation data +is invalid, check this first. -Orientation maintains compatibility with Python's get_orientation(): the QVector3D's x, y, -z components correspond to pitch, roll, yaw in degrees in range 0..360. +Orientation is converted to degrees in range 0..360. Other values are reported as-is. diff --git a/src/sensehat/qsensehatsensors.cpp b/src/sensehat/qsensehatsensors.cpp index 6f72cae..0baafef 100644 --- a/src/sensehat/qsensehatsensors.cpp +++ b/src/sensehat/qsensehatsensors.cpp @@ -230,11 +230,9 @@ void QSenseHatSensorsPrivate::report(const RTIMU_DATA &data, QSenseHatSensors::U if (what.testFlag(QSenseHatSensors::UpdateOrientation)) { if (data.fusionPoseValid) { - // To be compatible with the Python lib's get_orientation(), report - // degrees in range 0..360 and in the order pitch, roll, yaw. - orientation = QVector3D(toDeg360(data.fusionPose.y()), - toDeg360(data.fusionPose.x()), - toDeg360(data.fusionPose.z())); + orientation = QVector3D(toDeg360(data.fusionPose.x()), // roll + toDeg360(data.fusionPose.y()), // pitch + toDeg360(data.fusionPose.z())); // yaw emit q->orientationChanged(orientation); } } -- cgit v1.2.3