Support for MPU6050

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.

Re: Support for MPU6050

Postby amourdurisk » Wed Feb 29, 2012 5:05 pm

fax8 wrote:Our initial tests showed that the MPU6050 is quite more stable than the ITG3200.. does the readings seem ok in the GUI??


Hi fax8,

All the readings seems ok in the GUI.
it seems to be more sensitive to vibrations than the ITG.
I feel that the LPF is not effective on the MPU.
When I turn off the LPF on the ITG I have the same problem, the quad will not take off.
LPF42hz with the ITG, the quad flies perfectly.
amourdurisk
 
Posts: 31
Joined: Wed Nov 02, 2011 8:58 pm

Re: Support for MPU6050

Postby jstapels » Sun Mar 04, 2012 8:56 pm

Hi, I'm brand new to the world of quadcopters and currently in the research phase. My initial plan was to use Fabio's wonderful FreeIMU design along with an Arduino mini pro as the base for my first copter. However, I'm having a really hard time finding a place to buy the pressure sensor and they still haven't responded to any of my emails. Anyways, my question is, do I really need a pressure sensor if I'm going to use the MultiWii software?

It seems most builds don't use them and to my noob eyes, I would think the accelerometers would be used to help keep the vertical copter stable vertically. Any help would be greatly appreciated.
User avatar
jstapels
 
Posts: 23
Joined: Sun Mar 04, 2012 8:50 pm
Location: Software Engineer

Re: Support for MPU6050

Postby Alexinparis » Sun Mar 04, 2012 11:23 pm

Hi,

FreeIMU are again available since few days on flyduino or viacopter web shop.
A pressure sensor is not mandatory for multiwii.
Alexinparis
 
Posts: 1546
Joined: Wed Jan 19, 2011 9:07 pm

Re: Support for MPU6050

Postby jstapels » Mon Mar 05, 2012 1:37 am

Alexinparis wrote:Hi,

FreeIMU are again available since few days on flyduino or viacopter web shop.
A pressure sensor is not mandatory for multiwii.


Thanks for the quick response. I was aware that the production boards were available, but I was hoping to save a few bucks by building it myself. :)
User avatar
jstapels
 
Posts: 23
Joined: Sun Mar 04, 2012 8:50 pm
Location: Software Engineer

Re: Support for MPU6050

Postby frank26080115 » Tue Mar 06, 2012 5:29 am

Hi, I am Frank, I am the creator of the Picopter project

I have DMP almost working, I've almost finished adapting Noah Zerkin's code to use MultiWii's I2C routines, I am in the testing phase

I have the Picopter output the data via serial port. I have quaternion data.

The problem is I have no idea how to process it into roll and pitch angles.

Sitting still on my desk, the quaternion data are 30252 23548 23293 12242, these are 32 bit signed integers
Moving it only slightly turned them into -7376 -8963 -19205 -1322
The documentation says that these numbers are scaled by 2^30
so scaling by that gave me 0.0000 something that doesn't get printed, also the rotation matrix calculation were too low as a consequence
But through experimentation, the quaternion numbers do not ever exceed 32768, so I scaled by that instead
now the numbers are sane, quaternion data in double type is now between +/- 1, rotation matrix is also between +/- 1
I feed a few of the rotation matrix entries through to _atan2 to get roll and pitch angles, but now the numbers don't make sense

Here's the funny thing: I have almost no linear algebra education beyond finding determinants. This code was written by looking at the MotionApp code provided by InvenSens.

So... who wants to help me? I'll give you my test sketch, it should work on any platform as long as it has I2C and UART
I just need somebody to fix the mathematics in the "dmp_processQuat" function

Here is the sketch
DmpTest.zip
(8.15 KiB) Downloaded 199 times


Note, I'm not using arrays as an optimization, all the postfix numbers are indexed starting from 0, if you believe I should switch to using arrays, tell me so

I don't have any "calibration" routine yet, I have plans on writing them, but I was hoping I can start off by getting the angles to work.

edit: actually, the stuff I copied from MotionApp does not match what I see from http://en.wikipedia.org/wiki/Conversion ... ler_angles at all... err I'm sleepy, I'll try again on Wednesday night

if you have the MPU-60X0, please mess around with it

edit: I need a good arcsin function
frank26080115
 
Posts: 26
Joined: Mon Jul 11, 2011 12:47 pm

Re: Support for MPU6050

Postby fax8 » Tue Mar 06, 2012 11:20 pm

@frank See function sendquat in the Arduino code you find at http://www.varesano.net/blog/fabio/init ... nd-mpu6050

@amourdurisk I'll try investigating your problem.

@jstapels nice you are into building a FreeIMU.. post a picture on my website once your done ;-)
fax8
 
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Support for MPU6050

Postby frank26080115 » Wed Mar 07, 2012 1:01 am

sendQuat doesn't do any translation into Euler angles

sendQuat also doesn't agree with my endianness, I get steady values with little-endian and it looks like sendQuat uses big-endian. Maybe what appears to be steady value is wrong and I've screwed up. I'll do more checks on Wednesday

I'm working on approximating arcsine with y = x + x*x*x/6, that should be accurate enough, right?

edit: also working on calibration, but the names for registers 0x00 to 0x18 in the header file i'm using does not match what is documented in the register map documentation, in fact, register 0x02 to 0x18 are all missing from the documentation, and 0x01 is some sort of AUX_VDDIO instead of MPU_RA_YG_OFFS_TC
frank26080115
 
Posts: 26
Joined: Mon Jul 11, 2011 12:47 pm

Re: Support for MPU6050

Postby fax8 » Wed Mar 07, 2012 1:26 am

frank26080115 wrote:sendQuat doesn't do any translation into Euler angles


It does convert the fixed point quaternion into a float quaternion. It then streams the floats to the serial port into the Processing code (also on the webpage). That's where you find the Euler conversion.. see quaternionToEuler function.
fax8
 
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Support for MPU6050

Postby frank26080115 » Wed Mar 07, 2012 1:31 am

I see it, it is disagreeing with what I'm learning from Wikipedia, I'll just try various equations until something seems right I guess
frank26080115
 
Posts: 26
Joined: Mon Jul 11, 2011 12:47 pm

Re: Support for MPU6050

Postby ciskje » Wed Mar 07, 2012 10:23 pm

if you have q0 q1 q2 q3 (you must normalize it) and want to convert to roll pitch yaw:


// normalise quaternion
norm = sqrt(q0*q0 + q1*q1 + q2*q2 + q3*q3);
q0 = q0 / norm;
q1 = q1 / norm;
q2 = q2 / norm;
q3 = q3 / norm;

y=atan2(2*q1*q2+2*q0*q3,2*q0*q0+2*q1*q1-1);
p=-asin(2 * q1 * q3 - 2 * q0 * q2); // theta
r=atan2(2 * q2 * q3 + 2 * q0 * q1, 2 * q0 * q0 + 2 * q3 * q3 - 1); // phi
User avatar
ciskje
 
Posts: 34
Joined: Sat Mar 26, 2011 12:24 am

PreviousNext

Return to Software development

Who is online

Users browsing this forum: Exabot [Bot], Google Adsense [Bot] and 7 guests