MPU-9150 MotionFit SDK - Get Linear Acceleration?

By wueber , 23 April 2013

Hi Everyone,

I have an MPU-9150 MotionFit Wireless SDK board with its demo firmware. By default, this seems to output the 6 axis fusion quaternion over bluetooth. I need to demo positioning with this SDK, for which I actually need to double-integrate linear acceleration. I was hoping that I could actually get "fused" linear acceleration with the default firmware, but it seems that I can only get the raw accelerometer output (by sending the SDK the "command" inva). I unfortunately do not have access to an MPS430 programmer at this time, so I cannot change the firmware on the Motionfit SDK, or at least not in the timeframe I have available. My questions are:

(1) Am I perhaps missing something in the default SDK firmware that will allow me to get "fusion" linear acceleration?
(2) If not, if there a way to derive acceleration components from two subsequent fusion Quaternions?

Thanks in advance.
Stefan

guy_mcilroy

12 years 11 months ago

There is no such thing as a dumb question :)

World-frame linear acceleration is not transmitted in the default application. You can calculate it by transmitting the quaternion and the raw acceleration. Rotate the accleration vector by the quaternion, and it should be the "fused acceleration" output you are looking for. Please be aware of the typical issues with position calculation, it only is very accurate if integrated over a short period of time (few seconds).

phpbb Post ID
22908

wueber

12 years 10 months ago

Thanks sectionsbest!

I found the following summary on http://http://arduino.cc/forum/index.php?topic=77622.0;wap2

1. Obtain orientation of device and store in quaternion (accomplished by the IMU filter).
2. Calculate estimated gravity vector from quaternion.
3. Remove acceleration due to gravity from raw accelerometer x/y/z measurements.
4. Store gravity-free acceleration as a quaternion where w (vector rotation) is zero.
5. Multiply orientation quaternion [w, x, y, z] by gravity-free acceleration quaternion [0, accX, accY, accZ].
6. Multiply previous result quaternion by the conjugate of the acceleration quaternion [w, -x, -y, -z].
7. Final result quaternion now contains [0, realX, realY, realZ] acceleration in the starting (non-rotated) frame of reference.

Does this sound correct? If so, step (2) is a little vague to me. Can someone perhaps assist me with that?

phpbb Post ID
22911

guy_mcilroy

12 years 10 months ago

Logically, it's straightforward. You need to subtract the 1G gravity vector from the raw acceleration reading, or else any velocity / position calculations would be accelerating rapidly. Several versions of MPL have calculated "gravity" as a separate output within the API, this might be helpful.

phpbb Post ID
22914

bhekiburgs

10 years 1 month ago

How do I implement code in python that can transmit the quaternion (in my case the Rotation Matrix) and the raw acceleration at the same time so that I can multipy the acceleration by the matrix. I have tried using two "if statements" for the self.type == 0 and self.type == 5 to get the acceleration and rotation matrix. But when I try and retrieve both using "inva" and "invr", and use them in a calculation, I get an "UnboundLocal Error" saying that my acceleration is being used before it is defined? Please help

phpbb Post ID
33092
phpbb Topic ID
15231