MPU-9150 data quality - Page 1
Forum section: electronics / projects

author: jrandj
author_rank: Newbie
timestamp: May 18, 2014, 08:20:34 am
content: Hi all,I'm trying to useMadgwick’sIMU algorithm to obtain roll, pitch and yaw from my MPU-9150. The data I've gathered was rotating the sensor +- 90 degrees about each axis, but I can't seem to get any usable output from this algorithm. I've attached a picture which contains the example Euler angles, which look what I'm expecting, compared to the ones I get for my data. I've ensured that the units are the same across the two sets of data, and all I've done to my raw data is low pass filtering.My gyroscope/magnetometer data definitely doesn't look as clean as the example data. Has anyone had similar experiences with this IMU?Thanks

author: cyr
author_rank: Frequent Contributor
timestamp: May 18, 2014, 08:42:44 am
content: How have you calibrated the sensors?

author: jrandj
author_rank: Newbie
timestamp: May 18, 2014, 09:07:40 am
content: I'm not 100% sure on the details (I didn't write the firmware), as far as I know it's the standard 'don't move the device during calibration' and it just zeros all the measurements. There is a calibration procedure though which I did before recording the data. Would this be a useful avenue to look into?

author: cyr
author_rank: Frequent Contributor
timestamp: May 18, 2014, 10:08:06 am
content: Well I don't know anything about the specific IMU you are using, but a single point calibration doesn't seem like enough to get useful data from a magnetometer. It can only zero out the gyro bias and provide a level reference.I would have thought at least there would be a procedure like point the sensor up/down/left/right/forward/back, to calculate both a bias and scale for each axis.I may be talking out of my arse though...

author: Rerouter
author_rank: Super Contributor
timestamp: May 18, 2014, 10:22:42 am
content: you are correct there cyr, with just about every other imu you have to correct for offset and scale on all 3 accelerometer axis's first, then rotate in a random direction to build up a point map to correct the mag, then with both of those correct you can test for scale errors on the gyro (high pass filtering in the algorithms used generally mean there is no zero issue,There calibration would be the zero correction for the accelerometer and gyros, which for a basic imu (only controlling roll and pitch) you could likely get away with,When you dig deeper into the subject and tack on gps sources, barometers and optical flow meters, the equations become things that you will need to teach yourself university level math to start to crack :/.. (quaternions! and rotation matrices! )

author: jrandj
author_rank: Newbie
timestamp: May 18, 2014, 11:06:54 am
content: Thanks guys, I will look into the calibration firmware and post an update.

author: FreddyVictor
author_rank: Regular Contributor
timestamp: May 18, 2014, 03:59:49 pm
content: seem to remember there are 2 versions of Madgwick code: one with, one without magnetometerif you're using the mag, then it must be calibrated so it might be easier to get the version w/o the mag working 1st - small steps n all thatcalibration of gyro must also be done but is straightforward.The main issue with trying to use 3rd party code is that you must have the sensor orientation (ie rotate causes values to say rise instead of fall) matching what the code expectsbut I'm guessing you probably already know this !

author: janoc
author_rank: Super Contributor
timestamp: May 18, 2014, 04:02:59 pm
content: One comment about the Madgwick's filter - if you are using his original code from the internet, beware - there is a major bug and if you are using it on 64bit machine compiled as a 64bit application, it will fail! If I remember correctly, it was a problem in his hand-optimized square root function replacement or something to that effect which doesn't work in 64bits.