Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 13:0fc0f858fe0c, committed 2020-03-18
- Comitter:
- mohamedashraf
- Date:
- Wed Mar 18 21:53:16 2020 +0000
- Parent:
- 12:775e1464e042
- Commit message:
- dmp angles code
Changed in this revision
MyMPU6050.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MyMPU6050.h Wed Dec 09 03:25:10 2015 +0000 +++ b/MyMPU6050.h Wed Mar 18 21:53:16 2020 +0000 @@ -22,12 +22,15 @@ _pc = pc; } + float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector + + void loop() { // if programming failed, don't try to do anything if (!dmpReady) return; // _pc->printf("dmp ready\n"); - + mpuInterrupt=true; // wait for MPU interrupt or extra packet(s) available if (!mpuInterrupt && fifoCount < packetSize) { return; @@ -74,7 +77,7 @@ mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); - mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); + //mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); float newTheta; if (ypr[1]>0) newTheta = ypr[2]; else if (ypr[2]<0) newTheta = -M_PI-ypr[2]; @@ -146,7 +149,6 @@ // orientation/motion vars Quaternion q; // [w, x, y, z] quaternion container VectorFloat gravity; // [x, y, z] gravity vector - float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector int16_t gyroData[3]; volatile float theta; bool thetaInitFlag;