Calculate elevation and bearing from CMAttitude using either Roll, pitch and Yaw, or Quaternion, or Rotation Matrix

The problem strikes me. I want to convert CMAttitude iPhone information to height (0 to 90deg) and bearing (0 to 360 degrees). I have googled around and hit some topics that discuss about this, but none of the threads work out with a positive answer, and most articles discussing the angles of Quaternion and Euler have too much math to pour into my brain!

Is there any open source material that can handle this task easily? Or did someone write code to perform this conversion?

Edit: First of all, sorry for being so abstract!

Azimuth is the direction on the surface of the earth that the device points to. Like north = 0 degrees, northeast = 45 degrees, east = 90 degrees, south = 180 degrees, etc. Range from 0 to 360 degrees:

enter image description here

Height is the angle made from the plane of the Earth to an object in the sky: enter image description here

Thanks,

Rajah

+6
source share
1 answer

Using CMDeviceMotion, you can get a CMAttitude object using “roll, pitch and yaw” - where, for example, if the phone is in portrait mode, “yaw” is “azimuth”, “step” is tilting the phone using respect for the earth or zenith, and the "roll" is a vector that indicates through the screen, and not what interests you.

Everything becomes a little more complicated, because the "azimuth" is the projection of a three-dimensional magnetic vector (directed towards the magnetic north pole) onto a flat "earth" plane, which changes depending on the orientation of the device, but with this understanding in mind, terms such as this should be much clearer. If you only need your application to work in one orientation, everything becomes much easier.

PS "altitude" is almost exclusively used to indicate altitude or altitude relative to this reference (sea level, geodetic altitude, etc.). “Zenith” or “step” is preferable, and since you are on iOS, you must adhere to their coordinate scheme: (lat, lon, alt), (pitch, yaw, roll).

+4
source

Source: https://habr.com/ru/post/886566/


All Articles