Search code examples
iosiphoneswiftcore-motion

what is the physical difference between gyro, motion, and acceleration?


I am trying to understand the different movement/postion gyro, motion, and acceleration are meant to represent. (startGyroUpdates, startDeviceMotionUpdates, etc).

However, after some research I am strugglying to see the difference between gyro and motion. Gyro has x,y,z of rotation, and Motion has roll, pitch, yaw of rotation...Same thing?

i need something that will detect how far horizontally, vertically the user has actually moved the phone from it's original position (as if the axis are your arms as a graph!)...I was hoping that is what motion is. Could some one clear this up for me, and direct me to the correct tools I want to use for this?

Cheers.


Solution

  • Core motion is a framework that combines input from the internal gyroscope and accelerometer. It is a higher-level API, and probably the better choice unless your application specifically needs raw gyro or accelerometer data.

    None of the options you are considering (gyroscope, accelerometer, or Core Motion) are suited for calculating the device's location in space.

    The problem is drift. The accelerometer isn't exact, so if you accelerate your phone in a given direction (by walking, say) then slow to a stop, the measurements from the accelerometer are not accurate enough to tell if you've stopped or if you are still drifting slightly. Over time, the drift errors build up, to the point where a position calculated with the accelerometer could be off by kilometers.

    You need something like GPS or cell tower based positioning in order to get reasonably accurate position information. You can also set up a system with iBeacons at known locations, although that has it's own limitations.