Ellipsoid into Sphere Calibration of Acc and Magn

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
fax8
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Ellipsoid into Sphere Calibration of Acc and Magn

Post by fax8 »

Hi everyone,

I just released some new code for accelerometer and magnetometer calibration using the Ellipsoid into Sphere technique as described in AN3192 from ST Microsystems.
The code is now on the FreeIMU repository and will become part of the FreeIMU library.

Results are pretty good as you should see from the video.

Code is GPLv3, also available from the link above.

Interested in hearing your opinion and eventually help in including something similar in MultiWii.

Fabio

User avatar
Bledi
Posts: 187
Joined: Sat Sep 10, 2011 6:36 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by Bledi »

my opinion : "Wahooooooooooooooooooooooooo" looks really great !

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by jevermeister »

do want!!!

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by shikra »

Fabio - it looks really good and fast. I hope can beintegrated

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by howardhb »

F A N T A S T I C !

fax8
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by fax8 »

Hey, I worked on porting this calibration approach into an easy to use calibration GUI. Today I completed the alpha version of it, please see http://www.varesano.net/blog/fabio/free ... ersion-out

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by scrat »

This looks very promising. I hope this can bi implemented in mwi code.

jy0933
Posts: 180
Joined: Wed Jun 27, 2012 4:24 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by jy0933 »

one big drift factor is temperature.... how do you avoid that?

fax8
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by fax8 »

This is one way of doing it. http://code.google.com/p/itg-3200driver ... etail?id=9

The calibration I released doesn't include temperature compensation, still it's pretty good if you calibrate at the same temperature of usage. I'm doing this work as part of my research on Human-Computer Interaction so I use such sensors in room temperature.. so temp bias are not an huge problem for me.

jy0933
Posts: 180
Joined: Wed Jun 27, 2012 4:24 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by jy0933 »

that is true for indoor application....

i just want to point out for multirotor... most of us fly out door in various flight condition... can be as hot as 30~40c in summer.. and also can be as cold as -10~20c in winter...also various humidity level..recalibration each time before flight

(i could be wrong... since i'm not sure if I get the idea right... the biggest problem is the level state in flight is not usually level of state on table... still I could be wrong... cuz im ME and not as familiar with EE and coding)

but.. anyways... it is pretty amazing

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by Sebbi »

So this is an external calibration application, correct? You record acc/magnetometer for some time while moving it around (slowly?) and this input combined with some matrix "magic" gives offsets and scale factors? Together with a static calibration over a temperature range it could also get temperature drift and gyro bias/offsets, the only thing missing would be gyro scalefactors which could be derived from slow rotations, too.

Question is: is this more accurate than the factory calibration that the MPU6050 supposedly went through?

P.S.: Cross axis sensitivity and axis alignment shouldn't be much of an issue with the MPU but would be interesting for other sensors. Possible to get this data from the calibration procedure?

fax8
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by fax8 »

@jy0933 I'm a quadcopter pilot too... I know how different flying conditions can be. Yeah, table level may be different from flying level. This is covered by my calibration approach, as long as you mounted your sensors parallel to the flying level state.

@Sebbi Yeah, that app is to be used on my FreeIMU library, but can be easealy extended with other serial protocols (the gui already has a field for that). Yes, it logs acc and magn values while the users performs a 3D sphere with his sensors. Visual feedback is provided so that the user knows that he is doing the motions correctly. After the process is complete scales and offsets are generated and can be saved to EEPROM or an C header file for later compilation. Yes, temperature is the missing but, as I said, that's not top priority for me. Right, gyro can be scaled using known rotations: I know of researchers doing that on audio turntables with good results.

I'm using MPU6050. These are plots raw uncalibrated data from it.

Image

As you can see, there is no evidence of any factory calibration of these data. See for example the ZX plane. This is supposed to be a pretty perfect circle centered in zero. See how instead it is not centered in zero and looks like an oval.. there isn't any factory calibration, as far as this data shows.

The document from which my calibration has been implemented (google for AN3192) suggests also an approach for sensor misalignment compensation. It didn't look like a major task when I looked into it.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by copterrichie »

Is it possible the Digital Motion Processor has a calibration routine within it and because we are accessing the Gyro/ACC directly, we are bypassing this firmware?

run-time calibration firmware
http://www.invensense.com/mems/gyro/mpu6050.html
Last edited by copterrichie on Wed Oct 31, 2012 1:26 am, edited 1 time in total.

fax8
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by fax8 »

It could be.. but what can we do about it since there aren't docs about it? (.. that I'm aware of, of course ..)

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by copterrichie »

Point!

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by Sebbi »

The developer section of invensense.com has the complete source code they use to access the DMP and the support promised me last week that they are working on written documentation. They would be awefully late for a product that is available for over a year now, but hey ... I wont complain if we don't have to go through their largish codebase anymore. And yes, the DMP has some form of temperature calibration method and you can also set bias/offsets and scalefactors. I don't know if there are factory calibrated values in there somewhere of if you are supposed to set them everytime though ;-)

The AN3192 method would be something you do only once for each sensor, right? If a pilot has done this there is only level trim that would need adjustment ... could be interesting.

fax8
Posts: 61
Joined: Mon Feb 14, 2011 5:29 pm

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by fax8 »

Personally, the more I looked into the DMP the more I understood that it's pretty much marketing vapor words. Too slow, obscure, undocumented, closed to be of any use.
I'm not going to waste time on the DMP anymore.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: Ellipsoid into Sphere Calibration of Acc and Magn

Post by dramida »

What would improve to a copter this new routine? is it affected by lateral acceleration in angle computation? How fast is it compared with giro-acc CF?

Post Reply