Get device height with centimeter precision

Is it possible to get the height (Z location) of an iOS device based on sensor data? I've continuously added the accelerometer data up to infer the location but it results in a cascading error, and the inferred location of the phone "drifts" when the phone is placed still. I want to build an app where users measure the height of something by first zeroing the phone on the floor and then raising the phone to the height of the object, like placing it on the table.

Replies

It sounds like you understand the issues involved with using the accelerometer.

In some cases, "sensor fusion" can be used to combine inputs from multiple sensors to get useful results; search for "Kalman Filter". I think this was first used for the Apollo navigation computer.

It might be possible to combine barometric pressure data with accelerometer data to measure things in the way you want. Have you looked at the barometric pressure data?

Does Core Motion already do any of this for you?

Hi, have you solve it? I am using similar data for different applicable, but I notice the drift caused by the noise in the sensing data. How did you solve that issue?

Sensor fusion / Kalman filter was indeed the right direction to look in, but I never got the time to try a reference implementation unfortunately. Barometer + accelerometer might've worked for much larger discrepancies in height but I don't think the data is useful outside of sensor fusion.