Jump to content


Calibration and Z-component of Earth's Field


  • Please log in to reply
9 replies to this topic

#1 fenestren

fenestren

    New Member

  • Members
  • Pip
  • 6 posts
  • Country: flag of Italy Italy

Posted 09 February 2011 - 08:25 AM

Hi all,
I'm Luca from Italy.
While looking for info about a calibration algorithm for tri-axial magnetometer, I found  this one.
Considering the parameters at page 6 and the z-component of the Earth's magnetic field, I can't understand how it is possible to have sampled data in a ring shaped form on the ellipsoid (simmetric with respect to the ellipsoid equator), instead of on the upper cap of the ellipsoid (figures at page 7).
It seems to me they did not consider the z-component (about 0.4 gauss).

Can you hep me, please?

Thanks.
Greetings from Italy.
Luca.

#2 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 09 February 2011 - 06:46 PM

I'll answer your question and then go off topic:  They do take this into account.  Up to page 5 they are talking about calibrating the mags (i.e. estimating a full 3D affine transformation that corrects for hard and soft metal).  On page 6 they are talking about a second matrix that is the rotation between the calibrated sensor (x,y,z) an the body reference (x,y,z) if the sensor is mounted crooked on the craft (i.e. V is a 3D rotation matrix).  Fig 3 I believe is simply indicating an example set of points.  Unless I'm totally misunderstanding this.

<aside>

I like doing nice statistical models as much as the next guy, but I have two problem with something like this:

1)  "Assuming that the noise on the magnetometer readings is a zero mean Gaussian process with variance σm2 i".  Assuming a diagonal noise on the mags without validating that could easily cause a bigger issue than what this complex algorithm offers on top of simpler ones.  

2) In our case given the degree of cross axis sensitivity, I'm fairly confident for any reasonable calibration routine you will increase the error due to noise in your parameter estimation.  Sure if you mount your craft in a non-magnetic gimbal and let it run for 30 minutes you could improve things.  This made more sense 3 years ago when it was published and you used separate sensors for each axis.  It _might_ be worth estimating an alignment between the various sensor chips but I'm really skeptical even that is worth it.  I take very little care to even make sure my INS is pointing accurately forward.

</aside>

#3 fenestren

fenestren

    New Member

  • Members
  • Pip
  • 6 posts
  • Country: flag of Italy Italy

Posted 10 February 2011 - 08:19 AM

View Postpeabody124, on 09 February 2011 - 06:46 PM, said:

Fig 3 I believe is simply indicating an example set of points.  Unless I'm totally misunderstanding this.

Hi.
Thanks for your reply.
Sorry, but I still can't understand those data if they represent data sampled by magnetometer at their position(as reported in the legend of fig.3)
The situation showed is more unique rather than typical: z-component is near zero only near the equator.

Has anyone data sampled at his own location to show that could help me to understand, please?
Thank you.

#4 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 10 February 2011 - 03:48 PM

Yes, that is ellipse is meant to be the set of mag data that would be measured rotating the craft through all orientations (well all roll and pitch would be enough).  That's why it's a ellipsoid in 3D - which is topologically a 2D surface.  Their diagram isn't showing the z near zero.  If it were that ellipsoid would look like a pancake.  That paper is very math-centric (judging by how much time they spend pedantically defining their rotation groups) so you should probably start with a primer of how to represent transformations with matricies.

I definitely measure a strong magnetic z-component in Tx (in fact 4 times as strong as the horizontal component) so it is very important to account for this.  That's why we have the HomeLocation object which contains the magnetic flux at your location.

#5 fenestren

fenestren

    New Member

  • Members
  • Pip
  • 6 posts
  • Country: flag of Italy Italy

Posted 10 February 2011 - 04:33 PM

View Postpeabody124, on 10 February 2011 - 03:48 PM, said:

Yes, that is ellipse is meant to be the set of mag data that would be measured rotating the craft through all orientations (well all roll and pitch would be enough).

What have I to expect if the rotations are made for: 0<yaw<360, -20<picth<20 and -15<roll<15?

Is 3D mag calibration accurate and reliable only for large variation of pitch and roll?

Do you have suggestion about other calibration algorithms, please?

Thanks a lot.

Luca.

#6 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 10 February 2011 - 05:18 PM

View Postfenestren, on 10 February 2011 - 04:33 PM, said:

What have I to expect if the rotations are made for: 0<yaw<360, -20<picth<20 and -15<roll<15?

Here is matlab some code assuming no distortions in the field and based in TX.

% magnetic vector in TX
Be = [9000 300 40000]';

% rotation matrix for each axis
Rx = @(x) [1 0 0; 0 cos(x) -sin(x); 0 sin(x) cos(x)];
Ry = @(y) [cos(y) 0 sin(y); 0 1 0; -sin(y) 0 cos(y)];
Rz = @(z) [cos(z) -sin(z) 0; sin(z) cos(z) 0; 0 0 1];

% set up the rotations dude asked for
yaw = (0:5:360) * pi / 180;
pitch = (-15:5:15) * pi / 180;
roll = (-15:5:15) * pi / 180;
[r p y] = meshgrid(roll,pitch,yaw);

% loop over linearized indicies
Br = zeros(3,numel(r));
for i = 1:numel(y)
	Br(:,i) = Rx(r(i))*Ry(p(i))*Rz(y(i)) * Be;
end

% plot the resulting field measurements
plot3(Br(1,:),Br(2,:),Br(3,:),'.')
xlabel('X field (nT)');
ylabel('Y field (nT)');
zlabel('Z field (nT)');

xlim([-40000 40000]);
ylim([-40000 40000]);
zlim([-40000 40000]);

Posted Image


and scaled evenly on each axis:

Posted Image

So you can see you only sample the top of the ellipsoid.

We use a 6pt calibration routine which is suspect is reasonable if your wires are tight and you don't pick up a lot of motor interference.  There's another guy (see thread about "Another STM32 Quad") who has a much more sophisticated algorithm that predicts based on motor speed.

Anyway, I'm not doing any more of your homework :)  You need to read more about this.

#7 Gary Mortimer

Gary Mortimer

    Member

  • Banned
  • PipPipPip
  • 832 posts
  • LocationCold Brayfield UK, Rosetta RSA
  • Country: flag of South Africa South Africa


Posted 10 February 2011 - 06:45 PM

Just seeing this one, catching it late, is it an OP easter egg design competiton?

#8 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 10 February 2011 - 06:49 PM

LOL.  Yeah.  Opie is going on an egg hunt!

#9 fenestren

fenestren

    New Member

  • Members
  • Pip
  • 6 posts
  • Country: flag of Italy Italy

Posted 10 February 2011 - 08:04 PM

View Postpeabody124, on 10 February 2011 - 05:18 PM, said:

Here is matlab some code assuming no distortions in the field and based in TX.

Anyway, I'm not doing any more of your homework :)  You need to read more about this.

I'm not so expert like you with Matlab, but my code, although terribly far from being optimized, give me the same result.

n_punti=1000;

for i=0:(n_punti-1)
	heading_deg(1,i+1)=i*360/n_punti;
	
	bank_deg(1,i+1) = randi([-15 15]); % Vettore colonna da n elementi
		
	elevation_deg(1,i+1) = randi([-20 20]); % randi([-20 20]);
	
end;

bank = bank_deg*pi/180;
elevation = elevation_deg*pi/180;
heading = heading_deg*pi/180;

Figure 1: undistorted field @ San Francisco

Attached File  untitled.png   31.7K   47 downloads

Figure 2: undistorted field (red) and distorted field (blue)

Attached File  untitled2.png   8.02K   44 downloads

Figure 3: magnetometer value x, y, z

Attached File  untitled3.png   12.79K   46 downloads

I tried with ellipsoid fitting algotithm with awful results...

#10 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 10 February 2011 - 08:20 PM

yeah i think you'll need to sample more orientations to make it work well.