# Knowing acceleration, gyro and compass data how to calculate north direction [closed]

I have a small video camera with an attached sensor. I can get from the sensor his acceleration, gyro and compass data. Knowing this data I need to rotate the camera so that it will look strictly north.

I know how to rotate the camera, but how to calculate the right angle?

How can I do it? Or where can I read about it? Or, if this is not a right place to ask such a question, what is the right place?

EDIT:

All coordinates are in an Earth-fixed inertial frame.The compass and accelerometer readings are unit vectors, and the gyroscope readings are in radians per second

## closed as unclear what you're asking by BradHards, Devdatta Tengshe, Fezter♦, Curlew, whuber♦Jan 5 '14 at 15:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• What, precisely, is the form of the gyro and compass data? – whuber Jan 4 '14 at 19:38
• @whuber: XYZ vector – Flot2011 Jan 5 '14 at 8:43
• Let me just double check the interpretation "XYZ vectors" in this context. You seem to saying that the "compass data" are a vector (X_c, Y_c, Z_c). (1) Is this the direction the camera is pointed? (2) In what frame are the coordinates? Are they in earth-centric Cartesian coordinates, in local geodetic coordinates, or perhaps are they coordinates of a northern direction relative to a dedicated camera frame? (3) Apparently the "gyro data" are also in the form (X_g, Y_g, Z_g). (4) What does this mean? – whuber Jan 5 '14 at 15:34
• @whuber: see my edited answer – Flot2011 Jan 5 '14 at 19:50
• You're still not explaining this very well. Can you try to add a diagram showing the reference frames. In particular, some details of how you initialise the inertial sensors might help, and how the inertial frame varies relative to ECEF (or some local coordinate frame) over time. Also, are the compass measures really in an inertial frame? – BradHards Jan 5 '14 at 22:08

These Q&As don't cover acceleration and gyroscopes, but they do concern true and magnetic north:

``````TN: true north
|     MN: magnetic north
|    /        -^
|MD /      -^
|  / MB -^
| /  -^
|/-^
``````

True bearing = magnetic bearing (MB) + magnetic declination (MD)

Note: MN may be to West or East of TN

Regarding Earth-fixed and Inertial reference frames:

Earth-centered inertial (ECI) coordinate frames have their origins at the center of mass of the Earth. ECI frames are called inertial in contrast to the Earth-centered, Earth-fixed (ECEF) frames which rotate in inertial space in order to remain fixed with respect to the surface of the Earth.

For a possibly very useful Python library, see How To: Transform between the Earth Centered Fixed and Earth Centered Inertial reference frames

It shows how to use Analytical Graphics, Inc's Dynamic Geometry Library to compute the rotation between the Earth Centered Fixed (ECF) and Earth Centered Inertial (ECI) reference frames.

• How would the original poster use the information in those links? We discourage link-only answers, even to our own stuff. Since it doesn't actually answer the question, perhaps it would be better as a comment against the original question. – BradHards Jan 4 '14 at 22:53
• I added more details and another reference. We cannot say if it answers the Q or not because (as you et al. have said) the Q is unclear, but i think we have the beginnings of an answer or at least some useful info. – Martin F Jan 6 '14 at 1:25