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.
Dependencies: MPU9250_SPI mbed
Fork of MPU9250_AHRS by
Diff: main.cpp
- Revision:
- 14:e795854eab64
- Parent:
- 13:3487e01bd5db
- Child:
- 17:7a9459ac7469
--- a/main.cpp	Fri Jun 17 15:11:01 2016 +0000
+++ b/main.cpp	Wed Jun 22 06:50:50 2016 +0000
@@ -334,10 +334,13 @@
         imu[i]->read_all();
     }
     for(int i=0; i<2; i++) {
+        float wx = (imu[i]->gyroscope_data[0]-gxOfs)*DEGREE2RAD;
+        float wy = (imu[i]->gyroscope_data[1]-gyOfs)*DEGREE2RAD;
+        float wz = (imu[i]->gyroscope_data[2]-gzOfs)*DEGREE2RAD;
         ahrs[i]->update(
-            (imu[i]->gyroscope_data[0]-gxOfs)*DEGREE2RAD,
-            (imu[i]->gyroscope_data[1]-gyOfs)*DEGREE2RAD,
-            (imu[i]->gyroscope_data[2]-gzOfs)*DEGREE2RAD,
+            wx,
+            wy,
+            wz,
             imu[i]->accelerometer_data[0],
             imu[i]->accelerometer_data[1],
             imu[i]->accelerometer_data[2],
@@ -346,8 +349,14 @@
             imu[i]->Magnetometer[2]
         );
 
-        printf("%+0.3f,%+0.3f,%+0.3f,%+0.3f,",
-               ahrs[i]->q0,ahrs[i]->q1,ahrs[i]->q2,ahrs[i]->q3);
+        printf("%+0.3f,%+0.3f,%+0.3f,%+0.3f,%+0.3f,%+0.3f,%+0.3f,",
+               wx,
+               wy,
+               wz,
+               ahrs[i]->q0,
+               ahrs[i]->q1,
+               ahrs[i]->q2,
+               ahrs[i]->q3);
     }
     printf("\n");
 }
    