diff options
-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); } } |