diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-11-21 17:45:11 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-11-21 16:46:01 +0000 |
commit | ece0924b856c905ce54e97446ea24d7c89a61746 (patch) | |
tree | 0ffd9c353ca0e9a0eb6ebb0d9bd6cb6d8645b3ae | |
parent | 1f204c48c5f9e3237fd158199e58e3d156a5a70d (diff) |
No need to swap x and y.
Change-Id: I21a8d3eab9d31351d03c6cbcafd008d5b2fc6712
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | src/sensehat/qsensehatsensors.cpp | 8 |
2 files changed, 6 insertions, 9 deletions
@@ -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); } } |