Shop OBEX P1 Docs P2 Docs Learn Events
Having major HM55B compass accuracy problems - Page 2 — Parallax Forums

Having major HM55B compass accuracy problems

2»

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-10-14 06:43
    Don,

    What I was thinking, in level position you can measure (magnetic) X, Y and Z, with Z than being

    your Zg value.

    Rotating the sensor around the Z-axis will only affect X and Y values (heading change)

    Rotating around the X-axis will affect Z and Y (roll)

    Rotating around the Y-axis will affect Z and X (pitch)

    So, if Z deviates from Zg you have pitch and/or roll.

    To calculate pitch and roll you get·something very much like·equations 4 I guess·(perhaps using Z-Zg for Z).

    Question is how Zg would vary in the area your sensor would move.

    If the area is not too large I would expect the Zg to be constant across the whole area.

    regards peter
  • Don FrenchDon French Posts: 126
    edited 2005-10-14 18:01
    Interesting reading, indeed. A little heavy on the math and I will have to do more than speed read it when I get home tonight before I can say that I understand it completely. However, one problem with their solution (for correcting a 2-axis compass heading for tilt) is that it depends on a 2-axis inclinometer, which prevents using their technique with an accelerating device. Also, they describe a technique for estimating the z-axis magnetic component. With a 3-axis magnetometer I think you should be able to skip that step. But I don't think that means you can eliminate the inclinometer. I will have to study the article more closely to be sure.

    As to your earlier post, I have access to a 3-axis magnetomer that I will do some experimenting with. I already verified that Z remains relatively constant while rotating the device on a level surface. And Z changes with pitch and roll. But of course, so do X and Y. I will try your idea out and see what results and I will let you know. The manufacturer of the 3-axis magnetomer tells me, by the way, that there is no way to get tilt from the three axes. So, if it turns out to be possible, maybe I will offer to explain it to them for a consultancy fee and split the fee with you. smile.gif
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-10-15 09:10
    Don,

    I drew up a diagram to calculate the resulting tilt angle.

    The resulting tilt angle is the angle between the resulting XY-vector and the

    horizontal plane. I don't think you can extract pitch and roll angles exactly

    from just X, Y and Z values. But if you assume pitch and roll are equal,

    then that compensation may already be better than no compensation.

    I do not know the range the resulting tilt angle has, but it sure can not

    be outside -45 to +45 degrees (than the sensor's Z-axis moves closer to

    the X-axis or Y-axis, which would result in Z=Zg again but then it is not level)

    For Z=Zg the resulting tilt angle phi = 0 and this does not conflict with

    the found expressions.

    regards peter
  • Don FrenchDon French Posts: 126
    edited 2005-10-15 23:04
    Nice diagram!

    Well, that brought me back 40 years! With a little bit of brushing up on my trig, I was able to follow all of it right up to where you eliminated cos(phi) from this equation:

    X*sin(phi) = Z*cos(phi) - Zg

    To give you this one:

    tan(phi) = (Z - Zg)/X

    You are right of course, that when phi is near 0, cos(phi) approaches 1 and you can legitimately eliminate it from the equation (and the equation becomes sin(phi) = (Z - Zg)/X) . But if phi is very large at all, you can not eliminate it. For example, if phi is 30 degrees, tan(phi) using (Z-Zg)/X comes to .866 instead of .577, as it should for 30 degrees. This is too large an error to ignore.

    I am afraid that you need an inclinometer to compensate for tilt, just as all the articles and all the manufacturers of electronic compasses claim. Fortunately, the combination of the HM55B compass and the Mesmic 2125 Accelerometer, used with the technique you pointed me to in the article for calibrating a 2-axis magnetometer will do the job for static readings. Of course, you still have the problem the tilt readings being skewed by linear acceleration, but I don't see an easy way around that one right now, other than using an odometer and computing acceleration by differentiating speed over time (ugh!)
  • Don FrenchDon French Posts: 126
    edited 2005-10-15 23:07
    I think I accidently unsubscribed from this thread, and I don't see another way to re-subscribe except to send a post and check the Notify me box.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-10-16 00:43
    You should resolve phi from

    SQRT(X*X+Y*Y)*sin(phi) = Z*cos(phi) - Zg

    for given X, Y, Z and Zg

    (the approximation is·for very small phi only)

    Not easy, but an iteration might work (like Newton-Raphson method)

    Now, if only you·could express Xh and Yh in terms of phi instead of roll and pitch !

    that would let you calculate the·compensated heading·ATN(Yh/Xh)

    regards peter

    PS. I did not eliminate cos(phi) from the expression you mentioned but from the first expression.

    But for small phi approx. tan(phi) = sin(phi) = phi with phi in rad




    Post Edited (Peter Verkaik) : 10/16/2005 12:49:10 AM GMT
  • Don FrenchDon French Posts: 126
    edited 2005-10-16 01:32
    Oh? Didn't you eliminate cos(phi) when going from

    X*sin(phi) = Z*cos(phi) - Zg

    to

    tan(phi) = (Z - Zg)/X

    by transforming the equation in the following steps:

    1) divide both sides by cos(phi)
    X*sin(phi)/cos(phi) = (Z*cos(phi) - Zg)/cos(phi)
    2) simplify left side because sin/cos = tan
    X*tan(phi) = (Z*cos(phi) - Zg)/cos(phi)
    3) simplify right side by doing the division
    X*tan(phi) = Z-(Zg/cos(phi))
    4) Divide both sides by X
    tan(phi) = (Z - (Zg/cos(phi)))/X
    5) And now is when you dropped cos(phi)
    tan(phi) = (Z-Zg) /X
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-10-16 07:51
    I took the outcome of the diagrams

    tan(phi) = (Z*cos(phi)-Zg)/(X*cos(phi))

    and when cos(phi) approaches 1,

    tan(phi) = (Z-Zg)/X

    regards peter
Sign In or Register to comment.