Basic program to obtain properly-scaled gyro, accelerometer, and magnetometer data from the MPU-9250 9-axis motion sensor and do 9 DoF sensor fusion using the open-source Madgwick and Mahony sensor fusion filters. Running on STM32F401RE Nucleo board at 84 MHz achieves sensor fusion filter update rates of ~5000 Hz.

Dependencies:   mbed

Fork of MPU9250AHRS by Kris Winer

Files at this revision

API Documentation at this revision

Comitter:
soulx
Date:
Fri Dec 18 21:21:36 2015 +0000
Parent:
4:1e5db958fd1b
Commit message:
-

Changed in this revision

MPU9250.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1e5db958fd1b -r d31487b34216 MPU9250.h
--- a/MPU9250.h	Fri Dec 18 20:49:39 2015 +0000
+++ b/MPU9250.h	Fri Dec 18 21:21:36 2015 +0000
@@ -219,6 +219,7 @@
 #define Kp 5.1f * 5.0f // these are the free parameters in the Mahony filter and fusion scheme, Kp for proportional feedback, Ki for integral
 #define Ki 1.0f
 
+
 float pitch, yaw, roll;
 float deltat = 0.0f;                             // integration interval for both filter schemes
 int lastUpdate = 0, firstUpdate = 0, Now = 0;    // used to calculate integration interval                               // used to calculate integration interval
diff -r 1e5db958fd1b -r d31487b34216 main.cpp
--- a/main.cpp	Fri Dec 18 20:49:39 2015 +0000
+++ b/main.cpp	Fri Dec 18 21:21:36 2015 +0000
@@ -202,9 +202,9 @@
 
 
 
-    magbias[0] = ((xmax-xmin)/2.0f - xmax);  // User environmental x-axis correction in milliGauss, should be automatically calculated
-    magbias[1] = ((ymax-ymin)/2.0f - ymax);  // User environmental x-axis correction in milliGauss
-    magbias[2] = ((zmax-zmin)/2.0f - zmax);  // User environmental x-axis correction in milliGauss
+//    magbias[0] = ((xmax-xmin)/2.0f - xmax);  // User environmental x-axis correction in milliGauss, should be automatically calculated
+//    magbias[1] = ((ymax-ymin)/2.0f - ymax);  // User environmental x-axis correction in milliGauss
+//    magbias[2] = ((zmax-zmin)/2.0f - zmax);  // User environmental x-axis correction in milliGauss
 
     magbias[0] = -1.0;
     magbias[1] = -1.0;