objective c - Getting magnetic north from a xyz magnetometer (iPhone 3.0) -


I'm actually posting a question from the iphone development boards. I did not ask this, but when I find the answer I tried it so I got it No one was responding there so far, so I thought I would try to post it here.

Thanks for any help!

Is any magnetic CLHeading growing with the raw xyz values? I am sure there should be a general approach for this, which also works for different magnitometers.

If you do not want to use the trueHeading value and agree The compass is completely horizontal, the title can be calculated in such a way:

  • (y> 0) title = 90 - ANA2 (x, y) * 180 / p < / Li>
  • (y <0) title = 270 - ANA2 (x, y) * 180 / p
  • (y = 0
  • (y = 0 , X> 0) Title = 0.0

(from these)

... should be correct for plus title and

if If the compass is not horizontal, you (x, y, etc) B) can not ignore the launch and must use only the horizontal component (you z axis) z) vector that is parallel to the earth's surface and then calculate the projected X Title Y.

Hope this will be helpful.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -