From the course: Advanced iOS App Development: Core Motion

Introducing altitude - iOS Tutorial

From the course: Advanced iOS App Development: Core Motion

Start my 1-month free trial

Introducing altitude

- [Instructor] We've looked at the three axes on your device for movement and rotation in device motion. There are a few more sensors outside device motion which you as a developer query more directly, such as the magnetometer, and the altimeter. Let's go back to that Z-Axis. As you saw with attitude changes like roll or pitch, the Z-Axis is no longer up or down, but some other measure of the direction of the face of the phone. We adjusted for that, in the fencing app, by changing the axes. An alternative for changes in height for your phone independent of the attitude is called Altitude. Starting with iPhone 6, there is a separate sensor for altitude call the Altimeter. On a run in the mountains, the altimeter will be figuring changes in how much up or down a mountain you are. This is a low power alternative to the much more accurate GPS. Altitude uses an air pressure sensor, measuring air pressure in kilopascals. The altimeter in your phone is a very sensitive device, maybe too sensitive. Altitude is not the only factor affecting air pressure. You have an error of 1 to 2 kilopascals between a sunny day and a thunderstorm. Temperature also changes pressure. We've discussed noise already. Device motion tries to minimize noise by taking some factors into consideration. One strategy for lessening noise in an altimeter is a simple one. Instead of reporting absolute positions, core of motion reports changes in motion. Because of noise and no reference point, the altimeter gives us a change in altitude, not the altitude itself. I know if I move up or down five or ten meters, but I don't know my exact altitude. You can use the gyroscope, and the accelerometer in raw modes, but as we've discussed them using device motion, let's look at these last two, the altitude and altimeter, for raw data.

Contents