From the course: Advanced iOS App Development: Core Motion

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Attitude and device orientation

Attitude and device orientation - iOS Tutorial

From the course: Advanced iOS App Development: Core Motion

Start my 1-month free trial

Attitude and device orientation

- [Instructor] The gyroscope measures rotation rate. That's how fast we are swinging but does not directly measure rotation, which we call attitude. Device motion can calculate attitude for us based on sensor data and a reference frame. A reference frame is a state of the phone at the start of updates. Some applications require a reference frame, some don't. Close the console. Go up to the line in myDeviceMotion. StartDeviceMotionUpdates. Delete the method there and start typing it again. Start capital 'Dev.' That should leave you with the four options we talked before. Select the one with using for a parameter. For that parameter just press the period. You'll see the enumeration values. There are four of them. All assumes 'Z' is vertical. The xArbitratyZVertical has an 'X' axis pointed in the arbitrary direction. The corrected vertical uses the magnetometer to correct for rotation errors but it takes more power to do so. The magnetic north orients the 'X' axis to magnetic north or…

Contents