![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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: ST_401_84MHZ mbed
Diff: main.cpp
- Revision:
- 1:71c319f03fda
- Parent:
- 0:2e5e65a6fb30
diff -r 2e5e65a6fb30 -r 71c319f03fda main.cpp --- a/main.cpp Sun Jun 29 22:02:30 2014 +0000 +++ b/main.cpp Tue Aug 05 01:34:45 2014 +0000 @@ -86,6 +86,13 @@ wait(1); mpu9250.resetMPU9250(); // Reset registers to default in preparation for device calibration + mpu9250.MPU9250SelfTest(SelfTest); // Start by performing self test and reporting values + pc.printf("x-axis self test: acceleration trim within : %f % of factory value\n\r", SelfTest[0]); + pc.printf("y-axis self test: acceleration trim within : %f % of factory value\n\r", SelfTest[1]); + pc.printf("z-axis self test: acceleration trim within : %f % of factory value\n\r", SelfTest[2]); + pc.printf("x-axis self test: gyration trim within : %f % of factory value\n\r", SelfTest[3]); + pc.printf("y-axis self test: gyration trim within : %f % of factory value\n\r", SelfTest[4]); + pc.printf("z-axis self test: gyration trim within : %f % of factory value\n\r", SelfTest[5]); mpu9250.calibrateMPU9250(gyroBias, accelBias); // Calibrate gyro and accelerometers, load biases in bias registers pc.printf("x gyro bias = %f\n\r", gyroBias[0]); pc.printf("y gyro bias = %f\n\r", gyroBias[1]);